azure_mgmt_datalake_store 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/LICENSE.txt +21 -0
  4. data/Rakefile +5 -0
  5. data/azure_mgmt_datalake_store.gemspec +34 -0
  6. data/lib/azure_mgmt_datalake_store.rb +3 -0
  7. data/lib/generated/azure_mgmt_datalake_store_account.rb +41 -0
  8. data/lib/generated/azure_mgmt_datalake_store_account/account.rb +1739 -0
  9. data/lib/generated/azure_mgmt_datalake_store_account/data_lake_store_account_management_client.rb +68 -0
  10. data/lib/generated/azure_mgmt_datalake_store_account/models/azure_async_operation_result.rb +66 -0
  11. data/lib/generated/azure_mgmt_datalake_store_account/models/data_lake_store_account.rb +105 -0
  12. data/lib/generated/azure_mgmt_datalake_store_account/models/data_lake_store_account_list_result.rb +107 -0
  13. data/lib/generated/azure_mgmt_datalake_store_account/models/data_lake_store_account_properties.rb +106 -0
  14. data/lib/generated/azure_mgmt_datalake_store_account/models/data_lake_store_account_state.rb +16 -0
  15. data/lib/generated/azure_mgmt_datalake_store_account/models/data_lake_store_account_status.rb +23 -0
  16. data/lib/generated/azure_mgmt_datalake_store_account/models/data_lake_store_firewall_rule_list_result.rb +107 -0
  17. data/lib/generated/azure_mgmt_datalake_store_account/models/error.rb +99 -0
  18. data/lib/generated/azure_mgmt_datalake_store_account/models/error_details.rb +69 -0
  19. data/lib/generated/azure_mgmt_datalake_store_account/models/firewall_rule.rb +86 -0
  20. data/lib/generated/azure_mgmt_datalake_store_account/models/firewall_rule_properties.rb +54 -0
  21. data/lib/generated/azure_mgmt_datalake_store_account/models/inner_error.rb +56 -0
  22. data/lib/generated/azure_mgmt_datalake_store_account/models/operation_status.rb +17 -0
  23. data/lib/generated/azure_mgmt_datalake_store_account/module_definition.rb +9 -0
  24. data/lib/generated/azure_mgmt_datalake_store_account/version.rb +8 -0
  25. data/lib/generated/azure_mgmt_datalake_store_filesystem.rb +50 -0
  26. data/lib/generated/azure_mgmt_datalake_store_filesystem/data_lake_store_file_system_management_client.rb +67 -0
  27. data/lib/generated/azure_mgmt_datalake_store_filesystem/file_system.rb +2149 -0
  28. data/lib/generated/azure_mgmt_datalake_store_filesystem/models/acl_status.rb +82 -0
  29. data/lib/generated/azure_mgmt_datalake_store_filesystem/models/acl_status_result.rb +45 -0
  30. data/lib/generated/azure_mgmt_datalake_store_filesystem/models/adls_access_control_exception.rb +66 -0
  31. data/lib/generated/azure_mgmt_datalake_store_filesystem/models/adls_bad_offset_exception.rb +66 -0
  32. data/lib/generated/azure_mgmt_datalake_store_filesystem/models/adls_error.rb +49 -0
  33. data/lib/generated/azure_mgmt_datalake_store_filesystem/models/adls_file_already_exists_exception.rb +65 -0
  34. data/lib/generated/azure_mgmt_datalake_store_filesystem/models/adls_file_not_found_exception.rb +65 -0
  35. data/lib/generated/azure_mgmt_datalake_store_filesystem/models/adls_illegal_argument_exception.rb +66 -0
  36. data/lib/generated/azure_mgmt_datalake_store_filesystem/models/adls_ioexception.rb +65 -0
  37. data/lib/generated/azure_mgmt_datalake_store_filesystem/models/adls_remote_exception.rb +89 -0
  38. data/lib/generated/azure_mgmt_datalake_store_filesystem/models/adls_runtime_exception.rb +66 -0
  39. data/lib/generated/azure_mgmt_datalake_store_filesystem/models/adls_security_exception.rb +65 -0
  40. data/lib/generated/azure_mgmt_datalake_store_filesystem/models/adls_unsupported_operation_exception.rb +66 -0
  41. data/lib/generated/azure_mgmt_datalake_store_filesystem/models/append_mode_type.rb +15 -0
  42. data/lib/generated/azure_mgmt_datalake_store_filesystem/models/content_summary.rb +78 -0
  43. data/lib/generated/azure_mgmt_datalake_store_filesystem/models/content_summary_result.rb +46 -0
  44. data/lib/generated/azure_mgmt_datalake_store_filesystem/models/file_operation_result.rb +45 -0
  45. data/lib/generated/azure_mgmt_datalake_store_filesystem/models/file_status_properties.rb +146 -0
  46. data/lib/generated/azure_mgmt_datalake_store_filesystem/models/file_status_result.rb +47 -0
  47. data/lib/generated/azure_mgmt_datalake_store_filesystem/models/file_statuses.rb +54 -0
  48. data/lib/generated/azure_mgmt_datalake_store_filesystem/models/file_statuses_result.rb +47 -0
  49. data/lib/generated/azure_mgmt_datalake_store_filesystem/models/file_type.rb +16 -0
  50. data/lib/generated/azure_mgmt_datalake_store_filesystem/module_definition.rb +9 -0
  51. metadata +163 -0
