azure-storage-file 1.0.1 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/azure/storage/file.rb +26 -26
- data/lib/azure/storage/file/autoload.rb +45 -45
- data/lib/azure/storage/file/default.rb +101 -101
- data/lib/azure/storage/file/directory.rb +284 -284
- data/lib/azure/storage/file/file.rb +673 -673
- data/lib/azure/storage/file/file_service.rb +346 -343
- data/lib/azure/storage/file/serialization.rb +228 -228
- data/lib/azure/storage/file/share.rb +377 -377
- data/lib/azure/storage/file/version.rb +49 -49
- metadata +10 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f8e3256d8581aaa19a2ba05504511a452a64efaee8f44a1c93cd0258beaa87da
|
4
|
+
data.tar.gz: 9d83b5dc1528faa182d43e31e1db39371a8ebc21a083eb7bc39979b5cd253065
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8314ce9e313caca41cc7069aa798eec965c94fa402cbb18ce0b8e9024ab3d942542f60aeb563fb747b627d0ab4a7a92739046c8b92183be0588a57eabff6977
|
7
|
+
data.tar.gz: daaa60febefaa9e6842193029a8fff553111904552aef79b3f27c10447fc3c75ee983449a3e095d26cbd97a3351143f45a87bbd8dd554faad087d21867ac5e0a
|
data/lib/azure/storage/file.rb
CHANGED
@@ -1,26 +1,26 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
#-------------------------------------------------------------------------
|
4
|
-
# # Copyright (c) Microsoft and contributors. All rights reserved.
|
5
|
-
#
|
6
|
-
# The MIT License(MIT)
|
7
|
-
|
8
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
9
|
-
# of this software and associated documentation files(the "Software"), to deal
|
10
|
-
# in the Software without restriction, including without limitation the rights
|
11
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
|
12
|
-
# copies of the Software, and to permit persons to whom the Software is
|
13
|
-
# furnished to do so, subject to the following conditions :
|
14
|
-
|
15
|
-
# The above copyright notice and this permission notice shall be included in
|
16
|
-
# all copies or substantial portions of the Software.
|
17
|
-
|
18
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
|
21
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24
|
-
# THE SOFTWARE.
|
25
|
-
#--------------------------------------------------------------------------
|
26
|
-
require "azure/storage/file/autoload"
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#-------------------------------------------------------------------------
|
4
|
+
# # Copyright (c) Microsoft and contributors. All rights reserved.
|
5
|
+
#
|
6
|
+
# The MIT License(MIT)
|
7
|
+
|
8
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
9
|
+
# of this software and associated documentation files(the "Software"), to deal
|
10
|
+
# in the Software without restriction, including without limitation the rights
|
11
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
|
12
|
+
# copies of the Software, and to permit persons to whom the Software is
|
13
|
+
# furnished to do so, subject to the following conditions :
|
14
|
+
|
15
|
+
# The above copyright notice and this permission notice shall be included in
|
16
|
+
# all copies or substantial portions of the Software.
|
17
|
+
|
18
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
|
21
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24
|
+
# THE SOFTWARE.
|
25
|
+
#--------------------------------------------------------------------------
|
26
|
+
require "azure/storage/file/autoload"
|
@@ -1,45 +1,45 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
#-------------------------------------------------------------------------
|
4
|
-
# # Copyright (c) Microsoft and contributors. All rights reserved.
|
5
|
-
#
|
6
|
-
# The MIT License(MIT)
|
7
|
-
|
8
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
9
|
-
# of this software and associated documentation files(the "Software"), to deal
|
10
|
-
# in the Software without restriction, including without limitation the rights
|
11
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
|
12
|
-
# copies of the Software, and to permit persons to whom the Software is
|
13
|
-
# furnished to do so, subject to the following conditions :
|
14
|
-
|
15
|
-
# The above copyright notice and this permission notice shall be included in
|
16
|
-
# all copies or substantial portions of the Software.
|
17
|
-
|
18
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
|
21
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24
|
-
# THE SOFTWARE.
|
25
|
-
#--------------------------------------------------------------------------
|
26
|
-
|
27
|
-
require "rubygems"
|
28
|
-
require "nokogiri"
|
29
|
-
require "base64"
|
30
|
-
|
31
|
-
require "azure/storage/common"
|
32
|
-
|
33
|
-
module Azure
|
34
|
-
module Storage
|
35
|
-
module File
|
36
|
-
autoload :Default, "azure/storage/file/default"
|
37
|
-
autoload :Version, "azure/storage/file/version"
|
38
|
-
autoload :FileService, "azure/storage/file/file_service"
|
39
|
-
autoload :Share, "azure/storage/file/share"
|
40
|
-
autoload :Directory, "azure/storage/file/directory"
|
41
|
-
autoload :File, "azure/storage/file/file"
|
42
|
-
autoload :Serialization, "azure/storage/file/serialization"
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#-------------------------------------------------------------------------
|
4
|
+
# # Copyright (c) Microsoft and contributors. All rights reserved.
|
5
|
+
#
|
6
|
+
# The MIT License(MIT)
|
7
|
+
|
8
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
9
|
+
# of this software and associated documentation files(the "Software"), to deal
|
10
|
+
# in the Software without restriction, including without limitation the rights
|
11
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
|
12
|
+
# copies of the Software, and to permit persons to whom the Software is
|
13
|
+
# furnished to do so, subject to the following conditions :
|
14
|
+
|
15
|
+
# The above copyright notice and this permission notice shall be included in
|
16
|
+
# all copies or substantial portions of the Software.
|
17
|
+
|
18
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
|
21
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24
|
+
# THE SOFTWARE.
|
25
|
+
#--------------------------------------------------------------------------
|
26
|
+
|
27
|
+
require "rubygems"
|
28
|
+
require "nokogiri"
|
29
|
+
require "base64"
|
30
|
+
|
31
|
+
require "azure/storage/common"
|
32
|
+
|
33
|
+
module Azure
|
34
|
+
module Storage
|
35
|
+
module File
|
36
|
+
autoload :Default, "azure/storage/file/default"
|
37
|
+
autoload :Version, "azure/storage/file/version"
|
38
|
+
autoload :FileService, "azure/storage/file/file_service"
|
39
|
+
autoload :Share, "azure/storage/file/share"
|
40
|
+
autoload :Directory, "azure/storage/file/directory"
|
41
|
+
autoload :File, "azure/storage/file/file"
|
42
|
+
autoload :Serialization, "azure/storage/file/serialization"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -1,101 +1,101 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
#-------------------------------------------------------------------------
|
4
|
-
# # Copyright (c) Microsoft and contributors. All rights reserved.
|
5
|
-
#
|
6
|
-
# The MIT License(MIT)
|
7
|
-
|
8
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
9
|
-
# of this software and associated documentation files(the "Software"), to deal
|
10
|
-
# in the Software without restriction, including without limitation the rights
|
11
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
|
12
|
-
# copies of the Software, and to permit persons to whom the Software is
|
13
|
-
# furnished to do so, subject to the following conditions :
|
14
|
-
|
15
|
-
# The above copyright notice and this permission notice shall be included in
|
16
|
-
# all copies or substantial portions of the Software.
|
17
|
-
|
18
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
|
21
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24
|
-
# THE SOFTWARE.
|
25
|
-
#--------------------------------------------------------------------------
|
26
|
-
|
27
|
-
require "rbconfig"
|
28
|
-
require "azure/storage/file/version"
|
29
|
-
|
30
|
-
module Azure::Storage::File
|
31
|
-
module Default
|
32
|
-
# Default REST service (STG) version number
|
33
|
-
STG_VERSION = "2016-05-31"
|
34
|
-
|
35
|
-
# The number of default concurrent requests for parallel operation.
|
36
|
-
DEFAULT_PARALLEL_OPERATION_THREAD_COUNT = 1
|
37
|
-
|
38
|
-
# Constant representing a kilobyte (Non-SI version).
|
39
|
-
KB = 1024
|
40
|
-
# Constant representing a megabyte (Non-SI version).
|
41
|
-
MB = 1024 * 1024
|
42
|
-
# Constant representing a gigabyte (Non-SI version).
|
43
|
-
GB = 1024 * 1024 * 1024
|
44
|
-
|
45
|
-
# Specifies HTTP.
|
46
|
-
HTTP = "http"
|
47
|
-
# Specifies HTTPS.
|
48
|
-
HTTPS = "https"
|
49
|
-
# Default HTTP port.
|
50
|
-
DEFAULT_HTTP_PORT = 80
|
51
|
-
# Default HTTPS port.
|
52
|
-
DEFAULT_HTTPS_PORT = 443
|
53
|
-
|
54
|
-
# Marker for atom metadata.
|
55
|
-
XML_METADATA_MARKER = "$"
|
56
|
-
# Marker for atom value.
|
57
|
-
XML_VALUE_MARKER = "_"
|
58
|
-
|
59
|
-
# Default value for Content-Type if request has body.
|
60
|
-
CONTENT_TYPE_VALUE = "application/octet-stream"
|
61
|
-
|
62
|
-
# Default User Agent header string
|
63
|
-
USER_AGENT = "Azure-Storage/#{Azure::Storage::File::Version.to_uas}-#{Azure::Storage::Common::Version.to_uas} (Ruby #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}; #{Azure::Storage::Common::Default.os})".freeze
|
64
|
-
end
|
65
|
-
|
66
|
-
# Defines constants for use with file operations.
|
67
|
-
module FileConstants
|
68
|
-
# The default write size, in bytes, used by file streams.
|
69
|
-
DEFAULT_WRITE_SIZE_IN_BYTES = 4 * 1024 * 1024
|
70
|
-
|
71
|
-
# The maximum range size when requesting for a contentMD5.
|
72
|
-
MAX_RANGE_GET_SIZE_WITH_MD5 = 4 * 1024 * 1024
|
73
|
-
|
74
|
-
# The maximum range size for a file update operation.
|
75
|
-
MAX_UPDATE_FILE_SIZE = 4 * 1024 * 1024
|
76
|
-
|
77
|
-
# The default minimum size, in bytes, of a file when it must be separated into ranges.
|
78
|
-
DEFAULT_SINGLE_FILE_GET_THRESHOLD_IN_BYTES = 32 * 1024 * 1024
|
79
|
-
|
80
|
-
# The minimum write file size, in bytes, used by file streams.
|
81
|
-
MIN_WRITE_FILE_SIZE_IN_BYTES = 2 * 1024 * 1024
|
82
|
-
|
83
|
-
# Put range write options
|
84
|
-
module RangeWriteOptions
|
85
|
-
UPDATE = "update"
|
86
|
-
CLEAR = "clear"
|
87
|
-
end
|
88
|
-
|
89
|
-
# Resource types.
|
90
|
-
module ResourceTypes
|
91
|
-
SHARE = "s"
|
92
|
-
FILE = "f"
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
module FileErrorCodeStrings
|
97
|
-
SHARE_ALREADY_EXISTS = "ShareAlreadyExists"
|
98
|
-
SHARE_NOT_FOUND = "ShareNotFound"
|
99
|
-
FILE_NOT_FOUND = "FileNotFound"
|
100
|
-
end
|
101
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#-------------------------------------------------------------------------
|
4
|
+
# # Copyright (c) Microsoft and contributors. All rights reserved.
|
5
|
+
#
|
6
|
+
# The MIT License(MIT)
|
7
|
+
|
8
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
9
|
+
# of this software and associated documentation files(the "Software"), to deal
|
10
|
+
# in the Software without restriction, including without limitation the rights
|
11
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
|
12
|
+
# copies of the Software, and to permit persons to whom the Software is
|
13
|
+
# furnished to do so, subject to the following conditions :
|
14
|
+
|
15
|
+
# The above copyright notice and this permission notice shall be included in
|
16
|
+
# all copies or substantial portions of the Software.
|
17
|
+
|
18
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
|
21
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24
|
+
# THE SOFTWARE.
|
25
|
+
#--------------------------------------------------------------------------
|
26
|
+
|
27
|
+
require "rbconfig"
|
28
|
+
require "azure/storage/file/version"
|
29
|
+
|
30
|
+
module Azure::Storage::File
|
31
|
+
module Default
|
32
|
+
# Default REST service (STG) version number
|
33
|
+
STG_VERSION = "2016-05-31"
|
34
|
+
|
35
|
+
# The number of default concurrent requests for parallel operation.
|
36
|
+
DEFAULT_PARALLEL_OPERATION_THREAD_COUNT = 1
|
37
|
+
|
38
|
+
# Constant representing a kilobyte (Non-SI version).
|
39
|
+
KB = 1024
|
40
|
+
# Constant representing a megabyte (Non-SI version).
|
41
|
+
MB = 1024 * 1024
|
42
|
+
# Constant representing a gigabyte (Non-SI version).
|
43
|
+
GB = 1024 * 1024 * 1024
|
44
|
+
|
45
|
+
# Specifies HTTP.
|
46
|
+
HTTP = "http"
|
47
|
+
# Specifies HTTPS.
|
48
|
+
HTTPS = "https"
|
49
|
+
# Default HTTP port.
|
50
|
+
DEFAULT_HTTP_PORT = 80
|
51
|
+
# Default HTTPS port.
|
52
|
+
DEFAULT_HTTPS_PORT = 443
|
53
|
+
|
54
|
+
# Marker for atom metadata.
|
55
|
+
XML_METADATA_MARKER = "$"
|
56
|
+
# Marker for atom value.
|
57
|
+
XML_VALUE_MARKER = "_"
|
58
|
+
|
59
|
+
# Default value for Content-Type if request has body.
|
60
|
+
CONTENT_TYPE_VALUE = "application/octet-stream"
|
61
|
+
|
62
|
+
# Default User Agent header string
|
63
|
+
USER_AGENT = "Azure-Storage/#{Azure::Storage::File::Version.to_uas}-#{Azure::Storage::Common::Version.to_uas} (Ruby #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}; #{Azure::Storage::Common::Default.os})".freeze
|
64
|
+
end
|
65
|
+
|
66
|
+
# Defines constants for use with file operations.
|
67
|
+
module FileConstants
|
68
|
+
# The default write size, in bytes, used by file streams.
|
69
|
+
DEFAULT_WRITE_SIZE_IN_BYTES = 4 * 1024 * 1024
|
70
|
+
|
71
|
+
# The maximum range size when requesting for a contentMD5.
|
72
|
+
MAX_RANGE_GET_SIZE_WITH_MD5 = 4 * 1024 * 1024
|
73
|
+
|
74
|
+
# The maximum range size for a file update operation.
|
75
|
+
MAX_UPDATE_FILE_SIZE = 4 * 1024 * 1024
|
76
|
+
|
77
|
+
# The default minimum size, in bytes, of a file when it must be separated into ranges.
|
78
|
+
DEFAULT_SINGLE_FILE_GET_THRESHOLD_IN_BYTES = 32 * 1024 * 1024
|
79
|
+
|
80
|
+
# The minimum write file size, in bytes, used by file streams.
|
81
|
+
MIN_WRITE_FILE_SIZE_IN_BYTES = 2 * 1024 * 1024
|
82
|
+
|
83
|
+
# Put range write options
|
84
|
+
module RangeWriteOptions
|
85
|
+
UPDATE = "update"
|
86
|
+
CLEAR = "clear"
|
87
|
+
end
|
88
|
+
|
89
|
+
# Resource types.
|
90
|
+
module ResourceTypes
|
91
|
+
SHARE = "s"
|
92
|
+
FILE = "f"
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
module FileErrorCodeStrings
|
97
|
+
SHARE_ALREADY_EXISTS = "ShareAlreadyExists"
|
98
|
+
SHARE_NOT_FOUND = "ShareNotFound"
|
99
|
+
FILE_NOT_FOUND = "FileNotFound"
|
100
|
+
end
|
101
|
+
end
|
@@ -1,284 +1,284 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
#-------------------------------------------------------------------------
|
4
|
-
# # Copyright (c) Microsoft and contributors. All rights reserved.
|
5
|
-
#
|
6
|
-
# The MIT License(MIT)
|
7
|
-
|
8
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
9
|
-
# of this software and associated documentation files(the "Software"), to deal
|
10
|
-
# in the Software without restriction, including without limitation the rights
|
11
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
|
12
|
-
# copies of the Software, and to permit persons to whom the Software is
|
13
|
-
# furnished to do so, subject to the following conditions :
|
14
|
-
|
15
|
-
# The above copyright notice and this permission notice shall be included in
|
16
|
-
# all copies or substantial portions of the Software.
|
17
|
-
|
18
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
|
21
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24
|
-
# THE SOFTWARE.
|
25
|
-
#--------------------------------------------------------------------------
|
26
|
-
require "azure/storage/file/serialization"
|
27
|
-
|
28
|
-
module Azure::Storage::File
|
29
|
-
StorageService = Azure::Storage::Common::Service::StorageService
|
30
|
-
module Directory
|
31
|
-
include Azure::Storage::Common::Service
|
32
|
-
|
33
|
-
class Directory
|
34
|
-
def initialize
|
35
|
-
@properties = {}
|
36
|
-
@metadata = {}
|
37
|
-
yield self if block_given?
|
38
|
-
end
|
39
|
-
|
40
|
-
attr_accessor :name
|
41
|
-
attr_accessor :properties
|
42
|
-
attr_accessor :metadata
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
# Public: Get a list of files or directories under the specified share or directory.
|
47
|
-
# It lists the contents only for a single level of the directory hierarchy.
|
48
|
-
#
|
49
|
-
# ==== Attributes
|
50
|
-
#
|
51
|
-
# * +share+ - String. The name of the file share.
|
52
|
-
# * +directory_path+ - String. The path to the directory.
|
53
|
-
# * +options+ - Hash. Optional parameters.
|
54
|
-
#
|
55
|
-
# ==== Options
|
56
|
-
#
|
57
|
-
# Accepted key/value pairs in options parameter are:
|
58
|
-
#
|
59
|
-
# * +:prefix+ - String. Filters the results to return only directories and files
|
60
|
-
# whose name begins with the specified prefix. (optional)
|
61
|
-
# * +:marker+ - String. An identifier the specifies the portion of the
|
62
|
-
# list to be returned. This value comes from the property
|
63
|
-
# Azure::Storage::Common::EnumerationResults.continuation_token when there
|
64
|
-
# are more shares available than were returned. The
|
65
|
-
# marker value may then be used here to request the next set
|
66
|
-
# of list items. (optional)
|
67
|
-
#
|
68
|
-
# * +:max_results+ - Integer. Specifies the maximum number of shares to return.
|
69
|
-
# If max_results is not specified, or is a value greater than
|
70
|
-
# 5,000, the server will return up to 5,000 items. If it is set
|
71
|
-
# to a value less than or equal to zero, the server will return
|
72
|
-
# status code 400 (Bad Request). (optional)
|
73
|
-
#
|
74
|
-
# * +:timeout+ - Integer. A timeout in seconds.
|
75
|
-
#
|
76
|
-
# * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
|
77
|
-
# in the analytics logs when storage analytics logging is enabled.
|
78
|
-
#
|
79
|
-
# * +:location_mode+ - LocationMode. Specifies the location mode used to decide
|
80
|
-
# which location the request should be sent to.
|
81
|
-
#
|
82
|
-
# See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/list-directories-and-files
|
83
|
-
#
|
84
|
-
# Returns an Azure::Storage::Common::EnumerationResults
|
85
|
-
#
|
86
|
-
def list_directories_and_files(share, directory_path, options = {})
|
87
|
-
query = { "comp" => "list" }
|
88
|
-
unless options.nil?
|
89
|
-
StorageService.with_query query, "marker", options[:marker]
|
90
|
-
StorageService.with_query query, "maxresults", options[:max_results].to_s if options[:max_results]
|
91
|
-
StorageService.with_query query, "timeout", options[:timeout].to_s if options[:timeout]
|
92
|
-
StorageService.with_query query, "prefix", options[:prefix].to_s if options[:prefix]
|
93
|
-
end
|
94
|
-
|
95
|
-
options[:request_location_mode] = Azure::Storage::Common::RequestLocationMode::PRIMARY_OR_SECONDARY
|
96
|
-
uri = directory_uri(share, directory_path, query, options)
|
97
|
-
response = call(:get, uri, nil, {}, options)
|
98
|
-
|
99
|
-
# Result
|
100
|
-
if response.success?
|
101
|
-
Serialization.directories_and_files_enumeration_results_from_xml(response.body)
|
102
|
-
else
|
103
|
-
response.exception
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
# Public: Create a new directory
|
108
|
-
#
|
109
|
-
# ==== Attributes
|
110
|
-
#
|
111
|
-
# * +share+ - String. The name of the file share.
|
112
|
-
# * +directory_path+ - String. The path to the directory.
|
113
|
-
# * +options+ - Hash. Optional parameters.
|
114
|
-
#
|
115
|
-
# ==== Options
|
116
|
-
#
|
117
|
-
# Accepted key/value pairs in options parameter are:
|
118
|
-
# * +:metadata+ - Hash. User defined metadata for the share (optional).
|
119
|
-
# * +:timeout+ - Integer. A timeout in seconds.
|
120
|
-
# * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
|
121
|
-
# in the analytics logs when storage analytics logging is enabled.
|
122
|
-
#
|
123
|
-
# See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/create-directory
|
124
|
-
#
|
125
|
-
# Returns a Directory
|
126
|
-
def create_directory(share, directory_path, options = {})
|
127
|
-
# Query
|
128
|
-
query = {}
|
129
|
-
query["timeout"] = options[:timeout].to_s if options[:timeout]
|
130
|
-
|
131
|
-
# Scheme + path
|
132
|
-
uri = directory_uri(share, directory_path, query)
|
133
|
-
|
134
|
-
# Headers
|
135
|
-
headers = {}
|
136
|
-
StorageService.add_metadata_to_headers(options[:metadata], headers) if options[:metadata]
|
137
|
-
|
138
|
-
# Call
|
139
|
-
response = call(:put, uri, nil, headers, options)
|
140
|
-
|
141
|
-
# result
|
142
|
-
directory = Serialization.directory_from_headers(response.headers)
|
143
|
-
directory.name = directory_path
|
144
|
-
directory.metadata = options[:metadata] if options[:metadata]
|
145
|
-
directory
|
146
|
-
end
|
147
|
-
|
148
|
-
# Public: Returns all system properties for the specified directory,
|
149
|
-
# and can also be used to check the existence of a directory.
|
150
|
-
# The data returned does not include the files in the directory or any subdirectories.
|
151
|
-
#
|
152
|
-
# ==== Attributes
|
153
|
-
#
|
154
|
-
# * +share+ - String. The name of the file share.
|
155
|
-
# * +directory_path+ - String. The path to the directory.
|
156
|
-
# * +options+ - Hash. Optional parameters.
|
157
|
-
#
|
158
|
-
# ==== Options
|
159
|
-
#
|
160
|
-
# Accepted key/value pairs in options parameter are:
|
161
|
-
# * +:timeout+ - Integer. A timeout in seconds.
|
162
|
-
# * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
|
163
|
-
# in the analytics logs when storage analytics logging is enabled.
|
164
|
-
# * +:location_mode+ - LocationMode. Specifies the location mode used to decide
|
165
|
-
# which location the request should be sent to.
|
166
|
-
#
|
167
|
-
# See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-directory-properties
|
168
|
-
#
|
169
|
-
# Returns a Directory
|
170
|
-
def get_directory_properties(share, directory_path, options = {})
|
171
|
-
# Query
|
172
|
-
query = {}
|
173
|
-
query["timeout"] = options[:timeout].to_s if options[:timeout]
|
174
|
-
|
175
|
-
# Call
|
176
|
-
options[:request_location_mode] = Azure::Storage::Common::RequestLocationMode::PRIMARY_OR_SECONDARY
|
177
|
-
response = call(:get, directory_uri(share, directory_path, query, options), nil, {}, options)
|
178
|
-
|
179
|
-
# result
|
180
|
-
directory = Serialization.directory_from_headers(response.headers)
|
181
|
-
directory.name = directory_path
|
182
|
-
directory
|
183
|
-
end
|
184
|
-
|
185
|
-
# Public: Deletes a directory.
|
186
|
-
#
|
187
|
-
# ==== Attributes
|
188
|
-
#
|
189
|
-
# * +share+ - String. The name of the file share.
|
190
|
-
# * +directory_path+ - String. The path to the directory.
|
191
|
-
# * +options+ - Hash. Optional parameters.
|
192
|
-
#
|
193
|
-
# ==== Options
|
194
|
-
#
|
195
|
-
# Accepted key/value pairs in options parameter are:
|
196
|
-
# * +:timeout+ - Integer. A timeout in seconds.
|
197
|
-
# * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
|
198
|
-
# in the analytics logs when storage analytics logging is enabled.
|
199
|
-
#
|
200
|
-
# See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/delete-directory
|
201
|
-
#
|
202
|
-
# Returns nil on success
|
203
|
-
def delete_directory(share, directory_path, options = {})
|
204
|
-
# Query
|
205
|
-
query = {}
|
206
|
-
query["timeout"] = options[:timeout].to_s if options[:timeout]
|
207
|
-
|
208
|
-
# Call
|
209
|
-
call(:delete, directory_uri(share, directory_path, query), nil, {}, options)
|
210
|
-
|
211
|
-
# result
|
212
|
-
nil
|
213
|
-
end
|
214
|
-
|
215
|
-
# Public: Returns only user-defined metadata for the specified directory.
|
216
|
-
#
|
217
|
-
# ==== Attributes
|
218
|
-
#
|
219
|
-
# * +share+ - String. The name of the file share.
|
220
|
-
# * +directory_path+ - String. The path to the directory.
|
221
|
-
# * +options+ - Hash. Optional parameters.
|
222
|
-
#
|
223
|
-
# ==== Options
|
224
|
-
#
|
225
|
-
# Accepted key/value pairs in options parameter are:
|
226
|
-
# * +:timeout+ - Integer. A timeout in seconds.
|
227
|
-
# * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
|
228
|
-
# in the analytics logs when storage analytics logging is enabled.
|
229
|
-
# * +:location_mode+ - LocationMode. Specifies the location mode used to decide
|
230
|
-
# which location the request should be sent to.
|
231
|
-
#
|
232
|
-
# See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-directory-metadata
|
233
|
-
#
|
234
|
-
# Returns a Directory
|
235
|
-
def get_directory_metadata(share, directory_path, options = {})
|
236
|
-
# Query
|
237
|
-
query = { "comp" => "metadata" }
|
238
|
-
query["timeout"] = options[:timeout].to_s if options[:timeout]
|
239
|
-
|
240
|
-
# Call
|
241
|
-
options[:request_location_mode] = Azure::Storage::Common::RequestLocationMode::PRIMARY_OR_SECONDARY
|
242
|
-
response = call(:get, directory_uri(share, directory_path, query, options), nil, {}, options)
|
243
|
-
|
244
|
-
# result
|
245
|
-
directory = Serialization.directory_from_headers(response.headers)
|
246
|
-
directory.name = directory_path
|
247
|
-
directory
|
248
|
-
end
|
249
|
-
|
250
|
-
# Public: Sets custom metadata for the directory.
|
251
|
-
#
|
252
|
-
# ==== Attributes
|
253
|
-
#
|
254
|
-
# * +share+ - String. The name of the file share.
|
255
|
-
# * +directory_path+ - String. The path to the directory.
|
256
|
-
# * +metadata+ - Hash. A Hash of the metadata values.
|
257
|
-
# * +options+ - Hash. Optional parameters.
|
258
|
-
#
|
259
|
-
# ==== Options
|
260
|
-
#
|
261
|
-
# Accepted key/value pairs in options parameter are:
|
262
|
-
# * +:timeout+ - Integer. A timeout in seconds.
|
263
|
-
# * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
|
264
|
-
# in the analytics logs when storage analytics logging is enabled.
|
265
|
-
#
|
266
|
-
# See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/set-directory-metadata
|
267
|
-
#
|
268
|
-
# Returns nil on success
|
269
|
-
def set_directory_metadata(share, directory_path, metadata, options = {})
|
270
|
-
# Query
|
271
|
-
query = { "comp" => "metadata" }
|
272
|
-
query["timeout"] = options[:timeout].to_s if options[:timeout]
|
273
|
-
|
274
|
-
# Headers
|
275
|
-
headers = {}
|
276
|
-
StorageService.add_metadata_to_headers(metadata, headers) if metadata
|
277
|
-
|
278
|
-
# Call
|
279
|
-
call(:put, directory_uri(share, directory_path, query), nil, headers, options)
|
280
|
-
|
281
|
-
# Result
|
282
|
-
nil
|
283
|
-
end
|
284
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#-------------------------------------------------------------------------
|
4
|
+
# # Copyright (c) Microsoft and contributors. All rights reserved.
|
5
|
+
#
|
6
|
+
# The MIT License(MIT)
|
7
|
+
|
8
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
9
|
+
# of this software and associated documentation files(the "Software"), to deal
|
10
|
+
# in the Software without restriction, including without limitation the rights
|
11
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
|
12
|
+
# copies of the Software, and to permit persons to whom the Software is
|
13
|
+
# furnished to do so, subject to the following conditions :
|
14
|
+
|
15
|
+
# The above copyright notice and this permission notice shall be included in
|
16
|
+
# all copies or substantial portions of the Software.
|
17
|
+
|
18
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
|
21
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24
|
+
# THE SOFTWARE.
|
25
|
+
#--------------------------------------------------------------------------
|
26
|
+
require "azure/storage/file/serialization"
|
27
|
+
|
28
|
+
module Azure::Storage::File
|
29
|
+
StorageService = Azure::Storage::Common::Service::StorageService
|
30
|
+
module Directory
|
31
|
+
include Azure::Storage::Common::Service
|
32
|
+
|
33
|
+
class Directory
|
34
|
+
def initialize
|
35
|
+
@properties = {}
|
36
|
+
@metadata = {}
|
37
|
+
yield self if block_given?
|
38
|
+
end
|
39
|
+
|
40
|
+
attr_accessor :name
|
41
|
+
attr_accessor :properties
|
42
|
+
attr_accessor :metadata
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# Public: Get a list of files or directories under the specified share or directory.
|
47
|
+
# It lists the contents only for a single level of the directory hierarchy.
|
48
|
+
#
|
49
|
+
# ==== Attributes
|
50
|
+
#
|
51
|
+
# * +share+ - String. The name of the file share.
|
52
|
+
# * +directory_path+ - String. The path to the directory.
|
53
|
+
# * +options+ - Hash. Optional parameters.
|
54
|
+
#
|
55
|
+
# ==== Options
|
56
|
+
#
|
57
|
+
# Accepted key/value pairs in options parameter are:
|
58
|
+
#
|
59
|
+
# * +:prefix+ - String. Filters the results to return only directories and files
|
60
|
+
# whose name begins with the specified prefix. (optional)
|
61
|
+
# * +:marker+ - String. An identifier the specifies the portion of the
|
62
|
+
# list to be returned. This value comes from the property
|
63
|
+
# Azure::Storage::Common::EnumerationResults.continuation_token when there
|
64
|
+
# are more shares available than were returned. The
|
65
|
+
# marker value may then be used here to request the next set
|
66
|
+
# of list items. (optional)
|
67
|
+
#
|
68
|
+
# * +:max_results+ - Integer. Specifies the maximum number of shares to return.
|
69
|
+
# If max_results is not specified, or is a value greater than
|
70
|
+
# 5,000, the server will return up to 5,000 items. If it is set
|
71
|
+
# to a value less than or equal to zero, the server will return
|
72
|
+
# status code 400 (Bad Request). (optional)
|
73
|
+
#
|
74
|
+
# * +:timeout+ - Integer. A timeout in seconds.
|
75
|
+
#
|
76
|
+
# * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
|
77
|
+
# in the analytics logs when storage analytics logging is enabled.
|
78
|
+
#
|
79
|
+
# * +:location_mode+ - LocationMode. Specifies the location mode used to decide
|
80
|
+
# which location the request should be sent to.
|
81
|
+
#
|
82
|
+
# See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/list-directories-and-files
|
83
|
+
#
|
84
|
+
# Returns an Azure::Storage::Common::EnumerationResults
|
85
|
+
#
|
86
|
+
def list_directories_and_files(share, directory_path, options = {})
|
87
|
+
query = { "comp" => "list" }
|
88
|
+
unless options.nil?
|
89
|
+
StorageService.with_query query, "marker", options[:marker]
|
90
|
+
StorageService.with_query query, "maxresults", options[:max_results].to_s if options[:max_results]
|
91
|
+
StorageService.with_query query, "timeout", options[:timeout].to_s if options[:timeout]
|
92
|
+
StorageService.with_query query, "prefix", options[:prefix].to_s if options[:prefix]
|
93
|
+
end
|
94
|
+
|
95
|
+
options[:request_location_mode] = Azure::Storage::Common::RequestLocationMode::PRIMARY_OR_SECONDARY
|
96
|
+
uri = directory_uri(share, directory_path, query, options)
|
97
|
+
response = call(:get, uri, nil, {}, options)
|
98
|
+
|
99
|
+
# Result
|
100
|
+
if response.success?
|
101
|
+
Serialization.directories_and_files_enumeration_results_from_xml(response.body)
|
102
|
+
else
|
103
|
+
response.exception
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
# Public: Create a new directory
|
108
|
+
#
|
109
|
+
# ==== Attributes
|
110
|
+
#
|
111
|
+
# * +share+ - String. The name of the file share.
|
112
|
+
# * +directory_path+ - String. The path to the directory.
|
113
|
+
# * +options+ - Hash. Optional parameters.
|
114
|
+
#
|
115
|
+
# ==== Options
|
116
|
+
#
|
117
|
+
# Accepted key/value pairs in options parameter are:
|
118
|
+
# * +:metadata+ - Hash. User defined metadata for the share (optional).
|
119
|
+
# * +:timeout+ - Integer. A timeout in seconds.
|
120
|
+
# * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
|
121
|
+
# in the analytics logs when storage analytics logging is enabled.
|
122
|
+
#
|
123
|
+
# See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/create-directory
|
124
|
+
#
|
125
|
+
# Returns a Directory
|
126
|
+
def create_directory(share, directory_path, options = {})
|
127
|
+
# Query
|
128
|
+
query = {}
|
129
|
+
query["timeout"] = options[:timeout].to_s if options[:timeout]
|
130
|
+
|
131
|
+
# Scheme + path
|
132
|
+
uri = directory_uri(share, directory_path, query)
|
133
|
+
|
134
|
+
# Headers
|
135
|
+
headers = {}
|
136
|
+
StorageService.add_metadata_to_headers(options[:metadata], headers) if options[:metadata]
|
137
|
+
|
138
|
+
# Call
|
139
|
+
response = call(:put, uri, nil, headers, options)
|
140
|
+
|
141
|
+
# result
|
142
|
+
directory = Serialization.directory_from_headers(response.headers)
|
143
|
+
directory.name = directory_path
|
144
|
+
directory.metadata = options[:metadata] if options[:metadata]
|
145
|
+
directory
|
146
|
+
end
|
147
|
+
|
148
|
+
# Public: Returns all system properties for the specified directory,
|
149
|
+
# and can also be used to check the existence of a directory.
|
150
|
+
# The data returned does not include the files in the directory or any subdirectories.
|
151
|
+
#
|
152
|
+
# ==== Attributes
|
153
|
+
#
|
154
|
+
# * +share+ - String. The name of the file share.
|
155
|
+
# * +directory_path+ - String. The path to the directory.
|
156
|
+
# * +options+ - Hash. Optional parameters.
|
157
|
+
#
|
158
|
+
# ==== Options
|
159
|
+
#
|
160
|
+
# Accepted key/value pairs in options parameter are:
|
161
|
+
# * +:timeout+ - Integer. A timeout in seconds.
|
162
|
+
# * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
|
163
|
+
# in the analytics logs when storage analytics logging is enabled.
|
164
|
+
# * +:location_mode+ - LocationMode. Specifies the location mode used to decide
|
165
|
+
# which location the request should be sent to.
|
166
|
+
#
|
167
|
+
# See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-directory-properties
|
168
|
+
#
|
169
|
+
# Returns a Directory
|
170
|
+
def get_directory_properties(share, directory_path, options = {})
|
171
|
+
# Query
|
172
|
+
query = {}
|
173
|
+
query["timeout"] = options[:timeout].to_s if options[:timeout]
|
174
|
+
|
175
|
+
# Call
|
176
|
+
options[:request_location_mode] = Azure::Storage::Common::RequestLocationMode::PRIMARY_OR_SECONDARY
|
177
|
+
response = call(:get, directory_uri(share, directory_path, query, options), nil, {}, options)
|
178
|
+
|
179
|
+
# result
|
180
|
+
directory = Serialization.directory_from_headers(response.headers)
|
181
|
+
directory.name = directory_path
|
182
|
+
directory
|
183
|
+
end
|
184
|
+
|
185
|
+
# Public: Deletes a directory.
|
186
|
+
#
|
187
|
+
# ==== Attributes
|
188
|
+
#
|
189
|
+
# * +share+ - String. The name of the file share.
|
190
|
+
# * +directory_path+ - String. The path to the directory.
|
191
|
+
# * +options+ - Hash. Optional parameters.
|
192
|
+
#
|
193
|
+
# ==== Options
|
194
|
+
#
|
195
|
+
# Accepted key/value pairs in options parameter are:
|
196
|
+
# * +:timeout+ - Integer. A timeout in seconds.
|
197
|
+
# * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
|
198
|
+
# in the analytics logs when storage analytics logging is enabled.
|
199
|
+
#
|
200
|
+
# See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/delete-directory
|
201
|
+
#
|
202
|
+
# Returns nil on success
|
203
|
+
def delete_directory(share, directory_path, options = {})
|
204
|
+
# Query
|
205
|
+
query = {}
|
206
|
+
query["timeout"] = options[:timeout].to_s if options[:timeout]
|
207
|
+
|
208
|
+
# Call
|
209
|
+
call(:delete, directory_uri(share, directory_path, query), nil, {}, options)
|
210
|
+
|
211
|
+
# result
|
212
|
+
nil
|
213
|
+
end
|
214
|
+
|
215
|
+
# Public: Returns only user-defined metadata for the specified directory.
|
216
|
+
#
|
217
|
+
# ==== Attributes
|
218
|
+
#
|
219
|
+
# * +share+ - String. The name of the file share.
|
220
|
+
# * +directory_path+ - String. The path to the directory.
|
221
|
+
# * +options+ - Hash. Optional parameters.
|
222
|
+
#
|
223
|
+
# ==== Options
|
224
|
+
#
|
225
|
+
# Accepted key/value pairs in options parameter are:
|
226
|
+
# * +:timeout+ - Integer. A timeout in seconds.
|
227
|
+
# * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
|
228
|
+
# in the analytics logs when storage analytics logging is enabled.
|
229
|
+
# * +:location_mode+ - LocationMode. Specifies the location mode used to decide
|
230
|
+
# which location the request should be sent to.
|
231
|
+
#
|
232
|
+
# See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-directory-metadata
|
233
|
+
#
|
234
|
+
# Returns a Directory
|
235
|
+
def get_directory_metadata(share, directory_path, options = {})
|
236
|
+
# Query
|
237
|
+
query = { "comp" => "metadata" }
|
238
|
+
query["timeout"] = options[:timeout].to_s if options[:timeout]
|
239
|
+
|
240
|
+
# Call
|
241
|
+
options[:request_location_mode] = Azure::Storage::Common::RequestLocationMode::PRIMARY_OR_SECONDARY
|
242
|
+
response = call(:get, directory_uri(share, directory_path, query, options), nil, {}, options)
|
243
|
+
|
244
|
+
# result
|
245
|
+
directory = Serialization.directory_from_headers(response.headers)
|
246
|
+
directory.name = directory_path
|
247
|
+
directory
|
248
|
+
end
|
249
|
+
|
250
|
+
# Public: Sets custom metadata for the directory.
|
251
|
+
#
|
252
|
+
# ==== Attributes
|
253
|
+
#
|
254
|
+
# * +share+ - String. The name of the file share.
|
255
|
+
# * +directory_path+ - String. The path to the directory.
|
256
|
+
# * +metadata+ - Hash. A Hash of the metadata values.
|
257
|
+
# * +options+ - Hash. Optional parameters.
|
258
|
+
#
|
259
|
+
# ==== Options
|
260
|
+
#
|
261
|
+
# Accepted key/value pairs in options parameter are:
|
262
|
+
# * +:timeout+ - Integer. A timeout in seconds.
|
263
|
+
# * +:request_id+ - String. Provides a client-generated, opaque value with a 1 KB character limit that is recorded
|
264
|
+
# in the analytics logs when storage analytics logging is enabled.
|
265
|
+
#
|
266
|
+
# See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/set-directory-metadata
|
267
|
+
#
|
268
|
+
# Returns nil on success
|
269
|
+
def set_directory_metadata(share, directory_path, metadata, options = {})
|
270
|
+
# Query
|
271
|
+
query = { "comp" => "metadata" }
|
272
|
+
query["timeout"] = options[:timeout].to_s if options[:timeout]
|
273
|
+
|
274
|
+
# Headers
|
275
|
+
headers = {}
|
276
|
+
StorageService.add_metadata_to_headers(metadata, headers) if metadata
|
277
|
+
|
278
|
+
# Call
|
279
|
+
call(:put, directory_uri(share, directory_path, query), nil, headers, options)
|
280
|
+
|
281
|
+
# Result
|
282
|
+
nil
|
283
|
+
end
|
284
|
+
end
|