@@ -0,0 +1,56 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::DataLakeStore::Account
7
+ module Models
8
+ #
9
+ # Data Lake Store inner error information
10
+ #
11
+ class InnerError
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [String] the stack trace for the error
16
+ attr_accessor :trace
17
+
18
+ # @return [String] the context for the error message
19
+ attr_accessor :context
20
+
21
+
22
+ #
23
+ # Mapper for InnerError class as Ruby Hash.
24
+ # This will be used for serialization/deserialization.
25
+ #
26
+ def self.mapper()
27
+ {
28
+ required: false,
29
+ serialized_name: 'InnerError',
30
+ type: {
31
+ name: 'Composite',
32
+ class_name: 'InnerError',
33
+ model_properties: {
34
+ trace: {
35
+ required: false,
36
+ read_only: true,
37
+ serialized_name: 'trace',
38
+ type: {
39
+ name: 'String'
40
+ }
41
+ },
42
+ context: {
43
+ required: false,
44
+ read_only: true,
45
+ serialized_name: 'context',
46
+ type: {
47
+ name: 'String'
48
+ }
49
+ }
50
+ }
51
+ }
52
+ }
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,17 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::DataLakeStore::Account
7
+ module Models
8
+ #
9
+ # Defines values for OperationStatus
10
+ #
11
+ module OperationStatus
12
+ InProgress = "InProgress"
13
+ Succeeded = "Succeeded"
14
+ Failed = "Failed"
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,9 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure end
7
+ module Azure::ARM end
8
+ module Azure::ARM::DataLakeStore end
9
+ module Azure::ARM::DataLakeStore::Account end
@@ -0,0 +1,8 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::DataLakeStore::Account
7
+ VERSION = '0.4.0'
8
+ end
@@ -0,0 +1,50 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ require 'uri'
7
+ require 'cgi'
8
+ require 'date'
9
+ require 'json'
10
+ require 'base64'
11
+ require 'erb'
12
+ require 'securerandom'
13
+ require 'time'
14
+ require 'timeliness'
15
+ require 'faraday'
16
+ require 'faraday-cookie_jar'
17
+ require 'concurrent'
18
+ require 'ms_rest'
19
+ require 'generated/azure_mgmt_datalake_store_filesystem/module_definition'
20
+ require 'ms_rest_azure'
21
+
22
+ module Azure::ARM::DataLakeStore::FileSystem
23
+ autoload :FileSystem, 'generated/azure_mgmt_datalake_store_filesystem/file_system.rb'
24
+ autoload :DataLakeStoreFileSystemManagementClient, 'generated/azure_mgmt_datalake_store_filesystem/data_lake_store_file_system_management_client.rb'
25
+
26
+ module Models
27
+ autoload :FileOperationResult, 'generated/azure_mgmt_datalake_store_filesystem/models/file_operation_result.rb'
28
+ autoload :AclStatus, 'generated/azure_mgmt_datalake_store_filesystem/models/acl_status.rb'
29
+ autoload :AclStatusResult, 'generated/azure_mgmt_datalake_store_filesystem/models/acl_status_result.rb'
30
+ autoload :ContentSummary, 'generated/azure_mgmt_datalake_store_filesystem/models/content_summary.rb'
31
+ autoload :ContentSummaryResult, 'generated/azure_mgmt_datalake_store_filesystem/models/content_summary_result.rb'
32
+ autoload :FileStatusProperties, 'generated/azure_mgmt_datalake_store_filesystem/models/file_status_properties.rb'
33
+ autoload :FileStatuses, 'generated/azure_mgmt_datalake_store_filesystem/models/file_statuses.rb'
34
+ autoload :FileStatusesResult, 'generated/azure_mgmt_datalake_store_filesystem/models/file_statuses_result.rb'
35
+ autoload :FileStatusResult, 'generated/azure_mgmt_datalake_store_filesystem/models/file_status_result.rb'
36
+ autoload :AdlsRemoteException, 'generated/azure_mgmt_datalake_store_filesystem/models/adls_remote_exception.rb'
37
+ autoload :AdlsError, 'generated/azure_mgmt_datalake_store_filesystem/models/adls_error.rb'
38
+ autoload :AdlsIllegalArgumentException, 'generated/azure_mgmt_datalake_store_filesystem/models/adls_illegal_argument_exception.rb'
39
+ autoload :AdlsUnsupportedOperationException, 'generated/azure_mgmt_datalake_store_filesystem/models/adls_unsupported_operation_exception.rb'
40
+ autoload :AdlsSecurityException, 'generated/azure_mgmt_datalake_store_filesystem/models/adls_security_exception.rb'
41
+ autoload :AdlsIOException, 'generated/azure_mgmt_datalake_store_filesystem/models/adls_ioexception.rb'
42
+ autoload :AdlsFileNotFoundException, 'generated/azure_mgmt_datalake_store_filesystem/models/adls_file_not_found_exception.rb'
43
+ autoload :AdlsFileAlreadyExistsException, 'generated/azure_mgmt_datalake_store_filesystem/models/adls_file_already_exists_exception.rb'
44
+ autoload :AdlsBadOffsetException, 'generated/azure_mgmt_datalake_store_filesystem/models/adls_bad_offset_exception.rb'
45
+ autoload :AdlsRuntimeException, 'generated/azure_mgmt_datalake_store_filesystem/models/adls_runtime_exception.rb'
46
+ autoload :AdlsAccessControlException, 'generated/azure_mgmt_datalake_store_filesystem/models/adls_access_control_exception.rb'
47
+ autoload :FileType, 'generated/azure_mgmt_datalake_store_filesystem/models/file_type.rb'
48
+ autoload :AppendModeType, 'generated/azure_mgmt_datalake_store_filesystem/models/append_mode_type.rb'
49
+ end
50
+ end
@@ -0,0 +1,67 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::DataLakeStore::FileSystem
7
+ #
8
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class DataLakeStoreFileSystemManagementClient < MsRestAzure::AzureServiceClient
11
+ include MsRest::Serialization
12
+ include MsRestAzure
13
+
14
+ # @return [String] the base URI of the service.
15
+ attr_reader :base_url
16
+
17
+ # @return Credentials needed for the client to connect to Azure.
18
+ attr_reader :credentials
19
+
20
+ # @return [String] Client Api Version.
21
+ attr_reader :api_version
22
+
23
+ # @return [String] Gets the URI used as the base for all cloud service
24
+ # requests.
25
+ attr_accessor :adls_file_system_dns_suffix
26
+
27
+ # @return [String] Gets or sets the preferred language for the response.
28
+ attr_accessor :accept_language
29
+
30
+ # @return [Integer] Gets or sets the retry timeout in seconds for Long
31
+ # Running Operations. Default value is 30.
32
+ attr_accessor :long_running_operation_retry_timeout
33
+
34
+ # @return [Boolean] When set to true a unique x-ms-client-request-id value
35
+ # is generated and included in each request. Default is true.
36
+ attr_accessor :generate_client_request_id
37
+
38
+ # @return Subscription credentials which uniquely identify client
39
+ # subscription.
40
+ attr_accessor :credentials
41
+
42
+ # @return [FileSystem] file_system
43
+ attr_reader :file_system
44
+
45
+ #
46
+ # Creates initializes a new instance of the DataLakeStoreFileSystemManagementClient class.
47
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
48
+ # @param options [Array] filters to be applied to the HTTP requests.
49
+ #
50
+ def initialize(credentials, options = nil)
51
+ super(credentials, options)
52
+ @base_url = 'https://{accountName}.{adlsFileSystemDnsSuffix}'
53
+
54
+ fail ArgumentError, 'credentials is nil' if credentials.nil?
55
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials)
56
+ @credentials = credentials
57
+
58
+ @file_system = FileSystem.new(self)
59
+ @api_version = '2015-10-01-preview'
60
+ @adls_file_system_dns_suffix = 'azuredatalakestore.net'
61
+ @accept_language = 'en-US'
62
+ @long_running_operation_retry_timeout = 30
63
+ @generate_client_request_id = true
64
+ end
65
+
66
+ end
67
+ end
@@ -0,0 +1,2149 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::DataLakeStore::FileSystem
7
+ #
8
+ # Creates an Azure Data Lake Store filesystem client.
9
+ #
10
+ class FileSystem
11
+ include Azure::ARM::DataLakeStore::FileSystem::Models
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the FileSystem class.
16
+ # @param client service class for accessing basic functionality.
17
+ #
18
+ def initialize(client)
19
+ @client = client
20
+ end
21
+
22
+ # @return reference to the DataLakeStoreFileSystemManagementClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # Appends to the specified file. This method supports multiple concurrent
27
+ # appends to the file. NOTE: Concurrent append and normal (serial) append
28
+ # CANNOT be used interchangeably. Once a file has been appended to using
29
+ # either append option, it can only be appended to using that append option.
30
+ #
31
+ # @param account_name [String] The Azure Data Lake Store account to execute
32
+ # filesystem operations on.
33
+ # @param file_path [String] The Data Lake Store path (starting with '/') of
34
+ # the file to which to append using concurrent append.
35
+ # @param stream_contents The file contents to include when appending to the
36
+ # file.
37
+ # @param append_mode [AppendModeType] Indicates the concurrent append call
38
+ # should create the file if it doesn't exist or just open the existing file
39
+ # for append. Possible values include: 'autocreate'
40
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
41
+ # will be added to the HTTP request.
42
+ #
43
+ #
44
+ def concurrent_append(account_name, file_path, stream_contents, append_mode = nil, custom_headers = nil)
45
+ response = concurrent_append_async(account_name, file_path, stream_contents, append_mode, custom_headers).value!
46
+ nil
47
+ end
48
+
49
+ #
50
+ # Appends to the specified file. This method supports multiple concurrent
51
+ # appends to the file. NOTE: Concurrent append and normal (serial) append
52
+ # CANNOT be used interchangeably. Once a file has been appended to using
53
+ # either append option, it can only be appended to using that append option.
54
+ #
55
+ # @param account_name [String] The Azure Data Lake Store account to execute
56
+ # filesystem operations on.
57
+ # @param file_path [String] The Data Lake Store path (starting with '/') of
58
+ # the file to which to append using concurrent append.
59
+ # @param stream_contents The file contents to include when appending to the
60
+ # file.
61
+ # @param append_mode [AppendModeType] Indicates the concurrent append call
62
+ # should create the file if it doesn't exist or just open the existing file
63
+ # for append. Possible values include: 'autocreate'
64
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
65
+ # will be added to the HTTP request.
66
+ #
67
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
68
+ #
69
+ def concurrent_append_with_http_info(account_name, file_path, stream_contents, append_mode = nil, custom_headers = nil)
70
+ concurrent_append_async(account_name, file_path, stream_contents, append_mode, custom_headers).value!
71
+ end
72
+
73
+ #
74
+ # Appends to the specified file. This method supports multiple concurrent
75
+ # appends to the file. NOTE: Concurrent append and normal (serial) append
76
+ # CANNOT be used interchangeably. Once a file has been appended to using
77
+ # either append option, it can only be appended to using that append option.
78
+ #
79
+ # @param account_name [String] The Azure Data Lake Store account to execute
80
+ # filesystem operations on.
81
+ # @param file_path [String] The Data Lake Store path (starting with '/') of
82
+ # the file to which to append using concurrent append.
83
+ # @param stream_contents The file contents to include when appending to the
84
+ # file.
85
+ # @param append_mode [AppendModeType] Indicates the concurrent append call
86
+ # should create the file if it doesn't exist or just open the existing file
87
+ # for append. Possible values include: 'autocreate'
88
+ # @param [Hash{String => String}] A hash of custom headers that will be added
89
+ # to the HTTP request.
90
+ #
91
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
92
+ #
93
+ def concurrent_append_async(account_name, file_path, stream_contents, append_mode = nil, custom_headers = nil)
94
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
95
+ fail ArgumentError, '@client.adls_file_system_dns_suffix is nil' if @client.adls_file_system_dns_suffix.nil?
96
+ fail ArgumentError, 'file_path is nil' if file_path.nil?
97
+ fail ArgumentError, 'stream_contents is nil' if stream_contents.nil?
98
+ op = 'CONCURRENTAPPEND'
99
+ transfer_encoding = 'chunked'
100
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
101
+
102
+
103
+ request_headers = {}
104
+
105
+ # Set Headers
106
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
107
+ request_headers['Transfer-Encoding'] = transfer_encoding unless transfer_encoding.nil?
108
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
109
+
110
+ request_headers['Content-Type'] = 'application/octet-stream'
111
+
112
+ # Serialize Request
113
+ request_mapper = {
114
+ required: true,
115
+ serialized_name: 'streamContents',
116
+ type: {
117
+ name: 'Stream'
118
+ }
119
+ }
120
+ request_content = @client.serialize(request_mapper, stream_contents, 'stream_contents')
121
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
122
+
123
+ path_template = '/WebHdfsExt/{filePath}'
124
+ options = {
125
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
126
+ path_params: {'filePath' => file_path},
127
+ query_params: {'appendMode' => append_mode,'op' => op,'api-version' => @client.api_version},
128
+ body: request_content,
129
+ headers: request_headers.merge(custom_headers || {})
130
+ }
131
+
132
+ request_url = @base_url || @client.base_url
133
+ request_url = request_url.gsub('{accountName}', account_name)
134
+ request_url = request_url.gsub('{adlsFileSystemDnsSuffix}', @client.adls_file_system_dns_suffix)
135
+
136
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
137
+ promise = request.run_promise do |req|
138
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
139
+ end
140
+
141
+ promise = promise.then do |http_response|
142
+ status_code = http_response.status
143
+ response_content = http_response.body
144
+ unless status_code == 200
145
+ error_model = JSON.load(response_content)
146
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
147
+ end
148
+
149
+ # Create Result
150
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
151
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
152
+
153
+ result
154
+ end
155
+
156
+ promise.execute
157
+ end
158
+
159
+ #
160
+ # Checks if the specified access is available at the given path.
161
+ #
162
+ # @param account_name [String] The Azure Data Lake Store account to execute
163
+ # filesystem operations on.
164
+ # @param path [String] The Data Lake Store path (starting with '/') of the
165
+ # file or directory for which to check access.
166
+ # @param fsaction [String] File system operation read/write/execute in string
167
+ # form, matching regex pattern '[rwx-]{3}'
168
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
169
+ # will be added to the HTTP request.
170
+ #
171
+ #
172
+ def check_access(account_name, path, fsaction = nil, custom_headers = nil)
173
+ response = check_access_async(account_name, path, fsaction, custom_headers).value!
174
+ nil
175
+ end
176
+
177
+ #
178
+ # Checks if the specified access is available at the given path.
179
+ #
180
+ # @param account_name [String] The Azure Data Lake Store account to execute
181
+ # filesystem operations on.
182
+ # @param path [String] The Data Lake Store path (starting with '/') of the
183
+ # file or directory for which to check access.
184
+ # @param fsaction [String] File system operation read/write/execute in string
185
+ # form, matching regex pattern '[rwx-]{3}'
186
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
187
+ # will be added to the HTTP request.
188
+ #
189
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
190
+ #
191
+ def check_access_with_http_info(account_name, path, fsaction = nil, custom_headers = nil)
192
+ check_access_async(account_name, path, fsaction, custom_headers).value!
193
+ end
194
+
195
+ #
196
+ # Checks if the specified access is available at the given path.
197
+ #
198
+ # @param account_name [String] The Azure Data Lake Store account to execute
199
+ # filesystem operations on.
200
+ # @param path [String] The Data Lake Store path (starting with '/') of the
201
+ # file or directory for which to check access.
202
+ # @param fsaction [String] File system operation read/write/execute in string
203
+ # form, matching regex pattern '[rwx-]{3}'
204
+ # @param [Hash{String => String}] A hash of custom headers that will be added
205
+ # to the HTTP request.
206
+ #
207
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
208
+ #
209
+ def check_access_async(account_name, path, fsaction = nil, custom_headers = nil)
210
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
211
+ fail ArgumentError, '@client.adls_file_system_dns_suffix is nil' if @client.adls_file_system_dns_suffix.nil?
212
+ fail ArgumentError, 'path is nil' if path.nil?
213
+ op = 'CHECKACCESS'
214
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
215
+
216
+
217
+ request_headers = {}
218
+
219
+ # Set Headers
220
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
221
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
222
+ path_template = '/webhdfs/v1/{path}'
223
+ options = {
224
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
225
+ path_params: {'path' => path},
226
+ query_params: {'fsaction' => fsaction,'op' => op,'api-version' => @client.api_version},
227
+ headers: request_headers.merge(custom_headers || {})
228
+ }
229
+
230
+ request_url = @base_url || @client.base_url
231
+ request_url = request_url.gsub('{accountName}', account_name)
232
+ request_url = request_url.gsub('{adlsFileSystemDnsSuffix}', @client.adls_file_system_dns_suffix)
233
+
234
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
235
+ promise = request.run_promise do |req|
236
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
237
+ end
238
+
239
+ promise = promise.then do |http_response|
240
+ status_code = http_response.status
241
+ response_content = http_response.body
242
+ unless status_code == 200
243
+ error_model = JSON.load(response_content)
244
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
245
+ end
246
+
247
+ # Create Result
248
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
249
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
250
+
251
+ result
252
+ end
253
+
254
+ promise.execute
255
+ end
256
+
257
+ #
258
+ # Creates a directory.
259
+ #
260
+ # @param account_name [String] The Azure Data Lake Store account to execute
261
+ # filesystem operations on.
262
+ # @param path [String] The Data Lake Store path (starting with '/') of the
263
+ # directory to create.
264
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
265
+ # will be added to the HTTP request.
266
+ #
267
+ # @return [FileOperationResult] operation results.
268
+ #
269
+ def mkdirs(account_name, path, custom_headers = nil)
270
+ response = mkdirs_async(account_name, path, custom_headers).value!
271
+ response.body unless response.nil?
272
+ end
273
+
274
+ #
275
+ # Creates a directory.
276
+ #
277
+ # @param account_name [String] The Azure Data Lake Store account to execute
278
+ # filesystem operations on.
279
+ # @param path [String] The Data Lake Store path (starting with '/') of the
280
+ # directory to create.
281
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
282
+ # will be added to the HTTP request.
283
+ #
284
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
285
+ #
286
+ def mkdirs_with_http_info(account_name, path, custom_headers = nil)
287
+ mkdirs_async(account_name, path, custom_headers).value!
288
+ end
289
+
290
+ #
291
+ # Creates a directory.
292
+ #
293
+ # @param account_name [String] The Azure Data Lake Store account to execute
294
+ # filesystem operations on.
295
+ # @param path [String] The Data Lake Store path (starting with '/') of the
296
+ # directory to create.
297
+ # @param [Hash{String => String}] A hash of custom headers that will be added
298
+ # to the HTTP request.
299
+ #
300
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
301
+ #
302
+ def mkdirs_async(account_name, path, custom_headers = nil)
303
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
304
+ fail ArgumentError, '@client.adls_file_system_dns_suffix is nil' if @client.adls_file_system_dns_suffix.nil?
305
+ fail ArgumentError, 'path is nil' if path.nil?
306
+ op = 'MKDIRS'
307
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
308
+
309
+
310
+ request_headers = {}
311
+
312
+ # Set Headers
313
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
314
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
315
+ path_template = '/webhdfs/v1/{path}'
316
+ options = {
317
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
318
+ path_params: {'path' => path},
319
+ query_params: {'op' => op,'api-version' => @client.api_version},
320
+ headers: request_headers.merge(custom_headers || {})
321
+ }
322
+
323
+ request_url = @base_url || @client.base_url
324
+ request_url = request_url.gsub('{accountName}', account_name)
325
+ request_url = request_url.gsub('{adlsFileSystemDnsSuffix}', @client.adls_file_system_dns_suffix)
326
+
327
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :put, options)
328
+ promise = request.run_promise do |req|
329
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
330
+ end
331
+
332
+ promise = promise.then do |http_response|
333
+ status_code = http_response.status
334
+ response_content = http_response.body
335
+ unless status_code == 200
336
+ error_model = JSON.load(response_content)
337
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
338
+ end
339
+
340
+ # Create Result
341
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
342
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
343
+ # Deserialize Response
344
+ if status_code == 200
345
+ begin
346
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
347
+ result_mapper = FileOperationResult.mapper()
348
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
349
+ rescue Exception => e
350
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
351
+ end
352
+ end
353
+
354
+ result
355
+ end
356
+
357
+ promise.execute
358
+ end
359
+
360
+ #
361
+ # Concatenates the list of source files into the destination file, removing
362
+ # all source files upon success.
363
+ #
364
+ # @param account_name [String] The Azure Data Lake Store account to execute
365
+ # filesystem operations on.
366
+ # @param destination_path [String] The Data Lake Store path (starting with
367
+ # '/') of the destination file resulting from the concatenation.
368
+ # @param sources [Array<String>] A list of comma seperated Data Lake Store
369
+ # paths (starting with '/') of the files to concatenate, in the order in
370
+ # which they should be concatenated.
371
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
372
+ # will be added to the HTTP request.
373
+ #
374
+ #
375
+ def concat(account_name, destination_path, sources, custom_headers = nil)
376
+ response = concat_async(account_name, destination_path, sources, custom_headers).value!
377
+ nil
378
+ end
379
+
380
+ #
381
+ # Concatenates the list of source files into the destination file, removing
382
+ # all source files upon success.
383
+ #
384
+ # @param account_name [String] The Azure Data Lake Store account to execute
385
+ # filesystem operations on.
386
+ # @param destination_path [String] The Data Lake Store path (starting with
387
+ # '/') of the destination file resulting from the concatenation.
388
+ # @param sources [Array<String>] A list of comma seperated Data Lake Store
389
+ # paths (starting with '/') of the files to concatenate, in the order in
390
+ # which they should be concatenated.
391
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
392
+ # will be added to the HTTP request.
393
+ #
394
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
395
+ #
396
+ def concat_with_http_info(account_name, destination_path, sources, custom_headers = nil)
397
+ concat_async(account_name, destination_path, sources, custom_headers).value!
398
+ end
399
+
400
+ #
401
+ # Concatenates the list of source files into the destination file, removing
402
+ # all source files upon success.
403
+ #
404
+ # @param account_name [String] The Azure Data Lake Store account to execute
405
+ # filesystem operations on.
406
+ # @param destination_path [String] The Data Lake Store path (starting with
407
+ # '/') of the destination file resulting from the concatenation.
408
+ # @param sources [Array<String>] A list of comma seperated Data Lake Store
409
+ # paths (starting with '/') of the files to concatenate, in the order in
410
+ # which they should be concatenated.
411
+ # @param [Hash{String => String}] A hash of custom headers that will be added
412
+ # to the HTTP request.
413
+ #
414
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
415
+ #
416
+ def concat_async(account_name, destination_path, sources, custom_headers = nil)
417
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
418
+ fail ArgumentError, '@client.adls_file_system_dns_suffix is nil' if @client.adls_file_system_dns_suffix.nil?
419
+ fail ArgumentError, 'destination_path is nil' if destination_path.nil?
420
+ fail ArgumentError, 'sources is nil' if sources.nil?
421
+ op = 'CONCAT'
422
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
423
+
424
+
425
+ request_headers = {}
426
+
427
+ # Set Headers
428
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
429
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
430
+ path_template = '/webhdfs/v1/{destinationPath}'
431
+ options = {
432
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
433
+ path_params: {'destinationPath' => destination_path},
434
+ query_params: {'sources' => sources.nil? ? nil : sources.join(','),'op' => op,'api-version' => @client.api_version},
435
+ headers: request_headers.merge(custom_headers || {})
436
+ }
437
+
438
+ request_url = @base_url || @client.base_url
439
+ request_url = request_url.gsub('{accountName}', account_name)
440
+ request_url = request_url.gsub('{adlsFileSystemDnsSuffix}', @client.adls_file_system_dns_suffix)
441
+
442
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
443
+ promise = request.run_promise do |req|
444
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
445
+ end
446
+
447
+ promise = promise.then do |http_response|
448
+ status_code = http_response.status
449
+ response_content = http_response.body
450
+ unless status_code == 200
451
+ error_model = JSON.load(response_content)
452
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
453
+ end
454
+
455
+ # Create Result
456
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
457
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
458
+
459
+ result
460
+ end
461
+
462
+ promise.execute
463
+ end
464
+
465
+ #
466
+ # Concatenates the list of source files into the destination file, deleting
467
+ # all source files upon success. This method accepts more source file paths
468
+ # than the Concat method. This method and the parameters it accepts are
469
+ # subject to change for usability in an upcoming version.
470
+ #
471
+ # @param account_name [String] The Azure Data Lake Store account to execute
472
+ # filesystem operations on.
473
+ # @param ms_concat_destination_path [String] The Data Lake Store path
474
+ # (starting with '/') of the destination file resulting from the
475
+ # concatenation.
476
+ # @param stream_contents A list of Data Lake Store paths (starting with '/')
477
+ # of the source files. Must be in the format: sources=<comma separated list>
478
+ # @param delete_source_directory [Boolean] Indicates that as an optimization
479
+ # instead of deleting each individual source stream, delete the source stream
480
+ # folder if all streams are in the same folder instead. This results in a
481
+ # substantial performance improvement when the only streams in the folder are
482
+ # part of the concatenation operation. WARNING: This includes the deletion of
483
+ # any other files that are not source files. Only set this to true when
484
+ # source files are the only files in the source directory.
485
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
486
+ # will be added to the HTTP request.
487
+ #
488
+ #
489
+ def ms_concat(account_name, ms_concat_destination_path, stream_contents, delete_source_directory = nil, custom_headers = nil)
490
+ response = ms_concat_async(account_name, ms_concat_destination_path, stream_contents, delete_source_directory, custom_headers).value!
491
+ nil
492
+ end
493
+
494
+ #
495
+ # Concatenates the list of source files into the destination file, deleting
496
+ # all source files upon success. This method accepts more source file paths
497
+ # than the Concat method. This method and the parameters it accepts are
498
+ # subject to change for usability in an upcoming version.
499
+ #
500
+ # @param account_name [String] The Azure Data Lake Store account to execute
501
+ # filesystem operations on.
502
+ # @param ms_concat_destination_path [String] The Data Lake Store path
503
+ # (starting with '/') of the destination file resulting from the
504
+ # concatenation.
505
+ # @param stream_contents A list of Data Lake Store paths (starting with '/')
506
+ # of the source files. Must be in the format: sources=<comma separated list>
507
+ # @param delete_source_directory [Boolean] Indicates that as an optimization
508
+ # instead of deleting each individual source stream, delete the source stream
509
+ # folder if all streams are in the same folder instead. This results in a
510
+ # substantial performance improvement when the only streams in the folder are
511
+ # part of the concatenation operation. WARNING: This includes the deletion of
512
+ # any other files that are not source files. Only set this to true when
513
+ # source files are the only files in the source directory.
514
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
515
+ # will be added to the HTTP request.
516
+ #
517
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
518
+ #
519
+ def ms_concat_with_http_info(account_name, ms_concat_destination_path, stream_contents, delete_source_directory = nil, custom_headers = nil)
520
+ ms_concat_async(account_name, ms_concat_destination_path, stream_contents, delete_source_directory, custom_headers).value!
521
+ end
522
+
523
+ #
524
+ # Concatenates the list of source files into the destination file, deleting
525
+ # all source files upon success. This method accepts more source file paths
526
+ # than the Concat method. This method and the parameters it accepts are
527
+ # subject to change for usability in an upcoming version.
528
+ #
529
+ # @param account_name [String] The Azure Data Lake Store account to execute
530
+ # filesystem operations on.
531
+ # @param ms_concat_destination_path [String] The Data Lake Store path
532
+ # (starting with '/') of the destination file resulting from the
533
+ # concatenation.
534
+ # @param stream_contents A list of Data Lake Store paths (starting with '/')
535
+ # of the source files. Must be in the format: sources=<comma separated list>
536
+ # @param delete_source_directory [Boolean] Indicates that as an optimization
537
+ # instead of deleting each individual source stream, delete the source stream
538
+ # folder if all streams are in the same folder instead. This results in a
539
+ # substantial performance improvement when the only streams in the folder are
540
+ # part of the concatenation operation. WARNING: This includes the deletion of
541
+ # any other files that are not source files. Only set this to true when
542
+ # source files are the only files in the source directory.
543
+ # @param [Hash{String => String}] A hash of custom headers that will be added
544
+ # to the HTTP request.
545
+ #
546
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
547
+ #
548
+ def ms_concat_async(account_name, ms_concat_destination_path, stream_contents, delete_source_directory = nil, custom_headers = nil)
549
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
550
+ fail ArgumentError, '@client.adls_file_system_dns_suffix is nil' if @client.adls_file_system_dns_suffix.nil?
551
+ fail ArgumentError, 'ms_concat_destination_path is nil' if ms_concat_destination_path.nil?
552
+ fail ArgumentError, 'stream_contents is nil' if stream_contents.nil?
553
+ op = 'MSCONCAT'
554
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
555
+
556
+
557
+ request_headers = {}
558
+
559
+ # Set Headers
560
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
561
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
562
+
563
+ request_headers['Content-Type'] = 'application/octet-stream'
564
+
565
+ # Serialize Request
566
+ request_mapper = {
567
+ required: true,
568
+ serialized_name: 'streamContents',
569
+ type: {
570
+ name: 'Stream'
571
+ }
572
+ }
573
+ request_content = @client.serialize(request_mapper, stream_contents, 'stream_contents')
574
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
575
+
576
+ path_template = '/webhdfs/v1/{msConcatDestinationPath}'
577
+ options = {
578
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
579
+ path_params: {'msConcatDestinationPath' => ms_concat_destination_path},
580
+ query_params: {'deleteSourceDirectory' => delete_source_directory,'op' => op,'api-version' => @client.api_version},
581
+ body: request_content,
582
+ headers: request_headers.merge(custom_headers || {})
583
+ }
584
+
585
+ request_url = @base_url || @client.base_url
586
+ request_url = request_url.gsub('{accountName}', account_name)
587
+ request_url = request_url.gsub('{adlsFileSystemDnsSuffix}', @client.adls_file_system_dns_suffix)
588
+
589
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
590
+ promise = request.run_promise do |req|
591
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
592
+ end
593
+
594
+ promise = promise.then do |http_response|
595
+ status_code = http_response.status
596
+ response_content = http_response.body
597
+ unless status_code == 200
598
+ error_model = JSON.load(response_content)
599
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
600
+ end
601
+
602
+ # Create Result
603
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
604
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
605
+
606
+ result
607
+ end
608
+
609
+ promise.execute
610
+ end
611
+
612
+ #
613
+ # Get the list of file status objects specified by the file path, with
614
+ # optional pagination parameters
615
+ #
616
+ # @param account_name [String] The Azure Data Lake Store account to execute
617
+ # filesystem operations on.
618
+ # @param list_file_path [String] The Data Lake Store path (starting with '/')
619
+ # of the directory to list.
620
+ # @param list_size [Integer] Gets or sets the number of items to return.
621
+ # Optional.
622
+ # @param list_after [String] Gets or sets the item or lexographical index
623
+ # after which to begin returning results. For example, a file list of
624
+ # 'a','b','d' and listAfter='b' will return 'd', and a listAfter='c' will
625
+ # also return 'd'. Optional.
626
+ # @param list_before [String] Gets or sets the item or lexographical index
627
+ # before which to begin returning results. For example, a file list of
628
+ # 'a','b','d' and listBefore='d' will return 'a','b', and a listBefore='c'
629
+ # will also return 'a','b'. Optional.
630
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
631
+ # will be added to the HTTP request.
632
+ #
633
+ # @return [FileStatusesResult] operation results.
634
+ #
635
+ def list_file_status(account_name, list_file_path, list_size = nil, list_after = nil, list_before = nil, custom_headers = nil)
636
+ response = list_file_status_async(account_name, list_file_path, list_size, list_after, list_before, custom_headers).value!
637
+ response.body unless response.nil?
638
+ end
639
+
640
+ #
641
+ # Get the list of file status objects specified by the file path, with
642
+ # optional pagination parameters
643
+ #
644
+ # @param account_name [String] The Azure Data Lake Store account to execute
645
+ # filesystem operations on.
646
+ # @param list_file_path [String] The Data Lake Store path (starting with '/')
647
+ # of the directory to list.
648
+ # @param list_size [Integer] Gets or sets the number of items to return.
649
+ # Optional.
650
+ # @param list_after [String] Gets or sets the item or lexographical index
651
+ # after which to begin returning results. For example, a file list of
652
+ # 'a','b','d' and listAfter='b' will return 'd', and a listAfter='c' will
653
+ # also return 'd'. Optional.
654
+ # @param list_before [String] Gets or sets the item or lexographical index
655
+ # before which to begin returning results. For example, a file list of
656
+ # 'a','b','d' and listBefore='d' will return 'a','b', and a listBefore='c'
657
+ # will also return 'a','b'. Optional.
658
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
659
+ # will be added to the HTTP request.
660
+ #
661
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
662
+ #
663
+ def list_file_status_with_http_info(account_name, list_file_path, list_size = nil, list_after = nil, list_before = nil, custom_headers = nil)
664
+ list_file_status_async(account_name, list_file_path, list_size, list_after, list_before, custom_headers).value!
665
+ end
666
+
667
+ #
668
+ # Get the list of file status objects specified by the file path, with
669
+ # optional pagination parameters
670
+ #
671
+ # @param account_name [String] The Azure Data Lake Store account to execute
672
+ # filesystem operations on.
673
+ # @param list_file_path [String] The Data Lake Store path (starting with '/')
674
+ # of the directory to list.
675
+ # @param list_size [Integer] Gets or sets the number of items to return.
676
+ # Optional.
677
+ # @param list_after [String] Gets or sets the item or lexographical index
678
+ # after which to begin returning results. For example, a file list of
679
+ # 'a','b','d' and listAfter='b' will return 'd', and a listAfter='c' will
680
+ # also return 'd'. Optional.
681
+ # @param list_before [String] Gets or sets the item or lexographical index
682
+ # before which to begin returning results. For example, a file list of
683
+ # 'a','b','d' and listBefore='d' will return 'a','b', and a listBefore='c'
684
+ # will also return 'a','b'. Optional.
685
+ # @param [Hash{String => String}] A hash of custom headers that will be added
686
+ # to the HTTP request.
687
+ #
688
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
689
+ #
690
+ def list_file_status_async(account_name, list_file_path, list_size = nil, list_after = nil, list_before = nil, custom_headers = nil)
691
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
692
+ fail ArgumentError, '@client.adls_file_system_dns_suffix is nil' if @client.adls_file_system_dns_suffix.nil?
693
+ fail ArgumentError, 'list_file_path is nil' if list_file_path.nil?
694
+ op = 'MSLISTSTATUS'
695
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
696
+
697
+
698
+ request_headers = {}
699
+
700
+ # Set Headers
701
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
702
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
703
+ path_template = '/webhdfs/v1/{listFilePath}'
704
+ options = {
705
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
706
+ path_params: {'listFilePath' => list_file_path},
707
+ query_params: {'listSize' => list_size,'listAfter' => list_after,'listBefore' => list_before,'op' => op,'api-version' => @client.api_version},
708
+ headers: request_headers.merge(custom_headers || {})
709
+ }
710
+
711
+ request_url = @base_url || @client.base_url
712
+ request_url = request_url.gsub('{accountName}', account_name)
713
+ request_url = request_url.gsub('{adlsFileSystemDnsSuffix}', @client.adls_file_system_dns_suffix)
714
+
715
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
716
+ promise = request.run_promise do |req|
717
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
718
+ end
719
+
720
+ promise = promise.then do |http_response|
721
+ status_code = http_response.status
722
+ response_content = http_response.body
723
+ unless status_code == 200
724
+ error_model = JSON.load(response_content)
725
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
726
+ end
727
+
728
+ # Create Result
729
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
730
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
731
+ # Deserialize Response
732
+ if status_code == 200
733
+ begin
734
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
735
+ result_mapper = FileStatusesResult.mapper()
736
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
737
+ rescue Exception => e
738
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
739
+ end
740
+ end
741
+
742
+ result
743
+ end
744
+
745
+ promise.execute
746
+ end
747
+
748
+ #
749
+ # Gets the file content summary object specified by the file path.
750
+ #
751
+ # @param account_name [String] The Azure Data Lake Store account to execute
752
+ # filesystem operations on.
753
+ # @param get_content_summary_file_path [String] The Data Lake Store path
754
+ # (starting with '/') of the file for which to retrieve the summary.
755
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
756
+ # will be added to the HTTP request.
757
+ #
758
+ # @return [ContentSummaryResult] operation results.
759
+ #
760
+ def get_content_summary(account_name, get_content_summary_file_path, custom_headers = nil)
761
+ response = get_content_summary_async(account_name, get_content_summary_file_path, custom_headers).value!
762
+ response.body unless response.nil?
763
+ end
764
+
765
+ #
766
+ # Gets the file content summary object specified by the file path.
767
+ #
768
+ # @param account_name [String] The Azure Data Lake Store account to execute
769
+ # filesystem operations on.
770
+ # @param get_content_summary_file_path [String] The Data Lake Store path
771
+ # (starting with '/') of the file for which to retrieve the summary.
772
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
773
+ # will be added to the HTTP request.
774
+ #
775
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
776
+ #
777
+ def get_content_summary_with_http_info(account_name, get_content_summary_file_path, custom_headers = nil)
778
+ get_content_summary_async(account_name, get_content_summary_file_path, custom_headers).value!
779
+ end
780
+
781
+ #
782
+ # Gets the file content summary object specified by the file path.
783
+ #
784
+ # @param account_name [String] The Azure Data Lake Store account to execute
785
+ # filesystem operations on.
786
+ # @param get_content_summary_file_path [String] The Data Lake Store path
787
+ # (starting with '/') of the file for which to retrieve the summary.
788
+ # @param [Hash{String => String}] A hash of custom headers that will be added
789
+ # to the HTTP request.
790
+ #
791
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
792
+ #
793
+ def get_content_summary_async(account_name, get_content_summary_file_path, custom_headers = nil)
794
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
795
+ fail ArgumentError, '@client.adls_file_system_dns_suffix is nil' if @client.adls_file_system_dns_suffix.nil?
796
+ fail ArgumentError, 'get_content_summary_file_path is nil' if get_content_summary_file_path.nil?
797
+ op = 'GETCONTENTSUMMARY'
798
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
799
+
800
+
801
+ request_headers = {}
802
+
803
+ # Set Headers
804
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
805
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
806
+ path_template = '/webhdfs/va/{getContentSummaryFilePath}'
807
+ options = {
808
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
809
+ path_params: {'getContentSummaryFilePath' => get_content_summary_file_path},
810
+ query_params: {'op' => op,'api-version' => @client.api_version},
811
+ headers: request_headers.merge(custom_headers || {})
812
+ }
813
+
814
+ request_url = @base_url || @client.base_url
815
+ request_url = request_url.gsub('{accountName}', account_name)
816
+ request_url = request_url.gsub('{adlsFileSystemDnsSuffix}', @client.adls_file_system_dns_suffix)
817
+
818
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
819
+ promise = request.run_promise do |req|
820
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
821
+ end
822
+
823
+ promise = promise.then do |http_response|
824
+ status_code = http_response.status
825
+ response_content = http_response.body
826
+ unless status_code == 200
827
+ error_model = JSON.load(response_content)
828
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
829
+ end
830
+
831
+ # Create Result
832
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
833
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
834
+ # Deserialize Response
835
+ if status_code == 200
836
+ begin
837
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
838
+ result_mapper = ContentSummaryResult.mapper()
839
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
840
+ rescue Exception => e
841
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
842
+ end
843
+ end
844
+
845
+ result
846
+ end
847
+
848
+ promise.execute
849
+ end
850
+
851
+ #
852
+ # Get the file status object specified by the file path.
853
+ #
854
+ # @param account_name [String] The Azure Data Lake Store account to execute
855
+ # filesystem operations on.
856
+ # @param get_file_path [String] The Data Lake Store path (starting with '/')
857
+ # of the file or directory for which to retrieve the status.
858
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
859
+ # will be added to the HTTP request.
860
+ #
861
+ # @return [FileStatusResult] operation results.
862
+ #
863
+ def get_file_status(account_name, get_file_path, custom_headers = nil)
864
+ response = get_file_status_async(account_name, get_file_path, custom_headers).value!
865
+ response.body unless response.nil?
866
+ end
867
+
868
+ #
869
+ # Get the file status object specified by the file path.
870
+ #
871
+ # @param account_name [String] The Azure Data Lake Store account to execute
872
+ # filesystem operations on.
873
+ # @param get_file_path [String] The Data Lake Store path (starting with '/')
874
+ # of the file or directory for which to retrieve the status.
875
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
876
+ # will be added to the HTTP request.
877
+ #
878
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
879
+ #
880
+ def get_file_status_with_http_info(account_name, get_file_path, custom_headers = nil)
881
+ get_file_status_async(account_name, get_file_path, custom_headers).value!
882
+ end
883
+
884
+ #
885
+ # Get the file status object specified by the file path.
886
+ #
887
+ # @param account_name [String] The Azure Data Lake Store account to execute
888
+ # filesystem operations on.
889
+ # @param get_file_path [String] The Data Lake Store path (starting with '/')
890
+ # of the file or directory for which to retrieve the status.
891
+ # @param [Hash{String => String}] A hash of custom headers that will be added
892
+ # to the HTTP request.
893
+ #
894
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
895
+ #
896
+ def get_file_status_async(account_name, get_file_path, custom_headers = nil)
897
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
898
+ fail ArgumentError, '@client.adls_file_system_dns_suffix is nil' if @client.adls_file_system_dns_suffix.nil?
899
+ fail ArgumentError, 'get_file_path is nil' if get_file_path.nil?
900
+ op = 'GETFILESTATUS'
901
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
902
+
903
+
904
+ request_headers = {}
905
+
906
+ # Set Headers
907
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
908
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
909
+ path_template = '/webhdfs/v1/{getFilePath}'
910
+ options = {
911
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
912
+ path_params: {'getFilePath' => get_file_path},
913
+ query_params: {'op' => op,'api-version' => @client.api_version},
914
+ headers: request_headers.merge(custom_headers || {})
915
+ }
916
+
917
+ request_url = @base_url || @client.base_url
918
+ request_url = request_url.gsub('{accountName}', account_name)
919
+ request_url = request_url.gsub('{adlsFileSystemDnsSuffix}', @client.adls_file_system_dns_suffix)
920
+
921
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
922
+ promise = request.run_promise do |req|
923
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
924
+ end
925
+
926
+ promise = promise.then do |http_response|
927
+ status_code = http_response.status
928
+ response_content = http_response.body
929
+ unless status_code == 200
930
+ error_model = JSON.load(response_content)
931
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
932
+ end
933
+
934
+ # Create Result
935
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
936
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
937
+ # Deserialize Response
938
+ if status_code == 200
939
+ begin
940
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
941
+ result_mapper = FileStatusResult.mapper()
942
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
943
+ rescue Exception => e
944
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
945
+ end
946
+ end
947
+
948
+ result
949
+ end
950
+
951
+ promise.execute
952
+ end
953
+
954
+ #
955
+ # Appends to the specified file. This method does not support multiple
956
+ # concurrent appends to the file. NOTE: Concurrent append and normal (serial)
957
+ # append CANNOT be used interchangeably. Once a file has been appended to
958
+ # using either append option, it can only be appended to using that append
959
+ # option. Use the ConcurrentAppend option if you would like support for
960
+ # concurrent appends.
961
+ #
962
+ # @param account_name [String] The Azure Data Lake Store account to execute
963
+ # filesystem operations on.
964
+ # @param direct_file_path [String] The Data Lake Store path (starting with
965
+ # '/') of the file to which to append.
966
+ # @param stream_contents The file contents to include when appending to the
967
+ # file.
968
+ # @param offset [Integer] The optional offset in the stream to begin the
969
+ # append operation. Default is to append at the end of the stream.
970
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
971
+ # will be added to the HTTP request.
972
+ #
973
+ #
974
+ def append(account_name, direct_file_path, stream_contents, offset = nil, custom_headers = nil)
975
+ response = append_async(account_name, direct_file_path, stream_contents, offset, custom_headers).value!
976
+ nil
977
+ end
978
+
979
+ #
980
+ # Appends to the specified file. This method does not support multiple
981
+ # concurrent appends to the file. NOTE: Concurrent append and normal (serial)
982
+ # append CANNOT be used interchangeably. Once a file has been appended to
983
+ # using either append option, it can only be appended to using that append
984
+ # option. Use the ConcurrentAppend option if you would like support for
985
+ # concurrent appends.
986
+ #
987
+ # @param account_name [String] The Azure Data Lake Store account to execute
988
+ # filesystem operations on.
989
+ # @param direct_file_path [String] The Data Lake Store path (starting with
990
+ # '/') of the file to which to append.
991
+ # @param stream_contents The file contents to include when appending to the
992
+ # file.
993
+ # @param offset [Integer] The optional offset in the stream to begin the
994
+ # append operation. Default is to append at the end of the stream.
995
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
996
+ # will be added to the HTTP request.
997
+ #
998
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
999
+ #
1000
+ def append_with_http_info(account_name, direct_file_path, stream_contents, offset = nil, custom_headers = nil)
1001
+ append_async(account_name, direct_file_path, stream_contents, offset, custom_headers).value!
1002
+ end
1003
+
1004
+ #
1005
+ # Appends to the specified file. This method does not support multiple
1006
+ # concurrent appends to the file. NOTE: Concurrent append and normal (serial)
1007
+ # append CANNOT be used interchangeably. Once a file has been appended to
1008
+ # using either append option, it can only be appended to using that append
1009
+ # option. Use the ConcurrentAppend option if you would like support for
1010
+ # concurrent appends.
1011
+ #
1012
+ # @param account_name [String] The Azure Data Lake Store account to execute
1013
+ # filesystem operations on.
1014
+ # @param direct_file_path [String] The Data Lake Store path (starting with
1015
+ # '/') of the file to which to append.
1016
+ # @param stream_contents The file contents to include when appending to the
1017
+ # file.
1018
+ # @param offset [Integer] The optional offset in the stream to begin the
1019
+ # append operation. Default is to append at the end of the stream.
1020
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1021
+ # to the HTTP request.
1022
+ #
1023
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1024
+ #
1025
+ def append_async(account_name, direct_file_path, stream_contents, offset = nil, custom_headers = nil)
1026
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1027
+ fail ArgumentError, '@client.adls_file_system_dns_suffix is nil' if @client.adls_file_system_dns_suffix.nil?
1028
+ fail ArgumentError, 'direct_file_path is nil' if direct_file_path.nil?
1029
+ fail ArgumentError, 'stream_contents is nil' if stream_contents.nil?
1030
+ op = 'APPEND'
1031
+ append = 'true'
1032
+ transfer_encoding = 'chunked'
1033
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1034
+
1035
+
1036
+ request_headers = {}
1037
+
1038
+ # Set Headers
1039
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1040
+ request_headers['Transfer-Encoding'] = transfer_encoding unless transfer_encoding.nil?
1041
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1042
+
1043
+ request_headers['Content-Type'] = 'application/octet-stream'
1044
+
1045
+ # Serialize Request
1046
+ request_mapper = {
1047
+ required: true,
1048
+ serialized_name: 'streamContents',
1049
+ type: {
1050
+ name: 'Stream'
1051
+ }
1052
+ }
1053
+ request_content = @client.serialize(request_mapper, stream_contents, 'stream_contents')
1054
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1055
+
1056
+ path_template = '/webhdfs/v1/{directFilePath}'
1057
+ options = {
1058
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1059
+ path_params: {'directFilePath' => direct_file_path},
1060
+ query_params: {'offset' => offset,'op' => op,'append' => append,'api-version' => @client.api_version},
1061
+ body: request_content,
1062
+ headers: request_headers.merge(custom_headers || {})
1063
+ }
1064
+
1065
+ request_url = @base_url || @client.base_url
1066
+ request_url = request_url.gsub('{accountName}', account_name)
1067
+ request_url = request_url.gsub('{adlsFileSystemDnsSuffix}', @client.adls_file_system_dns_suffix)
1068
+
1069
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
1070
+ promise = request.run_promise do |req|
1071
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
1072
+ end
1073
+
1074
+ promise = promise.then do |http_response|
1075
+ status_code = http_response.status
1076
+ response_content = http_response.body
1077
+ unless status_code == 200
1078
+ error_model = JSON.load(response_content)
1079
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
1080
+ end
1081
+
1082
+ # Create Result
1083
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
1084
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1085
+
1086
+ result
1087
+ end
1088
+
1089
+ promise.execute
1090
+ end
1091
+
1092
+ #
1093
+ # Creates a file with optionally specified content.
1094
+ #
1095
+ # @param account_name [String] The Azure Data Lake Store account to execute
1096
+ # filesystem operations on.
1097
+ # @param direct_file_path [String] The Data Lake Store path (starting with
1098
+ # '/') of the file to create.
1099
+ # @param stream_contents The file contents to include when creating the file.
1100
+ # This parameter is optional, resulting in an empty file if not specified.
1101
+ # @param overwrite [Boolean] The indication of if the file should be
1102
+ # overwritten.
1103
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1104
+ # will be added to the HTTP request.
1105
+ #
1106
+ #
1107
+ def create(account_name, direct_file_path, stream_contents = nil, overwrite = nil, custom_headers = nil)
1108
+ response = create_async(account_name, direct_file_path, stream_contents, overwrite, custom_headers).value!
1109
+ nil
1110
+ end
1111
+
1112
+ #
1113
+ # Creates a file with optionally specified content.
1114
+ #
1115
+ # @param account_name [String] The Azure Data Lake Store account to execute
1116
+ # filesystem operations on.
1117
+ # @param direct_file_path [String] The Data Lake Store path (starting with
1118
+ # '/') of the file to create.
1119
+ # @param stream_contents The file contents to include when creating the file.
1120
+ # This parameter is optional, resulting in an empty file if not specified.
1121
+ # @param overwrite [Boolean] The indication of if the file should be
1122
+ # overwritten.
1123
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1124
+ # will be added to the HTTP request.
1125
+ #
1126
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1127
+ #
1128
+ def create_with_http_info(account_name, direct_file_path, stream_contents = nil, overwrite = nil, custom_headers = nil)
1129
+ create_async(account_name, direct_file_path, stream_contents, overwrite, custom_headers).value!
1130
+ end
1131
+
1132
+ #
1133
+ # Creates a file with optionally specified content.
1134
+ #
1135
+ # @param account_name [String] The Azure Data Lake Store account to execute
1136
+ # filesystem operations on.
1137
+ # @param direct_file_path [String] The Data Lake Store path (starting with
1138
+ # '/') of the file to create.
1139
+ # @param stream_contents The file contents to include when creating the file.
1140
+ # This parameter is optional, resulting in an empty file if not specified.
1141
+ # @param overwrite [Boolean] The indication of if the file should be
1142
+ # overwritten.
1143
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1144
+ # to the HTTP request.
1145
+ #
1146
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1147
+ #
1148
+ def create_async(account_name, direct_file_path, stream_contents = nil, overwrite = nil, custom_headers = nil)
1149
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1150
+ fail ArgumentError, '@client.adls_file_system_dns_suffix is nil' if @client.adls_file_system_dns_suffix.nil?
1151
+ fail ArgumentError, 'direct_file_path is nil' if direct_file_path.nil?
1152
+ op = 'CREATE'
1153
+ write = 'true'
1154
+ transfer_encoding = 'chunked'
1155
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1156
+
1157
+
1158
+ request_headers = {}
1159
+
1160
+ # Set Headers
1161
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1162
+ request_headers['Transfer-Encoding'] = transfer_encoding unless transfer_encoding.nil?
1163
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1164
+
1165
+ request_headers['Content-Type'] = 'application/octet-stream'
1166
+
1167
+ # Serialize Request
1168
+ request_mapper = {
1169
+ required: false,
1170
+ serialized_name: 'streamContents',
1171
+ type: {
1172
+ name: 'Stream'
1173
+ }
1174
+ }
1175
+ request_content = @client.serialize(request_mapper, stream_contents, 'stream_contents')
1176
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1177
+
1178
+ path_template = '/webhdfs/v1/{directFilePath}'
1179
+ options = {
1180
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1181
+ path_params: {'directFilePath' => direct_file_path},
1182
+ query_params: {'overwrite' => overwrite,'op' => op,'write' => write,'api-version' => @client.api_version},
1183
+ body: request_content,
1184
+ headers: request_headers.merge(custom_headers || {})
1185
+ }
1186
+
1187
+ request_url = @base_url || @client.base_url
1188
+ request_url = request_url.gsub('{accountName}', account_name)
1189
+ request_url = request_url.gsub('{adlsFileSystemDnsSuffix}', @client.adls_file_system_dns_suffix)
1190
+
1191
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :put, options)
1192
+ promise = request.run_promise do |req|
1193
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
1194
+ end
1195
+
1196
+ promise = promise.then do |http_response|
1197
+ status_code = http_response.status
1198
+ response_content = http_response.body
1199
+ unless status_code == 201
1200
+ error_model = JSON.load(response_content)
1201
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
1202
+ end
1203
+
1204
+ # Create Result
1205
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
1206
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1207
+
1208
+ result
1209
+ end
1210
+
1211
+ promise.execute
1212
+ end
1213
+
1214
+ #
1215
+ # Opens and reads from the specified file.
1216
+ #
1217
+ # @param account_name [String] The Azure Data Lake Store account to execute
1218
+ # filesystem operations on.
1219
+ # @param direct_file_path [String] The Data Lake Store path (starting with
1220
+ # '/') of the file to open.
1221
+ # @param length [Integer]
1222
+ # @param offset [Integer]
1223
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1224
+ # will be added to the HTTP request.
1225
+ #
1226
+ # @return [System.IO.Stream] operation results.
1227
+ #
1228
+ def open(account_name, direct_file_path, length = nil, offset = nil, custom_headers = nil)
1229
+ response = open_async(account_name, direct_file_path, length, offset, custom_headers).value!
1230
+ response.body unless response.nil?
1231
+ end
1232
+
1233
+ #
1234
+ # Opens and reads from the specified file.
1235
+ #
1236
+ # @param account_name [String] The Azure Data Lake Store account to execute
1237
+ # filesystem operations on.
1238
+ # @param direct_file_path [String] The Data Lake Store path (starting with
1239
+ # '/') of the file to open.
1240
+ # @param length [Integer]
1241
+ # @param offset [Integer]
1242
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1243
+ # will be added to the HTTP request.
1244
+ #
1245
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1246
+ #
1247
+ def open_with_http_info(account_name, direct_file_path, length = nil, offset = nil, custom_headers = nil)
1248
+ open_async(account_name, direct_file_path, length, offset, custom_headers).value!
1249
+ end
1250
+
1251
+ #
1252
+ # Opens and reads from the specified file.
1253
+ #
1254
+ # @param account_name [String] The Azure Data Lake Store account to execute
1255
+ # filesystem operations on.
1256
+ # @param direct_file_path [String] The Data Lake Store path (starting with
1257
+ # '/') of the file to open.
1258
+ # @param length [Integer]
1259
+ # @param offset [Integer]
1260
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1261
+ # to the HTTP request.
1262
+ #
1263
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1264
+ #
1265
+ def open_async(account_name, direct_file_path, length = nil, offset = nil, custom_headers = nil)
1266
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1267
+ fail ArgumentError, '@client.adls_file_system_dns_suffix is nil' if @client.adls_file_system_dns_suffix.nil?
1268
+ fail ArgumentError, 'direct_file_path is nil' if direct_file_path.nil?
1269
+ op = 'OPEN'
1270
+ read = 'true'
1271
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1272
+
1273
+
1274
+ request_headers = {}
1275
+
1276
+ # Set Headers
1277
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1278
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1279
+ path_template = '/webhdfs/v1/{directFilePath}'
1280
+ options = {
1281
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1282
+ path_params: {'directFilePath' => direct_file_path},
1283
+ query_params: {'length' => length,'offset' => offset,'op' => op,'read' => read,'api-version' => @client.api_version},
1284
+ headers: request_headers.merge(custom_headers || {})
1285
+ }
1286
+
1287
+ request_url = @base_url || @client.base_url
1288
+ request_url = request_url.gsub('{accountName}', account_name)
1289
+ request_url = request_url.gsub('{adlsFileSystemDnsSuffix}', @client.adls_file_system_dns_suffix)
1290
+
1291
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
1292
+ promise = request.run_promise do |req|
1293
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
1294
+ end
1295
+
1296
+ promise = promise.then do |http_response|
1297
+ status_code = http_response.status
1298
+ response_content = http_response.body
1299
+ unless status_code == 200
1300
+ error_model = JSON.load(response_content)
1301
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
1302
+ end
1303
+
1304
+ # Create Result
1305
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
1306
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1307
+ # Deserialize Response
1308
+ if status_code == 200
1309
+ begin
1310
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1311
+ result_mapper = {
1312
+ required: false,
1313
+ serialized_name: 'parsed_response',
1314
+ type: {
1315
+ name: 'Stream'
1316
+ }
1317
+ }
1318
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1319
+ rescue Exception => e
1320
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1321
+ end
1322
+ end
1323
+
1324
+ result
1325
+ end
1326
+
1327
+ promise.execute
1328
+ end
1329
+
1330
+ #
1331
+ # Sets the Access Control List (ACL) for a file or folder.
1332
+ #
1333
+ # @param account_name [String] The Azure Data Lake Store account to execute
1334
+ # filesystem operations on.
1335
+ # @param set_acl_file_path [String] The Data Lake Store path (starting with
1336
+ # '/') of the file or directory on which to set the ACL.
1337
+ # @param aclspec [String] The ACL spec included in ACL creation operations in
1338
+ # the format '[default:]user|group|other::r|-w|-x|-'
1339
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1340
+ # will be added to the HTTP request.
1341
+ #
1342
+ #
1343
+ def set_acl(account_name, set_acl_file_path, aclspec, custom_headers = nil)
1344
+ response = set_acl_async(account_name, set_acl_file_path, aclspec, custom_headers).value!
1345
+ nil
1346
+ end
1347
+
1348
+ #
1349
+ # Sets the Access Control List (ACL) for a file or folder.
1350
+ #
1351
+ # @param account_name [String] The Azure Data Lake Store account to execute
1352
+ # filesystem operations on.
1353
+ # @param set_acl_file_path [String] The Data Lake Store path (starting with
1354
+ # '/') of the file or directory on which to set the ACL.
1355
+ # @param aclspec [String] The ACL spec included in ACL creation operations in
1356
+ # the format '[default:]user|group|other::r|-w|-x|-'
1357
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1358
+ # will be added to the HTTP request.
1359
+ #
1360
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1361
+ #
1362
+ def set_acl_with_http_info(account_name, set_acl_file_path, aclspec, custom_headers = nil)
1363
+ set_acl_async(account_name, set_acl_file_path, aclspec, custom_headers).value!
1364
+ end
1365
+
1366
+ #
1367
+ # Sets the Access Control List (ACL) for a file or folder.
1368
+ #
1369
+ # @param account_name [String] The Azure Data Lake Store account to execute
1370
+ # filesystem operations on.
1371
+ # @param set_acl_file_path [String] The Data Lake Store path (starting with
1372
+ # '/') of the file or directory on which to set the ACL.
1373
+ # @param aclspec [String] The ACL spec included in ACL creation operations in
1374
+ # the format '[default:]user|group|other::r|-w|-x|-'
1375
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1376
+ # to the HTTP request.
1377
+ #
1378
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1379
+ #
1380
+ def set_acl_async(account_name, set_acl_file_path, aclspec, custom_headers = nil)
1381
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1382
+ fail ArgumentError, '@client.adls_file_system_dns_suffix is nil' if @client.adls_file_system_dns_suffix.nil?
1383
+ fail ArgumentError, 'set_acl_file_path is nil' if set_acl_file_path.nil?
1384
+ fail ArgumentError, 'aclspec is nil' if aclspec.nil?
1385
+ op = 'SETACL'
1386
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1387
+
1388
+
1389
+ request_headers = {}
1390
+
1391
+ # Set Headers
1392
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1393
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1394
+ path_template = '/webhdfs/v1/{setAclFilePath}'
1395
+ options = {
1396
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1397
+ path_params: {'setAclFilePath' => set_acl_file_path},
1398
+ query_params: {'aclspec' => aclspec,'op' => op,'api-version' => @client.api_version},
1399
+ headers: request_headers.merge(custom_headers || {})
1400
+ }
1401
+
1402
+ request_url = @base_url || @client.base_url
1403
+ request_url = request_url.gsub('{accountName}', account_name)
1404
+ request_url = request_url.gsub('{adlsFileSystemDnsSuffix}', @client.adls_file_system_dns_suffix)
1405
+
1406
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :put, options)
1407
+ promise = request.run_promise do |req|
1408
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
1409
+ end
1410
+
1411
+ promise = promise.then do |http_response|
1412
+ status_code = http_response.status
1413
+ response_content = http_response.body
1414
+ unless status_code == 200
1415
+ error_model = JSON.load(response_content)
1416
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
1417
+ end
1418
+
1419
+ # Create Result
1420
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
1421
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1422
+
1423
+ result
1424
+ end
1425
+
1426
+ promise.execute
1427
+ end
1428
+
1429
+ #
1430
+ # Modifies existing Access Control List (ACL) entries on a file or folder.
1431
+ #
1432
+ # @param account_name [String] The Azure Data Lake Store account to execute
1433
+ # filesystem operations on.
1434
+ # @param modify_acl_file_path [String] The Data Lake Store path (starting with
1435
+ # '/') of the file or directory with the ACL being modified.
1436
+ # @param aclspec [String] The ACL specification included in ACL modification
1437
+ # operations in the format '[default:]user|group|other::r|-w|-x|-'
1438
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1439
+ # will be added to the HTTP request.
1440
+ #
1441
+ #
1442
+ def modify_acl_entries(account_name, modify_acl_file_path, aclspec, custom_headers = nil)
1443
+ response = modify_acl_entries_async(account_name, modify_acl_file_path, aclspec, custom_headers).value!
1444
+ nil
1445
+ end
1446
+
1447
+ #
1448
+ # Modifies existing Access Control List (ACL) entries on a file or folder.
1449
+ #
1450
+ # @param account_name [String] The Azure Data Lake Store account to execute
1451
+ # filesystem operations on.
1452
+ # @param modify_acl_file_path [String] The Data Lake Store path (starting with
1453
+ # '/') of the file or directory with the ACL being modified.
1454
+ # @param aclspec [String] The ACL specification included in ACL modification
1455
+ # operations in the format '[default:]user|group|other::r|-w|-x|-'
1456
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1457
+ # will be added to the HTTP request.
1458
+ #
1459
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1460
+ #
1461
+ def modify_acl_entries_with_http_info(account_name, modify_acl_file_path, aclspec, custom_headers = nil)
1462
+ modify_acl_entries_async(account_name, modify_acl_file_path, aclspec, custom_headers).value!
1463
+ end
1464
+
1465
+ #
1466
+ # Modifies existing Access Control List (ACL) entries on a file or folder.
1467
+ #
1468
+ # @param account_name [String] The Azure Data Lake Store account to execute
1469
+ # filesystem operations on.
1470
+ # @param modify_acl_file_path [String] The Data Lake Store path (starting with
1471
+ # '/') of the file or directory with the ACL being modified.
1472
+ # @param aclspec [String] The ACL specification included in ACL modification
1473
+ # operations in the format '[default:]user|group|other::r|-w|-x|-'
1474
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1475
+ # to the HTTP request.
1476
+ #
1477
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1478
+ #
1479
+ def modify_acl_entries_async(account_name, modify_acl_file_path, aclspec, custom_headers = nil)
1480
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1481
+ fail ArgumentError, '@client.adls_file_system_dns_suffix is nil' if @client.adls_file_system_dns_suffix.nil?
1482
+ fail ArgumentError, 'modify_acl_file_path is nil' if modify_acl_file_path.nil?
1483
+ fail ArgumentError, 'aclspec is nil' if aclspec.nil?
1484
+ op = 'MODIFYACLENTRIES'
1485
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1486
+
1487
+
1488
+ request_headers = {}
1489
+
1490
+ # Set Headers
1491
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1492
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1493
+ path_template = '/webhdfs/v1/{modifyAclFilePath}'
1494
+ options = {
1495
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1496
+ path_params: {'modifyAclFilePath' => modify_acl_file_path},
1497
+ query_params: {'aclspec' => aclspec,'op' => op,'api-version' => @client.api_version},
1498
+ headers: request_headers.merge(custom_headers || {})
1499
+ }
1500
+
1501
+ request_url = @base_url || @client.base_url
1502
+ request_url = request_url.gsub('{accountName}', account_name)
1503
+ request_url = request_url.gsub('{adlsFileSystemDnsSuffix}', @client.adls_file_system_dns_suffix)
1504
+
1505
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :put, options)
1506
+ promise = request.run_promise do |req|
1507
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
1508
+ end
1509
+
1510
+ promise = promise.then do |http_response|
1511
+ status_code = http_response.status
1512
+ response_content = http_response.body
1513
+ unless status_code == 200
1514
+ error_model = JSON.load(response_content)
1515
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
1516
+ end
1517
+
1518
+ # Create Result
1519
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
1520
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1521
+
1522
+ result
1523
+ end
1524
+
1525
+ promise.execute
1526
+ end
1527
+
1528
+ #
1529
+ # Removes existing Access Control List (ACL) entries for a file or folder.
1530
+ #
1531
+ # @param account_name [String] The Azure Data Lake Store account to execute
1532
+ # filesystem operations on.
1533
+ # @param remove_acl_file_path [String] The Data Lake Store path (starting with
1534
+ # '/') of the file or directory with the ACL being removed.
1535
+ # @param aclspec [String] The ACL spec included in ACL removal operations in
1536
+ # the format '[default:]user|group|other'
1537
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1538
+ # will be added to the HTTP request.
1539
+ #
1540
+ #
1541
+ def remove_acl_entries(account_name, remove_acl_file_path, aclspec, custom_headers = nil)
1542
+ response = remove_acl_entries_async(account_name, remove_acl_file_path, aclspec, custom_headers).value!
1543
+ nil
1544
+ end
1545
+
1546
+ #
1547
+ # Removes existing Access Control List (ACL) entries for a file or folder.
1548
+ #
1549
+ # @param account_name [String] The Azure Data Lake Store account to execute
1550
+ # filesystem operations on.
1551
+ # @param remove_acl_file_path [String] The Data Lake Store path (starting with
1552
+ # '/') of the file or directory with the ACL being removed.
1553
+ # @param aclspec [String] The ACL spec included in ACL removal operations in
1554
+ # the format '[default:]user|group|other'
1555
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1556
+ # will be added to the HTTP request.
1557
+ #
1558
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1559
+ #
1560
+ def remove_acl_entries_with_http_info(account_name, remove_acl_file_path, aclspec, custom_headers = nil)
1561
+ remove_acl_entries_async(account_name, remove_acl_file_path, aclspec, custom_headers).value!
1562
+ end
1563
+
1564
+ #
1565
+ # Removes existing Access Control List (ACL) entries for a file or folder.
1566
+ #
1567
+ # @param account_name [String] The Azure Data Lake Store account to execute
1568
+ # filesystem operations on.
1569
+ # @param remove_acl_file_path [String] The Data Lake Store path (starting with
1570
+ # '/') of the file or directory with the ACL being removed.
1571
+ # @param aclspec [String] The ACL spec included in ACL removal operations in
1572
+ # the format '[default:]user|group|other'
1573
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1574
+ # to the HTTP request.
1575
+ #
1576
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1577
+ #
1578
+ def remove_acl_entries_async(account_name, remove_acl_file_path, aclspec, custom_headers = nil)
1579
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1580
+ fail ArgumentError, '@client.adls_file_system_dns_suffix is nil' if @client.adls_file_system_dns_suffix.nil?
1581
+ fail ArgumentError, 'remove_acl_file_path is nil' if remove_acl_file_path.nil?
1582
+ fail ArgumentError, 'aclspec is nil' if aclspec.nil?
1583
+ op = 'REMOVEACLENTRIES'
1584
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1585
+
1586
+
1587
+ request_headers = {}
1588
+
1589
+ # Set Headers
1590
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1591
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1592
+ path_template = '/webhdfs/v1/{removeAclFilePath}'
1593
+ options = {
1594
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1595
+ path_params: {'removeAclFilePath' => remove_acl_file_path},
1596
+ query_params: {'aclspec' => aclspec,'op' => op,'api-version' => @client.api_version},
1597
+ headers: request_headers.merge(custom_headers || {})
1598
+ }
1599
+
1600
+ request_url = @base_url || @client.base_url
1601
+ request_url = request_url.gsub('{accountName}', account_name)
1602
+ request_url = request_url.gsub('{adlsFileSystemDnsSuffix}', @client.adls_file_system_dns_suffix)
1603
+
1604
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :put, options)
1605
+ promise = request.run_promise do |req|
1606
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
1607
+ end
1608
+
1609
+ promise = promise.then do |http_response|
1610
+ status_code = http_response.status
1611
+ response_content = http_response.body
1612
+ unless status_code == 200
1613
+ error_model = JSON.load(response_content)
1614
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
1615
+ end
1616
+
1617
+ # Create Result
1618
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
1619
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1620
+
1621
+ result
1622
+ end
1623
+
1624
+ promise.execute
1625
+ end
1626
+
1627
+ #
1628
+ # Gets Access Control List (ACL) entries for the specified file or directory.
1629
+ #
1630
+ # @param account_name [String] The Azure Data Lake Store account to execute
1631
+ # filesystem operations on.
1632
+ # @param acl_file_path [String] The Data Lake Store path (starting with '/')
1633
+ # of the file or directory for which to get the ACL.
1634
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1635
+ # will be added to the HTTP request.
1636
+ #
1637
+ # @return [AclStatusResult] operation results.
1638
+ #
1639
+ def get_acl_status(account_name, acl_file_path, custom_headers = nil)
1640
+ response = get_acl_status_async(account_name, acl_file_path, custom_headers).value!
1641
+ response.body unless response.nil?
1642
+ end
1643
+
1644
+ #
1645
+ # Gets Access Control List (ACL) entries for the specified file or directory.
1646
+ #
1647
+ # @param account_name [String] The Azure Data Lake Store account to execute
1648
+ # filesystem operations on.
1649
+ # @param acl_file_path [String] The Data Lake Store path (starting with '/')
1650
+ # of the file or directory for which to get the ACL.
1651
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1652
+ # will be added to the HTTP request.
1653
+ #
1654
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1655
+ #
1656
+ def get_acl_status_with_http_info(account_name, acl_file_path, custom_headers = nil)
1657
+ get_acl_status_async(account_name, acl_file_path, custom_headers).value!
1658
+ end
1659
+
1660
+ #
1661
+ # Gets Access Control List (ACL) entries for the specified file or directory.
1662
+ #
1663
+ # @param account_name [String] The Azure Data Lake Store account to execute
1664
+ # filesystem operations on.
1665
+ # @param acl_file_path [String] The Data Lake Store path (starting with '/')
1666
+ # of the file or directory for which to get the ACL.
1667
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1668
+ # to the HTTP request.
1669
+ #
1670
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1671
+ #
1672
+ def get_acl_status_async(account_name, acl_file_path, custom_headers = nil)
1673
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1674
+ fail ArgumentError, '@client.adls_file_system_dns_suffix is nil' if @client.adls_file_system_dns_suffix.nil?
1675
+ fail ArgumentError, 'acl_file_path is nil' if acl_file_path.nil?
1676
+ op = 'GETACLSTATUS'
1677
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1678
+
1679
+
1680
+ request_headers = {}
1681
+
1682
+ # Set Headers
1683
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1684
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1685
+ path_template = '/webhdfs/v1/{aclFilePath}'
1686
+ options = {
1687
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1688
+ path_params: {'aclFilePath' => acl_file_path},
1689
+ query_params: {'op' => op,'api-version' => @client.api_version},
1690
+ headers: request_headers.merge(custom_headers || {})
1691
+ }
1692
+
1693
+ request_url = @base_url || @client.base_url
1694
+ request_url = request_url.gsub('{accountName}', account_name)
1695
+ request_url = request_url.gsub('{adlsFileSystemDnsSuffix}', @client.adls_file_system_dns_suffix)
1696
+
1697
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
1698
+ promise = request.run_promise do |req|
1699
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
1700
+ end
1701
+
1702
+ promise = promise.then do |http_response|
1703
+ status_code = http_response.status
1704
+ response_content = http_response.body
1705
+ unless status_code == 200
1706
+ error_model = JSON.load(response_content)
1707
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
1708
+ end
1709
+
1710
+ # Create Result
1711
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
1712
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1713
+ # Deserialize Response
1714
+ if status_code == 200
1715
+ begin
1716
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1717
+ result_mapper = AclStatusResult.mapper()
1718
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1719
+ rescue Exception => e
1720
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1721
+ end
1722
+ end
1723
+
1724
+ result
1725
+ end
1726
+
1727
+ promise.execute
1728
+ end
1729
+
1730
+ #
1731
+ # Deletes the requested file or directory, optionally recursively.
1732
+ #
1733
+ # @param account_name [String] The Azure Data Lake Store account to execute
1734
+ # filesystem operations on.
1735
+ # @param file_path [String] The Data Lake Store path (starting with '/') of
1736
+ # the file or directory to delete.
1737
+ # @param recursive [Boolean] The optional switch indicating if the delete
1738
+ # should be recursive
1739
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1740
+ # will be added to the HTTP request.
1741
+ #
1742
+ # @return [FileOperationResult] operation results.
1743
+ #
1744
+ def delete(account_name, file_path, recursive = nil, custom_headers = nil)
1745
+ response = delete_async(account_name, file_path, recursive, custom_headers).value!
1746
+ response.body unless response.nil?
1747
+ end
1748
+
1749
+ #
1750
+ # Deletes the requested file or directory, optionally recursively.
1751
+ #
1752
+ # @param account_name [String] The Azure Data Lake Store account to execute
1753
+ # filesystem operations on.
1754
+ # @param file_path [String] The Data Lake Store path (starting with '/') of
1755
+ # the file or directory to delete.
1756
+ # @param recursive [Boolean] The optional switch indicating if the delete
1757
+ # should be recursive
1758
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1759
+ # will be added to the HTTP request.
1760
+ #
1761
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1762
+ #
1763
+ def delete_with_http_info(account_name, file_path, recursive = nil, custom_headers = nil)
1764
+ delete_async(account_name, file_path, recursive, custom_headers).value!
1765
+ end
1766
+
1767
+ #
1768
+ # Deletes the requested file or directory, optionally recursively.
1769
+ #
1770
+ # @param account_name [String] The Azure Data Lake Store account to execute
1771
+ # filesystem operations on.
1772
+ # @param file_path [String] The Data Lake Store path (starting with '/') of
1773
+ # the file or directory to delete.
1774
+ # @param recursive [Boolean] The optional switch indicating if the delete
1775
+ # should be recursive
1776
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1777
+ # to the HTTP request.
1778
+ #
1779
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1780
+ #
1781
+ def delete_async(account_name, file_path, recursive = nil, custom_headers = nil)
1782
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1783
+ fail ArgumentError, '@client.adls_file_system_dns_suffix is nil' if @client.adls_file_system_dns_suffix.nil?
1784
+ fail ArgumentError, 'file_path is nil' if file_path.nil?
1785
+ op = 'DELETE'
1786
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1787
+
1788
+
1789
+ request_headers = {}
1790
+
1791
+ # Set Headers
1792
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1793
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1794
+ path_template = '/webhdfs/v1/{filePath}'
1795
+ options = {
1796
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1797
+ path_params: {'filePath' => file_path},
1798
+ query_params: {'recursive' => recursive,'op' => op,'api-version' => @client.api_version},
1799
+ headers: request_headers.merge(custom_headers || {})
1800
+ }
1801
+
1802
+ request_url = @base_url || @client.base_url
1803
+ request_url = request_url.gsub('{accountName}', account_name)
1804
+ request_url = request_url.gsub('{adlsFileSystemDnsSuffix}', @client.adls_file_system_dns_suffix)
1805
+
1806
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :delete, options)
1807
+ promise = request.run_promise do |req|
1808
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
1809
+ end
1810
+
1811
+ promise = promise.then do |http_response|
1812
+ status_code = http_response.status
1813
+ response_content = http_response.body
1814
+ unless status_code == 200
1815
+ error_model = JSON.load(response_content)
1816
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
1817
+ end
1818
+
1819
+ # Create Result
1820
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
1821
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1822
+ # Deserialize Response
1823
+ if status_code == 200
1824
+ begin
1825
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1826
+ result_mapper = FileOperationResult.mapper()
1827
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1828
+ rescue Exception => e
1829
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1830
+ end
1831
+ end
1832
+
1833
+ result
1834
+ end
1835
+
1836
+ promise.execute
1837
+ end
1838
+
1839
+ #
1840
+ # Rename a file or directory.
1841
+ #
1842
+ # @param account_name [String] The Azure Data Lake Store account to execute
1843
+ # filesystem operations on.
1844
+ # @param rename_file_path [String] The Data Lake Store path (starting with
1845
+ # '/') of the file or directory to move/rename.
1846
+ # @param destination [String] The path to move/rename the file or folder to
1847
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1848
+ # will be added to the HTTP request.
1849
+ #
1850
+ # @return [FileOperationResult] operation results.
1851
+ #
1852
+ def rename(account_name, rename_file_path, destination, custom_headers = nil)
1853
+ response = rename_async(account_name, rename_file_path, destination, custom_headers).value!
1854
+ response.body unless response.nil?
1855
+ end
1856
+
1857
+ #
1858
+ # Rename a file or directory.
1859
+ #
1860
+ # @param account_name [String] The Azure Data Lake Store account to execute
1861
+ # filesystem operations on.
1862
+ # @param rename_file_path [String] The Data Lake Store path (starting with
1863
+ # '/') of the file or directory to move/rename.
1864
+ # @param destination [String] The path to move/rename the file or folder to
1865
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1866
+ # will be added to the HTTP request.
1867
+ #
1868
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1869
+ #
1870
+ def rename_with_http_info(account_name, rename_file_path, destination, custom_headers = nil)
1871
+ rename_async(account_name, rename_file_path, destination, custom_headers).value!
1872
+ end
1873
+
1874
+ #
1875
+ # Rename a file or directory.
1876
+ #
1877
+ # @param account_name [String] The Azure Data Lake Store account to execute
1878
+ # filesystem operations on.
1879
+ # @param rename_file_path [String] The Data Lake Store path (starting with
1880
+ # '/') of the file or directory to move/rename.
1881
+ # @param destination [String] The path to move/rename the file or folder to
1882
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1883
+ # to the HTTP request.
1884
+ #
1885
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1886
+ #
1887
+ def rename_async(account_name, rename_file_path, destination, custom_headers = nil)
1888
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1889
+ fail ArgumentError, '@client.adls_file_system_dns_suffix is nil' if @client.adls_file_system_dns_suffix.nil?
1890
+ fail ArgumentError, 'rename_file_path is nil' if rename_file_path.nil?
1891
+ fail ArgumentError, 'destination is nil' if destination.nil?
1892
+ op = 'RENAME'
1893
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1894
+
1895
+
1896
+ request_headers = {}
1897
+
1898
+ # Set Headers
1899
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1900
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1901
+ path_template = '/webhdfs/v1/{renameFilePath}'
1902
+ options = {
1903
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1904
+ path_params: {'renameFilePath' => rename_file_path},
1905
+ query_params: {'destination' => destination,'op' => op,'api-version' => @client.api_version},
1906
+ headers: request_headers.merge(custom_headers || {})
1907
+ }
1908
+
1909
+ request_url = @base_url || @client.base_url
1910
+ request_url = request_url.gsub('{accountName}', account_name)
1911
+ request_url = request_url.gsub('{adlsFileSystemDnsSuffix}', @client.adls_file_system_dns_suffix)
1912
+
1913
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :put, options)
1914
+ promise = request.run_promise do |req|
1915
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
1916
+ end
1917
+
1918
+ promise = promise.then do |http_response|
1919
+ status_code = http_response.status
1920
+ response_content = http_response.body
1921
+ unless status_code == 200
1922
+ error_model = JSON.load(response_content)
1923
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
1924
+ end
1925
+
1926
+ # Create Result
1927
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
1928
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1929
+ # Deserialize Response
1930
+ if status_code == 200
1931
+ begin
1932
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1933
+ result_mapper = FileOperationResult.mapper()
1934
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1935
+ rescue Exception => e
1936
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1937
+ end
1938
+ end
1939
+
1940
+ result
1941
+ end
1942
+
1943
+ promise.execute
1944
+ end
1945
+
1946
+ #
1947
+ # Sets the owner of a file or directory.
1948
+ #
1949
+ # @param account_name [String] The Azure Data Lake Store account to execute
1950
+ # filesystem operations on.
1951
+ # @param set_owner_file_path [String] The Data Lake Store path (starting with
1952
+ # '/') of the file or directory for which to set the owner.
1953
+ # @param owner [String] The AAD Object ID of the user owner of the file or
1954
+ # directory. If empty, the property will remain unchanged.
1955
+ # @param group [String] The AAD Object ID of the group owner of the file or
1956
+ # directory. If empty, the property will remain unchanged.
1957
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1958
+ # will be added to the HTTP request.
1959
+ #
1960
+ #
1961
+ def set_owner(account_name, set_owner_file_path, owner = nil, group = nil, custom_headers = nil)
1962
+ response = set_owner_async(account_name, set_owner_file_path, owner, group, custom_headers).value!
1963
+ nil
1964
+ end
1965
+
1966
+ #
1967
+ # Sets the owner of a file or directory.
1968
+ #
1969
+ # @param account_name [String] The Azure Data Lake Store account to execute
1970
+ # filesystem operations on.
1971
+ # @param set_owner_file_path [String] The Data Lake Store path (starting with
1972
+ # '/') of the file or directory for which to set the owner.
1973
+ # @param owner [String] The AAD Object ID of the user owner of the file or
1974
+ # directory. If empty, the property will remain unchanged.
1975
+ # @param group [String] The AAD Object ID of the group owner of the file or
1976
+ # directory. If empty, the property will remain unchanged.
1977
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1978
+ # will be added to the HTTP request.
1979
+ #
1980
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1981
+ #
1982
+ def set_owner_with_http_info(account_name, set_owner_file_path, owner = nil, group = nil, custom_headers = nil)
1983
+ set_owner_async(account_name, set_owner_file_path, owner, group, custom_headers).value!
1984
+ end
1985
+
1986
+ #
1987
+ # Sets the owner of a file or directory.
1988
+ #
1989
+ # @param account_name [String] The Azure Data Lake Store account to execute
1990
+ # filesystem operations on.
1991
+ # @param set_owner_file_path [String] The Data Lake Store path (starting with
1992
+ # '/') of the file or directory for which to set the owner.
1993
+ # @param owner [String] The AAD Object ID of the user owner of the file or
1994
+ # directory. If empty, the property will remain unchanged.
1995
+ # @param group [String] The AAD Object ID of the group owner of the file or
1996
+ # directory. If empty, the property will remain unchanged.
1997
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1998
+ # to the HTTP request.
1999
+ #
2000
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2001
+ #
2002
+ def set_owner_async(account_name, set_owner_file_path, owner = nil, group = nil, custom_headers = nil)
2003
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
2004
+ fail ArgumentError, '@client.adls_file_system_dns_suffix is nil' if @client.adls_file_system_dns_suffix.nil?
2005
+ fail ArgumentError, 'set_owner_file_path is nil' if set_owner_file_path.nil?
2006
+ op = 'SETOWNER'
2007
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2008
+
2009
+
2010
+ request_headers = {}
2011
+
2012
+ # Set Headers
2013
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2014
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2015
+ path_template = '/webhdfs/v1/{setOwnerFilePath}'
2016
+ options = {
2017
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2018
+ path_params: {'setOwnerFilePath' => set_owner_file_path},
2019
+ query_params: {'owner' => owner,'group' => group,'op' => op,'api-version' => @client.api_version},
2020
+ headers: request_headers.merge(custom_headers || {})
2021
+ }
2022
+
2023
+ request_url = @base_url || @client.base_url
2024
+ request_url = request_url.gsub('{accountName}', account_name)
2025
+ request_url = request_url.gsub('{adlsFileSystemDnsSuffix}', @client.adls_file_system_dns_suffix)
2026
+
2027
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :put, options)
2028
+ promise = request.run_promise do |req|
2029
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
2030
+ end
2031
+
2032
+ promise = promise.then do |http_response|
2033
+ status_code = http_response.status
2034
+ response_content = http_response.body
2035
+ unless status_code == 200
2036
+ error_model = JSON.load(response_content)
2037
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
2038
+ end
2039
+
2040
+ # Create Result
2041
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
2042
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2043
+
2044
+ result
2045
+ end
2046
+
2047
+ promise.execute
2048
+ end
2049
+
2050
+ #
2051
+ # Sets the permission of the file or folder.
2052
+ #
2053
+ # @param account_name [String] The Azure Data Lake Store account to execute
2054
+ # filesystem operations on.
2055
+ # @param set_permission_file_path [String] The Data Lake Store path (starting
2056
+ # with '/') of the file or directory for which to set the permission.
2057
+ # @param permission [String] A string representation of the permission (i.e
2058
+ # 'rwx'). If empty, this property remains unchanged.
2059
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2060
+ # will be added to the HTTP request.
2061
+ #
2062
+ #
2063
+ def set_permission(account_name, set_permission_file_path, permission = nil, custom_headers = nil)
2064
+ response = set_permission_async(account_name, set_permission_file_path, permission, custom_headers).value!
2065
+ nil
2066
+ end
2067
+
2068
+ #
2069
+ # Sets the permission of the file or folder.
2070
+ #
2071
+ # @param account_name [String] The Azure Data Lake Store account to execute
2072
+ # filesystem operations on.
2073
+ # @param set_permission_file_path [String] The Data Lake Store path (starting
2074
+ # with '/') of the file or directory for which to set the permission.
2075
+ # @param permission [String] A string representation of the permission (i.e
2076
+ # 'rwx'). If empty, this property remains unchanged.
2077
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2078
+ # will be added to the HTTP request.
2079
+ #
2080
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2081
+ #
2082
+ def set_permission_with_http_info(account_name, set_permission_file_path, permission = nil, custom_headers = nil)
2083
+ set_permission_async(account_name, set_permission_file_path, permission, custom_headers).value!
2084
+ end
2085
+
2086
+ #
2087
+ # Sets the permission of the file or folder.
2088
+ #
2089
+ # @param account_name [String] The Azure Data Lake Store account to execute
2090
+ # filesystem operations on.
2091
+ # @param set_permission_file_path [String] The Data Lake Store path (starting
2092
+ # with '/') of the file or directory for which to set the permission.
2093
+ # @param permission [String] A string representation of the permission (i.e
2094
+ # 'rwx'). If empty, this property remains unchanged.
2095
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2096
+ # to the HTTP request.
2097
+ #
2098
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2099
+ #
2100
+ def set_permission_async(account_name, set_permission_file_path, permission = nil, custom_headers = nil)
2101
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
2102
+ fail ArgumentError, '@client.adls_file_system_dns_suffix is nil' if @client.adls_file_system_dns_suffix.nil?
2103
+ fail ArgumentError, 'set_permission_file_path is nil' if set_permission_file_path.nil?
2104
+ op = 'SETPERMISSION'
2105
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2106
+
2107
+
2108
+ request_headers = {}
2109
+
2110
+ # Set Headers
2111
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2112
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2113
+ path_template = '/webhdfs/v1/{setPermissionFilePath}'
2114
+ options = {
2115
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2116
+ path_params: {'setPermissionFilePath' => set_permission_file_path},
2117
+ query_params: {'permission' => permission,'op' => op,'api-version' => @client.api_version},
2118
+ headers: request_headers.merge(custom_headers || {})
2119
+ }
2120
+
2121
+ request_url = @base_url || @client.base_url
2122
+ request_url = request_url.gsub('{accountName}', account_name)
2123
+ request_url = request_url.gsub('{adlsFileSystemDnsSuffix}', @client.adls_file_system_dns_suffix)
2124
+
2125
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :put, options)
2126
+ promise = request.run_promise do |req|
2127
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
2128
+ end
2129
+
2130
+ promise = promise.then do |http_response|
2131
+ status_code = http_response.status
2132
+ response_content = http_response.body
2133
+ unless status_code == 200
2134
+ error_model = JSON.load(response_content)
2135
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
2136
+ end
2137
+
2138
+ # Create Result
2139
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
2140
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2141
+
2142
+ result
2143
+ end
2144
+
2145
+ promise.execute
2146
+ end
2147
+
2148
+ end
2149
+ end