diff --git a/lib/services/datalake.Store/lib/filesystem/dataLakeStoreFileSystemManagementClient.d.ts b/lib/services/datalake.Store/lib/filesystem/dataLakeStoreFileSystemManagementClient.d.ts new file mode 100644 index 0000000000..6096d849da --- /dev/null +++ b/lib/services/datalake.Store/lib/filesystem/dataLakeStoreFileSystemManagementClient.d.ts @@ -0,0 +1,82 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import { ServiceClientCredentials } from 'ms-rest'; +import { AzureServiceClient, AzureServiceClientOptions } from 'ms-rest-azure'; +import * as models from "./models"; +import * as operations from "./operations"; + +/** + * DataLakeStoreFileSystemManagementClientOptions for DataLakeStoreFileSystemManagementClient. + */ +declare interface DataLakeStoreFileSystemManagementClientOptions extends AzureServiceClientOptions { + /** + * @property {string} [adlsFileSystemDnsSuffix] - Gets the URI used as the base for all cloud service requests. + */ + adlsFileSystemDnsSuffix?: string; + /** + * @property {string} [acceptLanguage] - The preferred language for the response. + */ + acceptLanguage?: string; + /** + * @property {number} [longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. + */ + longRunningOperationRetryTimeout?: number; + /** + * @property {boolean} [generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + */ + generateClientRequestId?: boolean; +} + +export default class DataLakeStoreFileSystemManagementClient extends AzureServiceClient { + /** + * Initializes a new instance of the DataLakeStoreFileSystemManagementClient class. + * @constructor + * + * @class + * @param {credentials} credentials - Credentials needed for the client to connect to Azure. + * + * @param {object} [options] - The parameter options + * + * @param {Array} [options.filters] - Filters to be added to the request pipeline + * + * @param {object} [options.requestOptions] - Options for the underlying request object + * {@link https://github.com/request/request#requestoptions-callback Options doc} + * + * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy + * + * @param {string} [options.adlsFileSystemDnsSuffix] - Gets the URI used as the base for all cloud service requests. + * + * @param {string} [options.acceptLanguage] - The preferred language for the response. + * + * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + */ + constructor(credentials: ServiceClientCredentials, options?: DataLakeStoreFileSystemManagementClientOptions); + + credentials: ServiceClientCredentials; + + apiVersion: string; + + adlsFileSystemDnsSuffix: string; + + acceptLanguage: string; + + longRunningOperationRetryTimeout: number; + + generateClientRequestId: boolean; + + // Operation groups + fileSystem: operations.FileSystem; +} + +export { DataLakeStoreFileSystemManagementClient, models as DataLakeStoreFileSystemManagementModels }; diff --git a/lib/services/datalake.Store/lib/filesystem/dataLakeStoreFileSystemManagementClient.js b/lib/services/datalake.Store/lib/filesystem/dataLakeStoreFileSystemManagementClient.js new file mode 100644 index 0000000000..f1518f7367 --- /dev/null +++ b/lib/services/datalake.Store/lib/filesystem/dataLakeStoreFileSystemManagementClient.js @@ -0,0 +1,81 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const ServiceClient = msRestAzure.AzureServiceClient; + +const models = require('./models'); +const operations = require('./operations'); + + +/** Class representing a DataLakeStoreFileSystemManagementClient. */ +class DataLakeStoreFileSystemManagementClient extends ServiceClient { + /** + * Create a DataLakeStoreFileSystemManagementClient. + * @param {credentials} credentials - Credentials needed for the client to connect to Azure. + * @param {object} [options] - The parameter options + * @param {Array} [options.filters] - Filters to be added to the request pipeline + * @param {object} [options.requestOptions] - Options for the underlying request object + * {@link https://github.com/request/request#requestoptions-callback Options doc} + * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy + * @param {string} [options.adlsFileSystemDnsSuffix] - Gets the URI used as the base for all cloud service requests. + * @param {string} [options.acceptLanguage] - The preferred language for the response. + * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. + * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + */ + constructor(credentials, options) { + if (credentials === null || credentials === undefined) { + throw new Error('\'credentials\' cannot be null.'); + } + + if (!options) options = {}; + + super(credentials, options); + + this.apiVersion = '2016-11-01'; + this.adlsFileSystemDnsSuffix = 'azuredatalakestore.net'; + this.acceptLanguage = 'en-US'; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.baseUri = 'https://{accountName}.{adlsFileSystemDnsSuffix}'; + this.credentials = credentials; + + let packageInfo = this.getPackageJsonInfo(__dirname); + this.addUserAgentInfo(`${packageInfo.name}/${packageInfo.version}`); + if(options.adlsFileSystemDnsSuffix !== null && options.adlsFileSystemDnsSuffix !== undefined) { + this.adlsFileSystemDnsSuffix = options.adlsFileSystemDnsSuffix; + } + if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { + this.acceptLanguage = options.acceptLanguage; + } + if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { + this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; + } + if(options.generateClientRequestId !== null && options.generateClientRequestId !== undefined) { + this.generateClientRequestId = options.generateClientRequestId; + } + this.fileSystem = new operations.FileSystem(this); + this.models = models; + msRest.addSerializationMixin(this); + } + +} + +module.exports = DataLakeStoreFileSystemManagementClient; +module.exports['default'] = DataLakeStoreFileSystemManagementClient; +module.exports.DataLakeStoreFileSystemManagementClient = DataLakeStoreFileSystemManagementClient; +module.exports.DataLakeStoreFileSystemManagementModels = models; diff --git a/lib/services/datalake.Store/lib/filesystem/models/aclStatus.js b/lib/services/datalake.Store/lib/filesystem/models/aclStatus.js new file mode 100644 index 0000000000..5c33de6971 --- /dev/null +++ b/lib/services/datalake.Store/lib/filesystem/models/aclStatus.js @@ -0,0 +1,95 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Data Lake Store file or directory Access Control List information. + * + */ +class AclStatus { + /** + * Create a AclStatus. + * @property {array} [entries] the list of ACLSpec entries on a file or + * directory. + * @property {string} [group] the group owner, an AAD Object ID. + * @property {string} [owner] the user owner, an AAD Object ID. + * @property {string} [permission] The octal representation of the unnamed + * user, mask and other permissions. + * @property {boolean} [stickyBit] the indicator of whether the sticky bit is + * on or off. + */ + constructor() { + } + + /** + * Defines the metadata of AclStatus + * + * @returns {object} metadata of AclStatus + * + */ + mapper() { + return { + required: false, + serializedName: 'AclStatus', + type: { + name: 'Composite', + className: 'AclStatus', + modelProperties: { + entries: { + required: false, + serializedName: 'entries', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + group: { + required: false, + serializedName: 'group', + type: { + name: 'String' + } + }, + owner: { + required: false, + serializedName: 'owner', + type: { + name: 'String' + } + }, + permission: { + required: false, + serializedName: 'permission', + type: { + name: 'String' + } + }, + stickyBit: { + required: false, + readOnly: true, + serializedName: 'stickyBit', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = AclStatus; diff --git a/lib/services/datalake.Store/lib/filesystem/models/aclStatusResult.js b/lib/services/datalake.Store/lib/filesystem/models/aclStatusResult.js new file mode 100644 index 0000000000..45076aa4ab --- /dev/null +++ b/lib/services/datalake.Store/lib/filesystem/models/aclStatusResult.js @@ -0,0 +1,62 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Data Lake Store file or directory Access Control List information. + * + */ +class AclStatusResult { + /** + * Create a AclStatusResult. + * @property {object} [aclStatus] the AclStatus object for a given file or + * directory. + * @property {array} [aclStatus.entries] the list of ACLSpec entries on a + * file or directory. + * @property {string} [aclStatus.group] the group owner, an AAD Object ID. + * @property {string} [aclStatus.owner] the user owner, an AAD Object ID. + * @property {string} [aclStatus.permission] The octal representation of the + * unnamed user, mask and other permissions. + * @property {boolean} [aclStatus.stickyBit] the indicator of whether the + * sticky bit is on or off. + */ + constructor() { + } + + /** + * Defines the metadata of AclStatusResult + * + * @returns {object} metadata of AclStatusResult + * + */ + mapper() { + return { + required: false, + serializedName: 'AclStatusResult', + type: { + name: 'Composite', + className: 'AclStatusResult', + modelProperties: { + aclStatus: { + required: false, + serializedName: 'aclStatus', + type: { + name: 'Composite', + className: 'AclStatus' + } + } + } + } + }; + } +} + +module.exports = AclStatusResult; diff --git a/lib/services/datalake.Store/lib/filesystem/models/adlsAccessControlException.js b/lib/services/datalake.Store/lib/filesystem/models/adlsAccessControlException.js new file mode 100644 index 0000000000..bd8dfb50b9 --- /dev/null +++ b/lib/services/datalake.Store/lib/filesystem/models/adlsAccessControlException.js @@ -0,0 +1,79 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * A WebHDFS exception thrown indicating that access is denied due to + * insufficient permissions. Thrown when a 403 error response code is returned + * (forbidden). + * + * @extends models['AdlsRemoteException'] + */ +class AdlsAccessControlException extends models['AdlsRemoteException'] { + /** + * Create a AdlsAccessControlException. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of AdlsAccessControlException + * + * @returns {object} metadata of AdlsAccessControlException + * + */ + mapper() { + return { + required: false, + serializedName: 'AccessControlException', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'exception', + clientName: 'exception' + }, + uberParent: 'AdlsRemoteException', + className: 'AdlsAccessControlException', + modelProperties: { + javaClassName: { + required: false, + readOnly: true, + serializedName: 'javaClassName', + type: { + name: 'String' + } + }, + message: { + required: false, + readOnly: true, + serializedName: 'message', + type: { + name: 'String' + } + }, + exception: { + required: true, + serializedName: 'exception', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AdlsAccessControlException; diff --git a/lib/services/datalake.Store/lib/filesystem/models/adlsBadOffsetException.js b/lib/services/datalake.Store/lib/filesystem/models/adlsBadOffsetException.js new file mode 100644 index 0000000000..b37a11a3bb --- /dev/null +++ b/lib/services/datalake.Store/lib/filesystem/models/adlsBadOffsetException.js @@ -0,0 +1,79 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * A WebHDFS exception thrown indicating the append or read is from a bad + * offset. Thrown when a 400 error response code is returned for append and + * open operations (Bad request). + * + * @extends models['AdlsRemoteException'] + */ +class AdlsBadOffsetException extends models['AdlsRemoteException'] { + /** + * Create a AdlsBadOffsetException. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of AdlsBadOffsetException + * + * @returns {object} metadata of AdlsBadOffsetException + * + */ + mapper() { + return { + required: false, + serializedName: 'BadOffsetException', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'exception', + clientName: 'exception' + }, + uberParent: 'AdlsRemoteException', + className: 'AdlsBadOffsetException', + modelProperties: { + javaClassName: { + required: false, + readOnly: true, + serializedName: 'javaClassName', + type: { + name: 'String' + } + }, + message: { + required: false, + readOnly: true, + serializedName: 'message', + type: { + name: 'String' + } + }, + exception: { + required: true, + serializedName: 'exception', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AdlsBadOffsetException; diff --git a/lib/services/datalake.Store/lib/filesystem/models/adlsError.js b/lib/services/datalake.Store/lib/filesystem/models/adlsError.js new file mode 100644 index 0000000000..afee6cdaca --- /dev/null +++ b/lib/services/datalake.Store/lib/filesystem/models/adlsError.js @@ -0,0 +1,67 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Data Lake Store filesystem error containing a specific WebHDFS exception. + * + */ +class AdlsError { + /** + * Create a AdlsError. + * @property {object} [remoteException] the object representing the actual + * WebHDFS exception being returned. + * @property {string} [remoteException.javaClassName] the full class package + * name for the exception thrown, such as + * 'java.lang.IllegalArgumentException'. + * @property {string} [remoteException.message] the message associated with + * the exception that was thrown, such as 'Invalid value for webhdfs + * parameter "permission":...'. + * @property {string} [remoteException.exception] Polymorphic Discriminator + */ + constructor() { + } + + /** + * Defines the metadata of AdlsError + * + * @returns {object} metadata of AdlsError + * + */ + mapper() { + return { + required: false, + serializedName: 'AdlsError', + type: { + name: 'Composite', + className: 'AdlsError', + modelProperties: { + remoteException: { + required: false, + readOnly: true, + serializedName: 'remoteException', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'exception', + clientName: 'exception' + }, + uberParent: 'AdlsRemoteException', + className: 'AdlsRemoteException' + } + } + } + } + }; + } +} + +module.exports = AdlsError; diff --git a/lib/services/datalake.Store/lib/filesystem/models/adlsFileAlreadyExistsException.js b/lib/services/datalake.Store/lib/filesystem/models/adlsFileAlreadyExistsException.js new file mode 100644 index 0000000000..322a120690 --- /dev/null +++ b/lib/services/datalake.Store/lib/filesystem/models/adlsFileAlreadyExistsException.js @@ -0,0 +1,78 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * A WebHDFS exception thrown indicating the file or folder already exists. + * Thrown when a 403 error response code is returned (forbidden). + * + * @extends models['AdlsRemoteException'] + */ +class AdlsFileAlreadyExistsException extends models['AdlsRemoteException'] { + /** + * Create a AdlsFileAlreadyExistsException. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of AdlsFileAlreadyExistsException + * + * @returns {object} metadata of AdlsFileAlreadyExistsException + * + */ + mapper() { + return { + required: false, + serializedName: 'FileAlreadyExistsException', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'exception', + clientName: 'exception' + }, + uberParent: 'AdlsRemoteException', + className: 'AdlsFileAlreadyExistsException', + modelProperties: { + javaClassName: { + required: false, + readOnly: true, + serializedName: 'javaClassName', + type: { + name: 'String' + } + }, + message: { + required: false, + readOnly: true, + serializedName: 'message', + type: { + name: 'String' + } + }, + exception: { + required: true, + serializedName: 'exception', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AdlsFileAlreadyExistsException; diff --git a/lib/services/datalake.Store/lib/filesystem/models/adlsFileNotFoundException.js b/lib/services/datalake.Store/lib/filesystem/models/adlsFileNotFoundException.js new file mode 100644 index 0000000000..fc7dedb0b7 --- /dev/null +++ b/lib/services/datalake.Store/lib/filesystem/models/adlsFileNotFoundException.js @@ -0,0 +1,78 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * A WebHDFS exception thrown indicating the file or folder could not be found. + * Thrown when a 404 error response code is returned (not found). + * + * @extends models['AdlsRemoteException'] + */ +class AdlsFileNotFoundException extends models['AdlsRemoteException'] { + /** + * Create a AdlsFileNotFoundException. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of AdlsFileNotFoundException + * + * @returns {object} metadata of AdlsFileNotFoundException + * + */ + mapper() { + return { + required: false, + serializedName: 'FileNotFoundException', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'exception', + clientName: 'exception' + }, + uberParent: 'AdlsRemoteException', + className: 'AdlsFileNotFoundException', + modelProperties: { + javaClassName: { + required: false, + readOnly: true, + serializedName: 'javaClassName', + type: { + name: 'String' + } + }, + message: { + required: false, + readOnly: true, + serializedName: 'message', + type: { + name: 'String' + } + }, + exception: { + required: true, + serializedName: 'exception', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AdlsFileNotFoundException; diff --git a/lib/services/datalake.Store/lib/filesystem/models/adlsIOException.js b/lib/services/datalake.Store/lib/filesystem/models/adlsIOException.js new file mode 100644 index 0000000000..144d991c95 --- /dev/null +++ b/lib/services/datalake.Store/lib/filesystem/models/adlsIOException.js @@ -0,0 +1,78 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * A WebHDFS exception thrown indicating there was an IO (read or write) error. + * Thrown when a 403 error response code is returned (forbidden). + * + * @extends models['AdlsRemoteException'] + */ +class AdlsIOException extends models['AdlsRemoteException'] { + /** + * Create a AdlsIOException. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of AdlsIOException + * + * @returns {object} metadata of AdlsIOException + * + */ + mapper() { + return { + required: false, + serializedName: 'IOException', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'exception', + clientName: 'exception' + }, + uberParent: 'AdlsRemoteException', + className: 'AdlsIOException', + modelProperties: { + javaClassName: { + required: false, + readOnly: true, + serializedName: 'javaClassName', + type: { + name: 'String' + } + }, + message: { + required: false, + readOnly: true, + serializedName: 'message', + type: { + name: 'String' + } + }, + exception: { + required: true, + serializedName: 'exception', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AdlsIOException; diff --git a/lib/services/datalake.Store/lib/filesystem/models/adlsIllegalArgumentException.js b/lib/services/datalake.Store/lib/filesystem/models/adlsIllegalArgumentException.js new file mode 100644 index 0000000000..3487ead2f7 --- /dev/null +++ b/lib/services/datalake.Store/lib/filesystem/models/adlsIllegalArgumentException.js @@ -0,0 +1,78 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * A WebHDFS exception thrown indicating that one more arguments is incorrect. + * Thrown when a 400 error response code is returned (bad request). + * + * @extends models['AdlsRemoteException'] + */ +class AdlsIllegalArgumentException extends models['AdlsRemoteException'] { + /** + * Create a AdlsIllegalArgumentException. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of AdlsIllegalArgumentException + * + * @returns {object} metadata of AdlsIllegalArgumentException + * + */ + mapper() { + return { + required: false, + serializedName: 'IllegalArgumentException', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'exception', + clientName: 'exception' + }, + uberParent: 'AdlsRemoteException', + className: 'AdlsIllegalArgumentException', + modelProperties: { + javaClassName: { + required: false, + readOnly: true, + serializedName: 'javaClassName', + type: { + name: 'String' + } + }, + message: { + required: false, + readOnly: true, + serializedName: 'message', + type: { + name: 'String' + } + }, + exception: { + required: true, + serializedName: 'exception', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AdlsIllegalArgumentException; diff --git a/lib/services/datalake.Store/lib/filesystem/models/adlsRemoteException.js b/lib/services/datalake.Store/lib/filesystem/models/adlsRemoteException.js new file mode 100644 index 0000000000..63bc60d088 --- /dev/null +++ b/lib/services/datalake.Store/lib/filesystem/models/adlsRemoteException.js @@ -0,0 +1,80 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Data Lake Store filesystem exception based on the WebHDFS definition for + * RemoteExceptions. This is a WebHDFS 'catch all' exception + * + */ +class AdlsRemoteException { + /** + * Create a AdlsRemoteException. + * @property {string} [javaClassName] the full class package name for the + * exception thrown, such as 'java.lang.IllegalArgumentException'. + * @property {string} [message] the message associated with the exception + * that was thrown, such as 'Invalid value for webhdfs parameter + * "permission":...'. + * @property {string} exception Polymorphic Discriminator + */ + constructor() { + } + + /** + * Defines the metadata of AdlsRemoteException + * + * @returns {object} metadata of AdlsRemoteException + * + */ + mapper() { + return { + required: false, + serializedName: 'AdlsRemoteException', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'exception', + clientName: 'exception' + }, + uberParent: 'AdlsRemoteException', + className: 'AdlsRemoteException', + modelProperties: { + javaClassName: { + required: false, + readOnly: true, + serializedName: 'javaClassName', + type: { + name: 'String' + } + }, + message: { + required: false, + readOnly: true, + serializedName: 'message', + type: { + name: 'String' + } + }, + exception: { + required: true, + serializedName: 'exception', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AdlsRemoteException; diff --git a/lib/services/datalake.Store/lib/filesystem/models/adlsRuntimeException.js b/lib/services/datalake.Store/lib/filesystem/models/adlsRuntimeException.js new file mode 100644 index 0000000000..fa925f17ec --- /dev/null +++ b/lib/services/datalake.Store/lib/filesystem/models/adlsRuntimeException.js @@ -0,0 +1,79 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * A WebHDFS exception thrown when an unexpected error occurs during an + * operation. Thrown when a 500 error response code is returned (Internal + * server error). + * + * @extends models['AdlsRemoteException'] + */ +class AdlsRuntimeException extends models['AdlsRemoteException'] { + /** + * Create a AdlsRuntimeException. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of AdlsRuntimeException + * + * @returns {object} metadata of AdlsRuntimeException + * + */ + mapper() { + return { + required: false, + serializedName: 'RuntimeException', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'exception', + clientName: 'exception' + }, + uberParent: 'AdlsRemoteException', + className: 'AdlsRuntimeException', + modelProperties: { + javaClassName: { + required: false, + readOnly: true, + serializedName: 'javaClassName', + type: { + name: 'String' + } + }, + message: { + required: false, + readOnly: true, + serializedName: 'message', + type: { + name: 'String' + } + }, + exception: { + required: true, + serializedName: 'exception', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AdlsRuntimeException; diff --git a/lib/services/datalake.Store/lib/filesystem/models/adlsSecurityException.js b/lib/services/datalake.Store/lib/filesystem/models/adlsSecurityException.js new file mode 100644 index 0000000000..7bef0f8275 --- /dev/null +++ b/lib/services/datalake.Store/lib/filesystem/models/adlsSecurityException.js @@ -0,0 +1,78 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * A WebHDFS exception thrown indicating that access is denied. Thrown when a + * 401 error response code is returned (Unauthorized). + * + * @extends models['AdlsRemoteException'] + */ +class AdlsSecurityException extends models['AdlsRemoteException'] { + /** + * Create a AdlsSecurityException. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of AdlsSecurityException + * + * @returns {object} metadata of AdlsSecurityException + * + */ + mapper() { + return { + required: false, + serializedName: 'SecurityException', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'exception', + clientName: 'exception' + }, + uberParent: 'AdlsRemoteException', + className: 'AdlsSecurityException', + modelProperties: { + javaClassName: { + required: false, + readOnly: true, + serializedName: 'javaClassName', + type: { + name: 'String' + } + }, + message: { + required: false, + readOnly: true, + serializedName: 'message', + type: { + name: 'String' + } + }, + exception: { + required: true, + serializedName: 'exception', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AdlsSecurityException; diff --git a/lib/services/datalake.Store/lib/filesystem/models/adlsThrottledException.js b/lib/services/datalake.Store/lib/filesystem/models/adlsThrottledException.js new file mode 100644 index 0000000000..f06eca6765 --- /dev/null +++ b/lib/services/datalake.Store/lib/filesystem/models/adlsThrottledException.js @@ -0,0 +1,79 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * A WebHDFS exception thrown indicating that the request is being throttled. + * Reducing the number of requests or request size helps to mitigate this + * error. + * + * @extends models['AdlsRemoteException'] + */ +class AdlsThrottledException extends models['AdlsRemoteException'] { + /** + * Create a AdlsThrottledException. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of AdlsThrottledException + * + * @returns {object} metadata of AdlsThrottledException + * + */ + mapper() { + return { + required: false, + serializedName: 'ThrottledException', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'exception', + clientName: 'exception' + }, + uberParent: 'AdlsRemoteException', + className: 'AdlsThrottledException', + modelProperties: { + javaClassName: { + required: false, + readOnly: true, + serializedName: 'javaClassName', + type: { + name: 'String' + } + }, + message: { + required: false, + readOnly: true, + serializedName: 'message', + type: { + name: 'String' + } + }, + exception: { + required: true, + serializedName: 'exception', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AdlsThrottledException; diff --git a/lib/services/datalake.Store/lib/filesystem/models/adlsUnsupportedOperationException.js b/lib/services/datalake.Store/lib/filesystem/models/adlsUnsupportedOperationException.js new file mode 100644 index 0000000000..9bedfacb32 --- /dev/null +++ b/lib/services/datalake.Store/lib/filesystem/models/adlsUnsupportedOperationException.js @@ -0,0 +1,78 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * A WebHDFS exception thrown indicating that the requested operation is not + * supported. Thrown when a 400 error response code is returned (bad request). + * + * @extends models['AdlsRemoteException'] + */ +class AdlsUnsupportedOperationException extends models['AdlsRemoteException'] { + /** + * Create a AdlsUnsupportedOperationException. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of AdlsUnsupportedOperationException + * + * @returns {object} metadata of AdlsUnsupportedOperationException + * + */ + mapper() { + return { + required: false, + serializedName: 'UnsupportedOperationException', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'exception', + clientName: 'exception' + }, + uberParent: 'AdlsRemoteException', + className: 'AdlsUnsupportedOperationException', + modelProperties: { + javaClassName: { + required: false, + readOnly: true, + serializedName: 'javaClassName', + type: { + name: 'String' + } + }, + message: { + required: false, + readOnly: true, + serializedName: 'message', + type: { + name: 'String' + } + }, + exception: { + required: true, + serializedName: 'exception', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AdlsUnsupportedOperationException; diff --git a/lib/services/datalake.Store/lib/filesystem/models/contentSummary.js b/lib/services/datalake.Store/lib/filesystem/models/contentSummary.js new file mode 100644 index 0000000000..0a28148049 --- /dev/null +++ b/lib/services/datalake.Store/lib/filesystem/models/contentSummary.js @@ -0,0 +1,80 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Data Lake Store content summary information + * + */ +class ContentSummary { + /** + * Create a ContentSummary. + * @property {number} [directoryCount] the number of directories. + * @property {number} [fileCount] the number of files. + * @property {number} [length] the number of bytes used by the content. + * @property {number} [spaceConsumed] the disk space consumed by the content. + */ + constructor() { + } + + /** + * Defines the metadata of ContentSummary + * + * @returns {object} metadata of ContentSummary + * + */ + mapper() { + return { + required: false, + serializedName: 'ContentSummary', + type: { + name: 'Composite', + className: 'ContentSummary', + modelProperties: { + directoryCount: { + required: false, + readOnly: true, + serializedName: 'directoryCount', + type: { + name: 'Number' + } + }, + fileCount: { + required: false, + readOnly: true, + serializedName: 'fileCount', + type: { + name: 'Number' + } + }, + length: { + required: false, + readOnly: true, + serializedName: 'length', + type: { + name: 'Number' + } + }, + spaceConsumed: { + required: false, + readOnly: true, + serializedName: 'spaceConsumed', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = ContentSummary; diff --git a/lib/services/datalake.Store/lib/filesystem/models/contentSummaryResult.js b/lib/services/datalake.Store/lib/filesystem/models/contentSummaryResult.js new file mode 100644 index 0000000000..33569c05d6 --- /dev/null +++ b/lib/services/datalake.Store/lib/filesystem/models/contentSummaryResult.js @@ -0,0 +1,62 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Data Lake Store filesystem content summary information response. + * + */ +class ContentSummaryResult { + /** + * Create a ContentSummaryResult. + * @property {object} [contentSummary] the content summary for the specified + * path + * @property {number} [contentSummary.directoryCount] the number of + * directories. + * @property {number} [contentSummary.fileCount] the number of files. + * @property {number} [contentSummary.length] the number of bytes used by the + * content. + * @property {number} [contentSummary.spaceConsumed] the disk space consumed + * by the content. + */ + constructor() { + } + + /** + * Defines the metadata of ContentSummaryResult + * + * @returns {object} metadata of ContentSummaryResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ContentSummaryResult', + type: { + name: 'Composite', + className: 'ContentSummaryResult', + modelProperties: { + contentSummary: { + required: false, + readOnly: true, + serializedName: 'contentSummary', + type: { + name: 'Composite', + className: 'ContentSummary' + } + } + } + } + }; + } +} + +module.exports = ContentSummaryResult; diff --git a/lib/services/datalake.Store/lib/filesystem/models/fileOperationResult.js b/lib/services/datalake.Store/lib/filesystem/models/fileOperationResult.js new file mode 100644 index 0000000000..adab3af571 --- /dev/null +++ b/lib/services/datalake.Store/lib/filesystem/models/fileOperationResult.js @@ -0,0 +1,54 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The result of the request or operation. + * + */ +class FileOperationResult { + /** + * Create a FileOperationResult. + * @property {boolean} [operationResult] the result of the operation or + * request. + */ + constructor() { + } + + /** + * Defines the metadata of FileOperationResult + * + * @returns {object} metadata of FileOperationResult + * + */ + mapper() { + return { + required: false, + serializedName: 'FileOperationResult', + type: { + name: 'Composite', + className: 'FileOperationResult', + modelProperties: { + operationResult: { + required: false, + readOnly: true, + serializedName: 'boolean', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = FileOperationResult; diff --git a/lib/services/datalake.Store/lib/filesystem/models/fileStatusProperties.js b/lib/services/datalake.Store/lib/filesystem/models/fileStatusProperties.js new file mode 100644 index 0000000000..73fed29d22 --- /dev/null +++ b/lib/services/datalake.Store/lib/filesystem/models/fileStatusProperties.js @@ -0,0 +1,149 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Data Lake Store file or directory information. + * + */ +class FileStatusProperties { + /** + * Create a FileStatusProperties. + * @property {number} [accessTime] the last access time as ticks since the + * epoch. + * @property {number} [blockSize] the block size for the file. + * @property {number} [expirationTime] Gets the expiration time, if any, as + * ticks since the epoch. If the value is 0 or DateTime.MaxValue there is no + * expiration. + * @property {string} [group] the group owner. + * @property {number} [length] the number of bytes in a file. + * @property {number} [modificationTime] the modification time as ticks since + * the epoch. + * @property {string} [owner] the user who is the owner. + * @property {string} [pathSuffix] the path suffix. + * @property {string} [permission] the permission represented as an string. + * @property {string} [type] the type of the path object. Possible values + * include: 'FILE', 'DIRECTORY' + * @property {boolean} [aclBit] flag to indicate if extended acls are enabled + */ + constructor() { + } + + /** + * Defines the metadata of FileStatusProperties + * + * @returns {object} metadata of FileStatusProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'FileStatusProperties', + type: { + name: 'Composite', + className: 'FileStatusProperties', + modelProperties: { + accessTime: { + required: false, + readOnly: true, + serializedName: 'accessTime', + type: { + name: 'Number' + } + }, + blockSize: { + required: false, + readOnly: true, + serializedName: 'blockSize', + type: { + name: 'Number' + } + }, + expirationTime: { + required: false, + readOnly: true, + serializedName: 'msExpirationTime', + type: { + name: 'Number' + } + }, + group: { + required: false, + readOnly: true, + serializedName: 'group', + type: { + name: 'String' + } + }, + length: { + required: false, + readOnly: true, + serializedName: 'length', + type: { + name: 'Number' + } + }, + modificationTime: { + required: false, + readOnly: true, + serializedName: 'modificationTime', + type: { + name: 'Number' + } + }, + owner: { + required: false, + readOnly: true, + serializedName: 'owner', + type: { + name: 'String' + } + }, + pathSuffix: { + required: false, + readOnly: true, + serializedName: 'pathSuffix', + type: { + name: 'String' + } + }, + permission: { + required: false, + readOnly: true, + serializedName: 'permission', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'Enum', + allowedValues: [ 'FILE', 'DIRECTORY' ] + } + }, + aclBit: { + required: false, + readOnly: true, + serializedName: 'aclBit', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = FileStatusProperties; diff --git a/lib/services/datalake.Store/lib/filesystem/models/fileStatusResult.js b/lib/services/datalake.Store/lib/filesystem/models/fileStatusResult.js new file mode 100644 index 0000000000..5940e4c7a8 --- /dev/null +++ b/lib/services/datalake.Store/lib/filesystem/models/fileStatusResult.js @@ -0,0 +1,73 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Data Lake Store filesystem file status information response. + * + */ +class FileStatusResult { + /** + * Create a FileStatusResult. + * @property {object} [fileStatus] the file status object associated with the + * specified path. + * @property {number} [fileStatus.accessTime] the last access time as ticks + * since the epoch. + * @property {number} [fileStatus.blockSize] the block size for the file. + * @property {number} [fileStatus.expirationTime] Gets the expiration time, + * if any, as ticks since the epoch. If the value is 0 or DateTime.MaxValue + * there is no expiration. + * @property {string} [fileStatus.group] the group owner. + * @property {number} [fileStatus.length] the number of bytes in a file. + * @property {number} [fileStatus.modificationTime] the modification time as + * ticks since the epoch. + * @property {string} [fileStatus.owner] the user who is the owner. + * @property {string} [fileStatus.pathSuffix] the path suffix. + * @property {string} [fileStatus.permission] the permission represented as + * an string. + * @property {string} [fileStatus.type] the type of the path object. Possible + * values include: 'FILE', 'DIRECTORY' + * @property {boolean} [fileStatus.aclBit] flag to indicate if extended acls + * are enabled + */ + constructor() { + } + + /** + * Defines the metadata of FileStatusResult + * + * @returns {object} metadata of FileStatusResult + * + */ + mapper() { + return { + required: false, + serializedName: 'FileStatusResult', + type: { + name: 'Composite', + className: 'FileStatusResult', + modelProperties: { + fileStatus: { + required: false, + readOnly: true, + serializedName: 'fileStatus', + type: { + name: 'Composite', + className: 'FileStatusProperties' + } + } + } + } + }; + } +} + +module.exports = FileStatusResult; diff --git a/lib/services/datalake.Store/lib/filesystem/models/fileStatuses.js b/lib/services/datalake.Store/lib/filesystem/models/fileStatuses.js new file mode 100644 index 0000000000..c73fa30d0b --- /dev/null +++ b/lib/services/datalake.Store/lib/filesystem/models/fileStatuses.js @@ -0,0 +1,62 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Data Lake Store file status list information. + * + */ +class FileStatuses { + /** + * Create a FileStatuses. + * @property {array} [fileStatus] the object containing the list of + * properties of the files. + */ + constructor() { + } + + /** + * Defines the metadata of FileStatuses + * + * @returns {object} metadata of FileStatuses + * + */ + mapper() { + return { + required: false, + serializedName: 'FileStatuses', + type: { + name: 'Composite', + className: 'FileStatuses', + modelProperties: { + fileStatus: { + required: false, + readOnly: true, + serializedName: 'fileStatus', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'FileStatusPropertiesElementType', + type: { + name: 'Composite', + className: 'FileStatusProperties' + } + } + } + } + } + } + }; + } +} + +module.exports = FileStatuses; diff --git a/lib/services/datalake.Store/lib/filesystem/models/fileStatusesResult.js b/lib/services/datalake.Store/lib/filesystem/models/fileStatusesResult.js new file mode 100644 index 0000000000..bff868c5f7 --- /dev/null +++ b/lib/services/datalake.Store/lib/filesystem/models/fileStatusesResult.js @@ -0,0 +1,57 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Data Lake Store filesystem file status list information response. + * + */ +class FileStatusesResult { + /** + * Create a FileStatusesResult. + * @property {object} [fileStatuses] the object representing the list of file + * statuses. + * @property {array} [fileStatuses.fileStatus] the object containing the list + * of properties of the files. + */ + constructor() { + } + + /** + * Defines the metadata of FileStatusesResult + * + * @returns {object} metadata of FileStatusesResult + * + */ + mapper() { + return { + required: false, + serializedName: 'FileStatusesResult', + type: { + name: 'Composite', + className: 'FileStatusesResult', + modelProperties: { + fileStatuses: { + required: false, + readOnly: true, + serializedName: 'fileStatuses', + type: { + name: 'Composite', + className: 'FileStatuses' + } + } + } + } + }; + } +} + +module.exports = FileStatusesResult; diff --git a/lib/services/datalake.Store/lib/filesystem/models/index.d.ts b/lib/services/datalake.Store/lib/filesystem/models/index.d.ts new file mode 100644 index 0000000000..2055076f20 --- /dev/null +++ b/lib/services/datalake.Store/lib/filesystem/models/index.d.ts @@ -0,0 +1,276 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { BaseResource, CloudError } from "ms-rest-azure"; +import * as moment from "moment"; + +export { + + BaseResource, + CloudError +}; + +/** + * The result of the request or operation. + */ +export interface FileOperationResult { + /** + * the result of the operation or request. + */ + readonly operationResult?: boolean; +} + +/** + * Data Lake Store file or directory Access Control List information. + */ +export interface AclStatus { + /** + * the list of ACLSpec entries on a file or directory. + */ + entries?: string[]; + /** + * the group owner, an AAD Object ID. + */ + group?: string; + /** + * the user owner, an AAD Object ID. + */ + owner?: string; + /** + * The octal representation of the unnamed user, mask and other permissions. + */ + permission?: string; + /** + * the indicator of whether the sticky bit is on or off. + */ + readonly stickyBit?: boolean; +} + +/** + * Data Lake Store file or directory Access Control List information. + */ +export interface AclStatusResult { + /** + * the AclStatus object for a given file or directory. + */ + aclStatus?: AclStatus; +} + +/** + * Data Lake Store content summary information + */ +export interface ContentSummary { + /** + * the number of directories. + */ + readonly directoryCount?: number; + /** + * the number of files. + */ + readonly fileCount?: number; + /** + * the number of bytes used by the content. + */ + readonly length?: number; + /** + * the disk space consumed by the content. + */ + readonly spaceConsumed?: number; +} + +/** + * Data Lake Store filesystem content summary information response. + */ +export interface ContentSummaryResult { + /** + * the content summary for the specified path + */ + readonly contentSummary?: ContentSummary; +} + +/** + * Data Lake Store file or directory information. + */ +export interface FileStatusProperties { + /** + * the last access time as ticks since the epoch. + */ + readonly accessTime?: number; + /** + * the block size for the file. + */ + readonly blockSize?: number; + /** + * Gets the expiration time, if any, as ticks since the epoch. If the value is 0 or + * DateTime.MaxValue there is no expiration. + */ + readonly expirationTime?: number; + /** + * the group owner. + */ + readonly group?: string; + /** + * the number of bytes in a file. + */ + readonly length?: number; + /** + * the modification time as ticks since the epoch. + */ + readonly modificationTime?: number; + /** + * the user who is the owner. + */ + readonly owner?: string; + /** + * the path suffix. + */ + readonly pathSuffix?: string; + /** + * the permission represented as an string. + */ + readonly permission?: string; + /** + * the type of the path object. Possible values include: 'FILE', 'DIRECTORY' + */ + readonly type?: string; + /** + * flag to indicate if extended acls are enabled + */ + readonly aclBit?: boolean; +} + +/** + * Data Lake Store file status list information. + */ +export interface FileStatuses { + /** + * the object containing the list of properties of the files. + */ + readonly fileStatus?: FileStatusProperties[]; +} + +/** + * Data Lake Store filesystem file status list information response. + */ +export interface FileStatusesResult { + /** + * the object representing the list of file statuses. + */ + readonly fileStatuses?: FileStatuses; +} + +/** + * Data Lake Store filesystem file status information response. + */ +export interface FileStatusResult { + /** + * the file status object associated with the specified path. + */ + readonly fileStatus?: FileStatusProperties; +} + +/** + * Data Lake Store filesystem exception based on the WebHDFS definition for RemoteExceptions. This + * is a WebHDFS 'catch all' exception + */ +export interface AdlsRemoteException { + /** + * the full class package name for the exception thrown, such as + * 'java.lang.IllegalArgumentException'. + */ + readonly javaClassName?: string; + /** + * the message associated with the exception that was thrown, such as 'Invalid value for webhdfs + * parameter "permission":...'. + */ + readonly message?: string; + /** + * Polymorphic Discriminator + */ + exception: string; +} + +/** + * A WebHDFS exception thrown indicating that one more arguments is incorrect. Thrown when a 400 + * error response code is returned (bad request). + */ +export interface AdlsIllegalArgumentException extends AdlsRemoteException { +} + +/** + * A WebHDFS exception thrown indicating that the requested operation is not supported. Thrown when + * a 400 error response code is returned (bad request). + */ +export interface AdlsUnsupportedOperationException extends AdlsRemoteException { +} + +/** + * A WebHDFS exception thrown indicating that access is denied. Thrown when a 401 error response + * code is returned (Unauthorized). + */ +export interface AdlsSecurityException extends AdlsRemoteException { +} + +/** + * A WebHDFS exception thrown indicating there was an IO (read or write) error. Thrown when a 403 + * error response code is returned (forbidden). + */ +export interface AdlsIOException extends AdlsRemoteException { +} + +/** + * A WebHDFS exception thrown indicating the file or folder could not be found. Thrown when a 404 + * error response code is returned (not found). + */ +export interface AdlsFileNotFoundException extends AdlsRemoteException { +} + +/** + * A WebHDFS exception thrown indicating the file or folder already exists. Thrown when a 403 error + * response code is returned (forbidden). + */ +export interface AdlsFileAlreadyExistsException extends AdlsRemoteException { +} + +/** + * A WebHDFS exception thrown indicating the append or read is from a bad offset. Thrown when a 400 + * error response code is returned for append and open operations (Bad request). + */ +export interface AdlsBadOffsetException extends AdlsRemoteException { +} + +/** + * A WebHDFS exception thrown when an unexpected error occurs during an operation. Thrown when a + * 500 error response code is returned (Internal server error). + */ +export interface AdlsRuntimeException extends AdlsRemoteException { +} + +/** + * A WebHDFS exception thrown indicating that access is denied due to insufficient permissions. + * Thrown when a 403 error response code is returned (forbidden). + */ +export interface AdlsAccessControlException extends AdlsRemoteException { +} + +/** + * A WebHDFS exception thrown indicating that the request is being throttled. Reducing the number + * of requests or request size helps to mitigate this error. + */ +export interface AdlsThrottledException extends AdlsRemoteException { +} + +/** + * Data Lake Store filesystem error containing a specific WebHDFS exception. + */ +export interface AdlsError { + /** + * the object representing the actual WebHDFS exception being returned. + */ + readonly remoteException?: AdlsRemoteException; +} diff --git a/lib/services/datalake.Store/lib/filesystem/models/index.js b/lib/services/datalake.Store/lib/filesystem/models/index.js new file mode 100644 index 0000000000..010fcdf236 --- /dev/null +++ b/lib/services/datalake.Store/lib/filesystem/models/index.js @@ -0,0 +1,54 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +var msRestAzure = require('ms-rest-azure'); + +exports.BaseResource = msRestAzure.BaseResource; +exports.CloudError = msRestAzure.CloudError; +exports.FileOperationResult = require('./fileOperationResult'); +exports.AclStatus = require('./aclStatus'); +exports.AclStatusResult = require('./aclStatusResult'); +exports.ContentSummary = require('./contentSummary'); +exports.ContentSummaryResult = require('./contentSummaryResult'); +exports.FileStatusProperties = require('./fileStatusProperties'); +exports.FileStatuses = require('./fileStatuses'); +exports.FileStatusesResult = require('./fileStatusesResult'); +exports.FileStatusResult = require('./fileStatusResult'); +exports.AdlsRemoteException = require('./adlsRemoteException'); +exports.AdlsIllegalArgumentException = require('./adlsIllegalArgumentException'); +exports.AdlsUnsupportedOperationException = require('./adlsUnsupportedOperationException'); +exports.AdlsSecurityException = require('./adlsSecurityException'); +exports.AdlsIOException = require('./adlsIOException'); +exports.AdlsFileNotFoundException = require('./adlsFileNotFoundException'); +exports.AdlsFileAlreadyExistsException = require('./adlsFileAlreadyExistsException'); +exports.AdlsBadOffsetException = require('./adlsBadOffsetException'); +exports.AdlsRuntimeException = require('./adlsRuntimeException'); +exports.AdlsAccessControlException = require('./adlsAccessControlException'); +exports.AdlsThrottledException = require('./adlsThrottledException'); +exports.AdlsError = require('./adlsError'); +exports.discriminators = { + 'AdlsRemoteException.IllegalArgumentException' : exports.AdlsIllegalArgumentException, + 'AdlsRemoteException.UnsupportedOperationException' : exports.AdlsUnsupportedOperationException, + 'AdlsRemoteException.SecurityException' : exports.AdlsSecurityException, + 'AdlsRemoteException.IOException' : exports.AdlsIOException, + 'AdlsRemoteException.FileNotFoundException' : exports.AdlsFileNotFoundException, + 'AdlsRemoteException.FileAlreadyExistsException' : exports.AdlsFileAlreadyExistsException, + 'AdlsRemoteException.BadOffsetException' : exports.AdlsBadOffsetException, + 'AdlsRemoteException.RuntimeException' : exports.AdlsRuntimeException, + 'AdlsRemoteException.AccessControlException' : exports.AdlsAccessControlException, + 'AdlsRemoteException.ThrottledException' : exports.AdlsThrottledException, + 'AdlsRemoteException' : exports.AdlsRemoteException +}; diff --git a/lib/services/datalake.Store/lib/filesystem/operations/fileSystem.js b/lib/services/datalake.Store/lib/filesystem/operations/fileSystem.js new file mode 100644 index 0000000000..2d288d3dc7 --- /dev/null +++ b/lib/services/datalake.Store/lib/filesystem/operations/fileSystem.js @@ -0,0 +1,5855 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Sets or removes the expiration time on the specified file. This operation + * can only be executed against files. Folders are not supported. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file on which to set or remove the expiration time. + * + * @param {string} expiryOption Indicates the type of expiration to use for the + * file: 1. NeverExpire: ExpireTime is ignored. 2. RelativeToNow: ExpireTime is + * an integer in milliseconds representing the expiration date relative to when + * file expiration is updated. 3. RelativeToCreationDate: ExpireTime is an + * integer in milliseconds representing the expiration date relative to file + * creation. 4. Absolute: ExpireTime is an integer in milliseconds, as a Unix + * timestamp relative to 1/1/1970 00:00:00. Possible values include: + * 'NeverExpire', 'RelativeToNow', 'RelativeToCreationDate', 'Absolute' + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.expireTime] The time that the file will expire, + * corresponding to the ExpiryOption that was set. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _setFileExpiry(accountName, path, expiryOption, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let expireTime = (options && options.expireTime !== undefined) ? options.expireTime : undefined; + let op = 'SETEXPIRY'; + // Validate + try { + if (accountName === null || accountName === undefined || typeof accountName.valueOf() !== 'string') { + throw new Error('accountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.adlsFileSystemDnsSuffix === null || this.client.adlsFileSystemDnsSuffix === undefined || typeof this.client.adlsFileSystemDnsSuffix.valueOf() !== 'string') { + throw new Error('this.client.adlsFileSystemDnsSuffix cannot be null or undefined and it must be of type string.'); + } + if (path === null || path === undefined || typeof path.valueOf() !== 'string') { + throw new Error('path cannot be null or undefined and it must be of type string.'); + } + if (expiryOption) { + let allowedValues = [ 'NeverExpire', 'RelativeToNow', 'RelativeToCreationDate', 'Absolute' ]; + if (!allowedValues.some( function(item) { return item === expiryOption; })) { + throw new Error(expiryOption + ' is not a valid value. The valid values are: ' + allowedValues); + } + } else { + throw new Error('expiryOption cannot be null or undefined.'); + } + if (expireTime !== null && expireTime !== undefined && typeof expireTime !== 'number') { + throw new Error('expireTime must be of type number.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'WebHdfsExt/{path}'; + requestUrl = requestUrl.replace('{accountName}', accountName); + requestUrl = requestUrl.replace('{adlsFileSystemDnsSuffix}', this.client.adlsFileSystemDnsSuffix); + requestUrl = requestUrl.replace('{path}', encodeURIComponent(path)); + let queryParameters = []; + queryParameters.push('expiryOption=' + encodeURIComponent(expiryOption)); + if (expireTime !== null && expireTime !== undefined) { + queryParameters.push('expireTime=' + encodeURIComponent(expireTime.toString())); + } + queryParameters.push('op=' + encodeURIComponent(op)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['AdlsError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Appends to the specified file, optionally first creating the file if it does + * not yet exist. This method supports multiple concurrent appends to the file. + * NOTE: The target must not contain data added by Create or normal (serial) + * Append. ConcurrentAppend and Append cannot be used interchangeably; once a + * target file has been modified using either of these append options, the + * other append option cannot be used on the target file. ConcurrentAppend does + * not guarantee order and can result in duplicated data landing in the target + * file. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file to which to append using concurrent append. + * + * @param {object} streamContents The file contents to include when appending + * to the file. The maximum content size is 4MB. For content larger than 4MB + * you must append the content in 4MB chunks. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.appendMode] Indicates the concurrent append call + * should create the file if it doesn't exist or just open the existing file + * for append. Possible values include: 'autocreate' + * + * @param {string} [options.syncFlag] Optionally indicates what to do after + * completion of the concurrent append. DATA indicates that more data will be + * sent immediately by the client, the file handle should remain open/locked, + * and file metadata (including file length, last modified time) should NOT get + * updated. METADATA indicates that more data will be sent immediately by the + * client, the file handle should remain open/locked, and file metadata should + * get updated. CLOSE indicates that the client is done sending data, the file + * handle should be closed/unlocked, and file metadata should get updated. + * Possible values include: 'DATA', 'METADATA', 'CLOSE' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _concurrentAppend(accountName, path, streamContents, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let appendMode = (options && options.appendMode !== undefined) ? options.appendMode : undefined; + let syncFlag = (options && options.syncFlag !== undefined) ? options.syncFlag : 'DATA'; + let op = 'CONCURRENTAPPEND'; + let transferEncoding = 'chunked'; + // Validate + try { + if (accountName === null || accountName === undefined || typeof accountName.valueOf() !== 'string') { + throw new Error('accountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.adlsFileSystemDnsSuffix === null || this.client.adlsFileSystemDnsSuffix === undefined || typeof this.client.adlsFileSystemDnsSuffix.valueOf() !== 'string') { + throw new Error('this.client.adlsFileSystemDnsSuffix cannot be null or undefined and it must be of type string.'); + } + if (path === null || path === undefined || typeof path.valueOf() !== 'string') { + throw new Error('path cannot be null or undefined and it must be of type string.'); + } + if (streamContents === null || streamContents === undefined) { + throw new Error('streamContents cannot be null or undefined and it must be of type object.'); + } + if (appendMode) { + let allowedValues = [ 'autocreate' ]; + if (!allowedValues.some( function(item) { return item === appendMode; })) { + throw new Error(appendMode + ' is not a valid value. The valid values are: ' + allowedValues); + } + } + if (syncFlag) { + let allowedValues1 = [ 'DATA', 'METADATA', 'CLOSE' ]; + if (!allowedValues1.some( function(item) { return item === syncFlag; })) { + throw new Error(syncFlag + ' is not a valid value. The valid values are: ' + allowedValues1); + } + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'WebHdfsExt/{path}'; + requestUrl = requestUrl.replace('{accountName}', accountName); + requestUrl = requestUrl.replace('{adlsFileSystemDnsSuffix}', this.client.adlsFileSystemDnsSuffix); + requestUrl = requestUrl.replace('{path}', encodeURIComponent(path)); + let queryParameters = []; + if (appendMode !== null && appendMode !== undefined) { + queryParameters.push('appendMode=' + encodeURIComponent(appendMode)); + } + queryParameters.push('op=' + encodeURIComponent(op)); + if (syncFlag !== null && syncFlag !== undefined) { + queryParameters.push('syncFlag=' + encodeURIComponent(syncFlag)); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/octet-stream'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (transferEncoding !== undefined && transferEncoding !== null) { + httpRequest.headers['Transfer-Encoding'] = transferEncoding; + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = streamContents; + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['AdlsError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Checks if the specified access is available at the given path. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory for which to check access. + * + * @param {string} fsaction File system operation read/write/execute in string + * form, matching regex pattern '[rwx-]{3}' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _checkAccess(accountName, path, fsaction, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let op = 'CHECKACCESS'; + // Validate + try { + if (accountName === null || accountName === undefined || typeof accountName.valueOf() !== 'string') { + throw new Error('accountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.adlsFileSystemDnsSuffix === null || this.client.adlsFileSystemDnsSuffix === undefined || typeof this.client.adlsFileSystemDnsSuffix.valueOf() !== 'string') { + throw new Error('this.client.adlsFileSystemDnsSuffix cannot be null or undefined and it must be of type string.'); + } + if (path === null || path === undefined || typeof path.valueOf() !== 'string') { + throw new Error('path cannot be null or undefined and it must be of type string.'); + } + if (fsaction === null || fsaction === undefined || typeof fsaction.valueOf() !== 'string') { + throw new Error('fsaction cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'webhdfs/v1/{path}'; + requestUrl = requestUrl.replace('{accountName}', accountName); + requestUrl = requestUrl.replace('{adlsFileSystemDnsSuffix}', this.client.adlsFileSystemDnsSuffix); + requestUrl = requestUrl.replace('{path}', encodeURIComponent(path)); + let queryParameters = []; + queryParameters.push('fsaction=' + encodeURIComponent(fsaction)); + queryParameters.push('op=' + encodeURIComponent(op)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['AdlsError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Creates a directory. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * directory to create. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.permission] Optional octal permission with which + * the directory should be created. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link FileOperationResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _mkdirs(accountName, path, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let permission = (options && options.permission !== undefined) ? options.permission : undefined; + let op = 'MKDIRS'; + // Validate + try { + if (accountName === null || accountName === undefined || typeof accountName.valueOf() !== 'string') { + throw new Error('accountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.adlsFileSystemDnsSuffix === null || this.client.adlsFileSystemDnsSuffix === undefined || typeof this.client.adlsFileSystemDnsSuffix.valueOf() !== 'string') { + throw new Error('this.client.adlsFileSystemDnsSuffix cannot be null or undefined and it must be of type string.'); + } + if (path === null || path === undefined || typeof path.valueOf() !== 'string') { + throw new Error('path cannot be null or undefined and it must be of type string.'); + } + if (permission !== null && permission !== undefined && typeof permission !== 'number') { + throw new Error('permission must be of type number.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'webhdfs/v1/{path}'; + requestUrl = requestUrl.replace('{accountName}', accountName); + requestUrl = requestUrl.replace('{adlsFileSystemDnsSuffix}', this.client.adlsFileSystemDnsSuffix); + requestUrl = requestUrl.replace('{path}', encodeURIComponent(path)); + let queryParameters = []; + if (permission !== null && permission !== undefined) { + queryParameters.push('permission=' + encodeURIComponent(permission.toString())); + } + queryParameters.push('op=' + encodeURIComponent(op)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['AdlsError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['FileOperationResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Concatenates the list of source files into the destination file, removing + * all source files upon success. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * destination file resulting from the concatenation. + * + * @param {array} sources A list of comma separated Data Lake Store paths + * (starting with '/') of the files to concatenate, in the order in which they + * should be concatenated. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _concat(accountName, path, sources, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let op = 'CONCAT'; + // Validate + try { + if (accountName === null || accountName === undefined || typeof accountName.valueOf() !== 'string') { + throw new Error('accountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.adlsFileSystemDnsSuffix === null || this.client.adlsFileSystemDnsSuffix === undefined || typeof this.client.adlsFileSystemDnsSuffix.valueOf() !== 'string') { + throw new Error('this.client.adlsFileSystemDnsSuffix cannot be null or undefined and it must be of type string.'); + } + if (path === null || path === undefined || typeof path.valueOf() !== 'string') { + throw new Error('path cannot be null or undefined and it must be of type string.'); + } + if (!Array.isArray(sources)) { + throw new Error('sources cannot be null or undefined and it must be of type array.'); + } + for (let i = 0; i < sources.length; i++) { + if (sources[i] !== null && sources[i] !== undefined && typeof sources[i].valueOf() !== 'string') { + throw new Error('sources[i] must be of type string.'); + } + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'webhdfs/v1/{path}'; + requestUrl = requestUrl.replace('{accountName}', accountName); + requestUrl = requestUrl.replace('{adlsFileSystemDnsSuffix}', this.client.adlsFileSystemDnsSuffix); + requestUrl = requestUrl.replace('{path}', encodeURIComponent(path)); + let queryParameters = []; + queryParameters.push('sources=' + encodeURIComponent(sources.join(','))); + queryParameters.push('op=' + encodeURIComponent(op)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['AdlsError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Concatenates the list of source files into the destination file, deleting + * all source files upon success. This method accepts more source file paths + * than the Concat method. This method and the parameters it accepts are + * subject to change for usability in an upcoming version. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * destination file resulting from the concatenation. + * + * @param {object} streamContents A list of Data Lake Store paths (starting + * with '/') of the source files. Must be a comma-separated path list in the + * format: sources=/file/path/1.txt,/file/path/2.txt,/file/path/lastfile.csv + * + * @param {object} [options] Optional Parameters. + * + * @param {boolean} [options.deleteSourceDirectory] Indicates that as an + * optimization instead of deleting each individual source stream, delete the + * source stream folder if all streams are in the same folder instead. This + * results in a substantial performance improvement when the only streams in + * the folder are part of the concatenation operation. WARNING: This includes + * the deletion of any other files that are not source files. Only set this to + * true when source files are the only files in the source directory. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _msConcat(accountName, path, streamContents, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let deleteSourceDirectory = (options && options.deleteSourceDirectory !== undefined) ? options.deleteSourceDirectory : undefined; + let op = 'MSCONCAT'; + // Validate + try { + if (accountName === null || accountName === undefined || typeof accountName.valueOf() !== 'string') { + throw new Error('accountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.adlsFileSystemDnsSuffix === null || this.client.adlsFileSystemDnsSuffix === undefined || typeof this.client.adlsFileSystemDnsSuffix.valueOf() !== 'string') { + throw new Error('this.client.adlsFileSystemDnsSuffix cannot be null or undefined and it must be of type string.'); + } + if (path === null || path === undefined || typeof path.valueOf() !== 'string') { + throw new Error('path cannot be null or undefined and it must be of type string.'); + } + if (deleteSourceDirectory !== null && deleteSourceDirectory !== undefined && typeof deleteSourceDirectory !== 'boolean') { + throw new Error('deleteSourceDirectory must be of type boolean.'); + } + if (streamContents === null || streamContents === undefined) { + throw new Error('streamContents cannot be null or undefined and it must be of type object.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'webhdfs/v1/{path}'; + requestUrl = requestUrl.replace('{accountName}', accountName); + requestUrl = requestUrl.replace('{adlsFileSystemDnsSuffix}', this.client.adlsFileSystemDnsSuffix); + requestUrl = requestUrl.replace('{path}', encodeURIComponent(path)); + let queryParameters = []; + if (deleteSourceDirectory !== null && deleteSourceDirectory !== undefined) { + queryParameters.push('deleteSourceDirectory=' + encodeURIComponent(deleteSourceDirectory.toString())); + } + queryParameters.push('op=' + encodeURIComponent(op)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/octet-stream'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = streamContents; + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['AdlsError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Get the list of file status objects specified by the file path, with + * optional pagination parameters + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * directory to list. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.listSize] Gets or sets the number of items to + * return. Optional. + * + * @param {string} [options.listAfter] Gets or sets the item or lexographical + * index after which to begin returning results. For example, a file list of + * 'a','b','d' and listAfter='b' will return 'd', and a listAfter='c' will also + * return 'd'. Optional. + * + * @param {string} [options.listBefore] Gets or sets the item or lexographical + * index before which to begin returning results. For example, a file list of + * 'a','b','d' and listBefore='d' will return 'a','b', and a listBefore='c' + * will also return 'a','b'. Optional. + * + * @param {boolean} [options.tooId] An optional switch to return friendly names + * in place of owner and group. tooid=false returns friendly names instead of + * the AAD Object ID. Default value is true, returning AAD object IDs. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link FileStatusesResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listFileStatus(accountName, path, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let listSize = (options && options.listSize !== undefined) ? options.listSize : undefined; + let listAfter = (options && options.listAfter !== undefined) ? options.listAfter : undefined; + let listBefore = (options && options.listBefore !== undefined) ? options.listBefore : undefined; + let tooId = (options && options.tooId !== undefined) ? options.tooId : undefined; + let op = 'LISTSTATUS'; + // Validate + try { + if (accountName === null || accountName === undefined || typeof accountName.valueOf() !== 'string') { + throw new Error('accountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.adlsFileSystemDnsSuffix === null || this.client.adlsFileSystemDnsSuffix === undefined || typeof this.client.adlsFileSystemDnsSuffix.valueOf() !== 'string') { + throw new Error('this.client.adlsFileSystemDnsSuffix cannot be null or undefined and it must be of type string.'); + } + if (path === null || path === undefined || typeof path.valueOf() !== 'string') { + throw new Error('path cannot be null or undefined and it must be of type string.'); + } + if (listSize !== null && listSize !== undefined && typeof listSize !== 'number') { + throw new Error('listSize must be of type number.'); + } + if (listAfter !== null && listAfter !== undefined && typeof listAfter.valueOf() !== 'string') { + throw new Error('listAfter must be of type string.'); + } + if (listBefore !== null && listBefore !== undefined && typeof listBefore.valueOf() !== 'string') { + throw new Error('listBefore must be of type string.'); + } + if (tooId !== null && tooId !== undefined && typeof tooId !== 'boolean') { + throw new Error('tooId must be of type boolean.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'webhdfs/v1/{path}'; + requestUrl = requestUrl.replace('{accountName}', accountName); + requestUrl = requestUrl.replace('{adlsFileSystemDnsSuffix}', this.client.adlsFileSystemDnsSuffix); + requestUrl = requestUrl.replace('{path}', encodeURIComponent(path)); + let queryParameters = []; + if (listSize !== null && listSize !== undefined) { + queryParameters.push('listSize=' + encodeURIComponent(listSize.toString())); + } + if (listAfter !== null && listAfter !== undefined) { + queryParameters.push('listAfter=' + encodeURIComponent(listAfter)); + } + if (listBefore !== null && listBefore !== undefined) { + queryParameters.push('listBefore=' + encodeURIComponent(listBefore)); + } + if (tooId !== null && tooId !== undefined) { + queryParameters.push('tooId=' + encodeURIComponent(tooId.toString())); + } + queryParameters.push('op=' + encodeURIComponent(op)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['AdlsError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['FileStatusesResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets the file content summary object specified by the file path. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file for which to retrieve the summary. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ContentSummaryResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _getContentSummary(accountName, path, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let op = 'GETCONTENTSUMMARY'; + // Validate + try { + if (accountName === null || accountName === undefined || typeof accountName.valueOf() !== 'string') { + throw new Error('accountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.adlsFileSystemDnsSuffix === null || this.client.adlsFileSystemDnsSuffix === undefined || typeof this.client.adlsFileSystemDnsSuffix.valueOf() !== 'string') { + throw new Error('this.client.adlsFileSystemDnsSuffix cannot be null or undefined and it must be of type string.'); + } + if (path === null || path === undefined || typeof path.valueOf() !== 'string') { + throw new Error('path cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'webhdfs/v1/{path}'; + requestUrl = requestUrl.replace('{accountName}', accountName); + requestUrl = requestUrl.replace('{adlsFileSystemDnsSuffix}', this.client.adlsFileSystemDnsSuffix); + requestUrl = requestUrl.replace('{path}', encodeURIComponent(path)); + let queryParameters = []; + queryParameters.push('op=' + encodeURIComponent(op)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['AdlsError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ContentSummaryResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Get the file status object specified by the file path. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory for which to retrieve the status. + * + * @param {object} [options] Optional Parameters. + * + * @param {boolean} [options.tooId] An optional switch to return friendly names + * in place of owner and group. tooid=false returns friendly names instead of + * the AAD Object ID. Default value is true, returning AAD object IDs. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link FileStatusResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _getFileStatus(accountName, path, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let tooId = (options && options.tooId !== undefined) ? options.tooId : undefined; + let op = 'GETFILESTATUS'; + // Validate + try { + if (accountName === null || accountName === undefined || typeof accountName.valueOf() !== 'string') { + throw new Error('accountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.adlsFileSystemDnsSuffix === null || this.client.adlsFileSystemDnsSuffix === undefined || typeof this.client.adlsFileSystemDnsSuffix.valueOf() !== 'string') { + throw new Error('this.client.adlsFileSystemDnsSuffix cannot be null or undefined and it must be of type string.'); + } + if (path === null || path === undefined || typeof path.valueOf() !== 'string') { + throw new Error('path cannot be null or undefined and it must be of type string.'); + } + if (tooId !== null && tooId !== undefined && typeof tooId !== 'boolean') { + throw new Error('tooId must be of type boolean.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'webhdfs/v1/{path}'; + requestUrl = requestUrl.replace('{accountName}', accountName); + requestUrl = requestUrl.replace('{adlsFileSystemDnsSuffix}', this.client.adlsFileSystemDnsSuffix); + requestUrl = requestUrl.replace('{path}', encodeURIComponent(path)); + let queryParameters = []; + if (tooId !== null && tooId !== undefined) { + queryParameters.push('tooId=' + encodeURIComponent(tooId.toString())); + } + queryParameters.push('op=' + encodeURIComponent(op)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['AdlsError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['FileStatusResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Opens and reads from the specified file. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file to open. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.length] The number of bytes that the server will + * attempt to retrieve. It will retrieve <= length bytes. + * + * @param {number} [options.offset] The byte offset to start reading data from. + * + * @param {uuid} [options.fileSessionId] Optional unique GUID per file + * indicating all the reads with the same fileSessionId are from the same + * client and same session. This will give a performance benefit. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _open(accountName, path, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let length = (options && options.length !== undefined) ? options.length : undefined; + let offset = (options && options.offset !== undefined) ? options.offset : undefined; + let fileSessionId = (options && options.fileSessionId !== undefined) ? options.fileSessionId : undefined; + let read = 'true'; + let op = 'OPEN'; + // Validate + try { + if (accountName === null || accountName === undefined || typeof accountName.valueOf() !== 'string') { + throw new Error('accountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.adlsFileSystemDnsSuffix === null || this.client.adlsFileSystemDnsSuffix === undefined || typeof this.client.adlsFileSystemDnsSuffix.valueOf() !== 'string') { + throw new Error('this.client.adlsFileSystemDnsSuffix cannot be null or undefined and it must be of type string.'); + } + if (path === null || path === undefined || typeof path.valueOf() !== 'string') { + throw new Error('path cannot be null or undefined and it must be of type string.'); + } + if (length !== null && length !== undefined && typeof length !== 'number') { + throw new Error('length must be of type number.'); + } + if (offset !== null && offset !== undefined && typeof offset !== 'number') { + throw new Error('offset must be of type number.'); + } + if (fileSessionId !== null && fileSessionId !== undefined && !(typeof fileSessionId.valueOf() === 'string' && msRest.isValidUuid(fileSessionId))) { + throw new Error('fileSessionId must be of type string and must be a valid uuid.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'webhdfs/v1/{path}'; + requestUrl = requestUrl.replace('{accountName}', accountName); + requestUrl = requestUrl.replace('{adlsFileSystemDnsSuffix}', this.client.adlsFileSystemDnsSuffix); + requestUrl = requestUrl.replace('{path}', encodeURIComponent(path)); + let queryParameters = []; + if (length !== null && length !== undefined) { + queryParameters.push('length=' + encodeURIComponent(length.toString())); + } + if (offset !== null && offset !== undefined) { + queryParameters.push('offset=' + encodeURIComponent(offset.toString())); + } + if (fileSessionId !== null && fileSessionId !== undefined) { + queryParameters.push('fileSessionId=' + encodeURIComponent(fileSessionId.toString())); + } + queryParameters.push('read=' + encodeURIComponent(read)); + queryParameters.push('op=' + encodeURIComponent(op)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + httpRequest.streamedResponse = true; + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(`Unexpected status code: ${statusCode}`); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + if (responseBody !== undefined) parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + + // Create Result + let result = response; + return callback(null, result, httpRequest, response); + }); +} + +/** + * Used for serial appends to the specified file. NOTE: The target must not + * contain data added by ConcurrentAppend. ConcurrentAppend and Append cannot + * be used interchangeably; once a target file has been modified using either + * of these append options, the other append option cannot be used on the + * target file. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file to which to append. + * + * @param {object} streamContents The file contents to include when appending + * to the file. The maximum content size is 4MB. For content larger than 4MB + * you must append the content in 4MB chunks. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.offset] The optional offset in the stream to begin + * the append operation. Default is to append at the end of the stream. + * + * @param {string} [options.syncFlag] Optionally indicates what to do after + * completion of the concurrent append. DATA indicates that more data will be + * sent immediately by the client, the file handle should remain open/locked, + * and file metadata (including file length, last modified time) should NOT get + * updated. METADATA indicates that more data will be sent immediately by the + * client, the file handle should remain open/locked, and file metadata should + * get updated. CLOSE indicates that the client is done sending data, the file + * handle should be closed/unlocked, and file metadata should get updated. + * Possible values include: 'DATA', 'METADATA', 'CLOSE' + * + * @param {uuid} [options.leaseId] Optional unique GUID per file to ensure + * single writer semantics, meaning that only clients that append to the file + * with the same leaseId will be allowed to do so. + * + * @param {uuid} [options.fileSessionId] Optional unique GUID per file + * indicating all the appends with the same fileSessionId are from the same + * client and same session. This will give a performance benefit when syncFlag + * is DATA or METADATA. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _append(accountName, path, streamContents, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let offset = (options && options.offset !== undefined) ? options.offset : undefined; + let syncFlag = (options && options.syncFlag !== undefined) ? options.syncFlag : 'CLOSE'; + let leaseId = (options && options.leaseId !== undefined) ? options.leaseId : undefined; + let fileSessionId = (options && options.fileSessionId !== undefined) ? options.fileSessionId : undefined; + let appendParameter = 'true'; + let op = 'APPEND'; + // Validate + try { + if (accountName === null || accountName === undefined || typeof accountName.valueOf() !== 'string') { + throw new Error('accountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.adlsFileSystemDnsSuffix === null || this.client.adlsFileSystemDnsSuffix === undefined || typeof this.client.adlsFileSystemDnsSuffix.valueOf() !== 'string') { + throw new Error('this.client.adlsFileSystemDnsSuffix cannot be null or undefined and it must be of type string.'); + } + if (path === null || path === undefined || typeof path.valueOf() !== 'string') { + throw new Error('path cannot be null or undefined and it must be of type string.'); + } + if (streamContents === null || streamContents === undefined) { + throw new Error('streamContents cannot be null or undefined and it must be of type object.'); + } + if (offset !== null && offset !== undefined && typeof offset !== 'number') { + throw new Error('offset must be of type number.'); + } + if (syncFlag) { + let allowedValues = [ 'DATA', 'METADATA', 'CLOSE' ]; + if (!allowedValues.some( function(item) { return item === syncFlag; })) { + throw new Error(syncFlag + ' is not a valid value. The valid values are: ' + allowedValues); + } + } + if (leaseId !== null && leaseId !== undefined && !(typeof leaseId.valueOf() === 'string' && msRest.isValidUuid(leaseId))) { + throw new Error('leaseId must be of type string and must be a valid uuid.'); + } + if (fileSessionId !== null && fileSessionId !== undefined && !(typeof fileSessionId.valueOf() === 'string' && msRest.isValidUuid(fileSessionId))) { + throw new Error('fileSessionId must be of type string and must be a valid uuid.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'webhdfs/v1/{path}'; + requestUrl = requestUrl.replace('{accountName}', accountName); + requestUrl = requestUrl.replace('{adlsFileSystemDnsSuffix}', this.client.adlsFileSystemDnsSuffix); + requestUrl = requestUrl.replace('{path}', encodeURIComponent(path)); + let queryParameters = []; + if (offset !== null && offset !== undefined) { + queryParameters.push('offset=' + encodeURIComponent(offset.toString())); + } + if (syncFlag !== null && syncFlag !== undefined) { + queryParameters.push('syncFlag=' + encodeURIComponent(syncFlag)); + } + if (leaseId !== null && leaseId !== undefined) { + queryParameters.push('leaseId=' + encodeURIComponent(leaseId.toString())); + } + if (fileSessionId !== null && fileSessionId !== undefined) { + queryParameters.push('fileSessionId=' + encodeURIComponent(fileSessionId.toString())); + } + queryParameters.push('append=' + encodeURIComponent(appendParameter)); + queryParameters.push('op=' + encodeURIComponent(op)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/octet-stream'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = streamContents; + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['AdlsError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Creates a file with optionally specified content. NOTE: If content is + * provided, the resulting file cannot be modified using ConcurrentAppend. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file to create. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.streamContents] The file contents to include when + * creating the file. This parameter is optional, resulting in an empty file if + * not specified. The maximum content size is 4MB. For content larger than + * 4MB you must append the content in 4MB chunks. + * + * @param {boolean} [options.overwrite] The indication of if the file should be + * overwritten. + * + * @param {string} [options.syncFlag] Optionally indicates what to do after + * completion of the create. DATA indicates that more data will be sent + * immediately by the client, the file handle should remain open/locked, and + * file metadata (including file length, last modified time) should NOT get + * updated. METADATA indicates that more data will be sent immediately by the + * client, the file handle should remain open/locked, and file metadata should + * get updated. CLOSE indicates that the client is done sending data, the file + * handle should be closed/unlocked, and file metadata should get updated. + * Possible values include: 'DATA', 'METADATA', 'CLOSE' + * + * @param {uuid} [options.leaseId] Optional unique GUID per file to ensure + * single writer semantics, meaning that only clients that append to the file + * with the same leaseId will be allowed to do so. + * + * @param {number} [options.permission] The octal representation of the unnamed + * user, mask and other permissions that should be set for the file when + * created. If not specified, it inherits these from the container. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _create(accountName, path, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let streamContents = (options && options.streamContents !== undefined) ? options.streamContents : undefined; + let overwrite = (options && options.overwrite !== undefined) ? options.overwrite : undefined; + let syncFlag = (options && options.syncFlag !== undefined) ? options.syncFlag : 'CLOSE'; + let leaseId = (options && options.leaseId !== undefined) ? options.leaseId : undefined; + let permission = (options && options.permission !== undefined) ? options.permission : undefined; + let write = 'true'; + let op = 'CREATE'; + // Validate + try { + if (accountName === null || accountName === undefined || typeof accountName.valueOf() !== 'string') { + throw new Error('accountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.adlsFileSystemDnsSuffix === null || this.client.adlsFileSystemDnsSuffix === undefined || typeof this.client.adlsFileSystemDnsSuffix.valueOf() !== 'string') { + throw new Error('this.client.adlsFileSystemDnsSuffix cannot be null or undefined and it must be of type string.'); + } + if (path === null || path === undefined || typeof path.valueOf() !== 'string') { + throw new Error('path cannot be null or undefined and it must be of type string.'); + } + if (streamContents !== null && streamContents !== undefined && typeof streamContents.valueOf() !== 'object') { + throw new Error('streamContents must be of type object.'); + } + if (overwrite !== null && overwrite !== undefined && typeof overwrite !== 'boolean') { + throw new Error('overwrite must be of type boolean.'); + } + if (syncFlag) { + let allowedValues = [ 'DATA', 'METADATA', 'CLOSE' ]; + if (!allowedValues.some( function(item) { return item === syncFlag; })) { + throw new Error(syncFlag + ' is not a valid value. The valid values are: ' + allowedValues); + } + } + if (leaseId !== null && leaseId !== undefined && !(typeof leaseId.valueOf() === 'string' && msRest.isValidUuid(leaseId))) { + throw new Error('leaseId must be of type string and must be a valid uuid.'); + } + if (permission !== null && permission !== undefined && typeof permission !== 'number') { + throw new Error('permission must be of type number.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'webhdfs/v1/{path}'; + requestUrl = requestUrl.replace('{accountName}', accountName); + requestUrl = requestUrl.replace('{adlsFileSystemDnsSuffix}', this.client.adlsFileSystemDnsSuffix); + requestUrl = requestUrl.replace('{path}', encodeURIComponent(path)); + let queryParameters = []; + if (overwrite !== null && overwrite !== undefined) { + queryParameters.push('overwrite=' + encodeURIComponent(overwrite.toString())); + } + if (syncFlag !== null && syncFlag !== undefined) { + queryParameters.push('syncFlag=' + encodeURIComponent(syncFlag)); + } + if (leaseId !== null && leaseId !== undefined) { + queryParameters.push('leaseId=' + encodeURIComponent(leaseId.toString())); + } + if (permission !== null && permission !== undefined) { + queryParameters.push('permission=' + encodeURIComponent(permission.toString())); + } + queryParameters.push('write=' + encodeURIComponent(write)); + queryParameters.push('op=' + encodeURIComponent(op)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/octet-stream'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = streamContents; + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['AdlsError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Sets the Access Control List (ACL) for a file or folder. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory on which to set the ACL. + * + * @param {string} aclspec The ACL spec included in ACL creation operations in + * the format '[default:]user|group|other::r|-w|-x|-' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _setAcl(accountName, path, aclspec, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let op = 'SETACL'; + // Validate + try { + if (accountName === null || accountName === undefined || typeof accountName.valueOf() !== 'string') { + throw new Error('accountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.adlsFileSystemDnsSuffix === null || this.client.adlsFileSystemDnsSuffix === undefined || typeof this.client.adlsFileSystemDnsSuffix.valueOf() !== 'string') { + throw new Error('this.client.adlsFileSystemDnsSuffix cannot be null or undefined and it must be of type string.'); + } + if (path === null || path === undefined || typeof path.valueOf() !== 'string') { + throw new Error('path cannot be null or undefined and it must be of type string.'); + } + if (aclspec === null || aclspec === undefined || typeof aclspec.valueOf() !== 'string') { + throw new Error('aclspec cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'webhdfs/v1/{path}'; + requestUrl = requestUrl.replace('{accountName}', accountName); + requestUrl = requestUrl.replace('{adlsFileSystemDnsSuffix}', this.client.adlsFileSystemDnsSuffix); + requestUrl = requestUrl.replace('{path}', encodeURIComponent(path)); + let queryParameters = []; + queryParameters.push('aclspec=' + encodeURIComponent(aclspec)); + queryParameters.push('op=' + encodeURIComponent(op)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['AdlsError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Modifies existing Access Control List (ACL) entries on a file or folder. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory with the ACL being modified. + * + * @param {string} aclspec The ACL specification included in ACL modification + * operations in the format '[default:]user|group|other::r|-w|-x|-' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _modifyAclEntries(accountName, path, aclspec, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let op = 'MODIFYACLENTRIES'; + // Validate + try { + if (accountName === null || accountName === undefined || typeof accountName.valueOf() !== 'string') { + throw new Error('accountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.adlsFileSystemDnsSuffix === null || this.client.adlsFileSystemDnsSuffix === undefined || typeof this.client.adlsFileSystemDnsSuffix.valueOf() !== 'string') { + throw new Error('this.client.adlsFileSystemDnsSuffix cannot be null or undefined and it must be of type string.'); + } + if (path === null || path === undefined || typeof path.valueOf() !== 'string') { + throw new Error('path cannot be null or undefined and it must be of type string.'); + } + if (aclspec === null || aclspec === undefined || typeof aclspec.valueOf() !== 'string') { + throw new Error('aclspec cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'webhdfs/v1/{path}'; + requestUrl = requestUrl.replace('{accountName}', accountName); + requestUrl = requestUrl.replace('{adlsFileSystemDnsSuffix}', this.client.adlsFileSystemDnsSuffix); + requestUrl = requestUrl.replace('{path}', encodeURIComponent(path)); + let queryParameters = []; + queryParameters.push('aclspec=' + encodeURIComponent(aclspec)); + queryParameters.push('op=' + encodeURIComponent(op)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['AdlsError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Removes existing Access Control List (ACL) entries for a file or folder. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory with the ACL being removed. + * + * @param {string} aclspec The ACL spec included in ACL removal operations in + * the format '[default:]user|group|other' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _removeAclEntries(accountName, path, aclspec, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let op = 'REMOVEACLENTRIES'; + // Validate + try { + if (accountName === null || accountName === undefined || typeof accountName.valueOf() !== 'string') { + throw new Error('accountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.adlsFileSystemDnsSuffix === null || this.client.adlsFileSystemDnsSuffix === undefined || typeof this.client.adlsFileSystemDnsSuffix.valueOf() !== 'string') { + throw new Error('this.client.adlsFileSystemDnsSuffix cannot be null or undefined and it must be of type string.'); + } + if (path === null || path === undefined || typeof path.valueOf() !== 'string') { + throw new Error('path cannot be null or undefined and it must be of type string.'); + } + if (aclspec === null || aclspec === undefined || typeof aclspec.valueOf() !== 'string') { + throw new Error('aclspec cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'webhdfs/v1/{path}'; + requestUrl = requestUrl.replace('{accountName}', accountName); + requestUrl = requestUrl.replace('{adlsFileSystemDnsSuffix}', this.client.adlsFileSystemDnsSuffix); + requestUrl = requestUrl.replace('{path}', encodeURIComponent(path)); + let queryParameters = []; + queryParameters.push('aclspec=' + encodeURIComponent(aclspec)); + queryParameters.push('op=' + encodeURIComponent(op)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['AdlsError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Removes the existing Default Access Control List (ACL) of the specified + * directory. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * directory with the default ACL being removed. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _removeDefaultAcl(accountName, path, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let op = 'REMOVEDEFAULTACL'; + // Validate + try { + if (accountName === null || accountName === undefined || typeof accountName.valueOf() !== 'string') { + throw new Error('accountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.adlsFileSystemDnsSuffix === null || this.client.adlsFileSystemDnsSuffix === undefined || typeof this.client.adlsFileSystemDnsSuffix.valueOf() !== 'string') { + throw new Error('this.client.adlsFileSystemDnsSuffix cannot be null or undefined and it must be of type string.'); + } + if (path === null || path === undefined || typeof path.valueOf() !== 'string') { + throw new Error('path cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'webhdfs/v1/{path}'; + requestUrl = requestUrl.replace('{accountName}', accountName); + requestUrl = requestUrl.replace('{adlsFileSystemDnsSuffix}', this.client.adlsFileSystemDnsSuffix); + requestUrl = requestUrl.replace('{path}', encodeURIComponent(path)); + let queryParameters = []; + queryParameters.push('op=' + encodeURIComponent(op)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['AdlsError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Removes the existing Access Control List (ACL) of the specified file or + * directory. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory with the ACL being removed. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _removeAcl(accountName, path, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let op = 'REMOVEACL'; + // Validate + try { + if (accountName === null || accountName === undefined || typeof accountName.valueOf() !== 'string') { + throw new Error('accountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.adlsFileSystemDnsSuffix === null || this.client.adlsFileSystemDnsSuffix === undefined || typeof this.client.adlsFileSystemDnsSuffix.valueOf() !== 'string') { + throw new Error('this.client.adlsFileSystemDnsSuffix cannot be null or undefined and it must be of type string.'); + } + if (path === null || path === undefined || typeof path.valueOf() !== 'string') { + throw new Error('path cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'webhdfs/v1/{path}'; + requestUrl = requestUrl.replace('{accountName}', accountName); + requestUrl = requestUrl.replace('{adlsFileSystemDnsSuffix}', this.client.adlsFileSystemDnsSuffix); + requestUrl = requestUrl.replace('{path}', encodeURIComponent(path)); + let queryParameters = []; + queryParameters.push('op=' + encodeURIComponent(op)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['AdlsError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets Access Control List (ACL) entries for the specified file or directory. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory for which to get the ACL. + * + * @param {object} [options] Optional Parameters. + * + * @param {boolean} [options.tooId] An optional switch to return friendly names + * in place of object ID for ACL entries. tooid=false returns friendly names + * instead of the AAD Object ID. Default value is true, returning AAD object + * IDs. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link AclStatusResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _getAclStatus(accountName, path, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let tooId = (options && options.tooId !== undefined) ? options.tooId : undefined; + let op = 'GETACLSTATUS'; + // Validate + try { + if (accountName === null || accountName === undefined || typeof accountName.valueOf() !== 'string') { + throw new Error('accountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.adlsFileSystemDnsSuffix === null || this.client.adlsFileSystemDnsSuffix === undefined || typeof this.client.adlsFileSystemDnsSuffix.valueOf() !== 'string') { + throw new Error('this.client.adlsFileSystemDnsSuffix cannot be null or undefined and it must be of type string.'); + } + if (path === null || path === undefined || typeof path.valueOf() !== 'string') { + throw new Error('path cannot be null or undefined and it must be of type string.'); + } + if (tooId !== null && tooId !== undefined && typeof tooId !== 'boolean') { + throw new Error('tooId must be of type boolean.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'webhdfs/v1/{path}'; + requestUrl = requestUrl.replace('{accountName}', accountName); + requestUrl = requestUrl.replace('{adlsFileSystemDnsSuffix}', this.client.adlsFileSystemDnsSuffix); + requestUrl = requestUrl.replace('{path}', encodeURIComponent(path)); + let queryParameters = []; + if (tooId !== null && tooId !== undefined) { + queryParameters.push('tooId=' + encodeURIComponent(tooId.toString())); + } + queryParameters.push('op=' + encodeURIComponent(op)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['AdlsError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['AclStatusResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Deletes the requested file or directory, optionally recursively. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory to delete. + * + * @param {object} [options] Optional Parameters. + * + * @param {boolean} [options.recursive] The optional switch indicating if the + * delete should be recursive + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link FileOperationResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(accountName, path, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let recursive = (options && options.recursive !== undefined) ? options.recursive : undefined; + let op = 'DELETE'; + // Validate + try { + if (accountName === null || accountName === undefined || typeof accountName.valueOf() !== 'string') { + throw new Error('accountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.adlsFileSystemDnsSuffix === null || this.client.adlsFileSystemDnsSuffix === undefined || typeof this.client.adlsFileSystemDnsSuffix.valueOf() !== 'string') { + throw new Error('this.client.adlsFileSystemDnsSuffix cannot be null or undefined and it must be of type string.'); + } + if (path === null || path === undefined || typeof path.valueOf() !== 'string') { + throw new Error('path cannot be null or undefined and it must be of type string.'); + } + if (recursive !== null && recursive !== undefined && typeof recursive !== 'boolean') { + throw new Error('recursive must be of type boolean.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'webhdfs/v1/{path}'; + requestUrl = requestUrl.replace('{accountName}', accountName); + requestUrl = requestUrl.replace('{adlsFileSystemDnsSuffix}', this.client.adlsFileSystemDnsSuffix); + requestUrl = requestUrl.replace('{path}', encodeURIComponent(path)); + let queryParameters = []; + if (recursive !== null && recursive !== undefined) { + queryParameters.push('recursive=' + encodeURIComponent(recursive.toString())); + } + queryParameters.push('op=' + encodeURIComponent(op)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['AdlsError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['FileOperationResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Rename a file or directory. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory to move/rename. + * + * @param {string} destination The path to move/rename the file or folder to + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link FileOperationResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _rename(accountName, path, destination, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let op = 'RENAME'; + // Validate + try { + if (accountName === null || accountName === undefined || typeof accountName.valueOf() !== 'string') { + throw new Error('accountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.adlsFileSystemDnsSuffix === null || this.client.adlsFileSystemDnsSuffix === undefined || typeof this.client.adlsFileSystemDnsSuffix.valueOf() !== 'string') { + throw new Error('this.client.adlsFileSystemDnsSuffix cannot be null or undefined and it must be of type string.'); + } + if (path === null || path === undefined || typeof path.valueOf() !== 'string') { + throw new Error('path cannot be null or undefined and it must be of type string.'); + } + if (destination === null || destination === undefined || typeof destination.valueOf() !== 'string') { + throw new Error('destination cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'webhdfs/v1/{path}'; + requestUrl = requestUrl.replace('{accountName}', accountName); + requestUrl = requestUrl.replace('{adlsFileSystemDnsSuffix}', this.client.adlsFileSystemDnsSuffix); + requestUrl = requestUrl.replace('{path}', encodeURIComponent(path)); + let queryParameters = []; + queryParameters.push('destination=' + encodeURIComponent(destination)); + queryParameters.push('op=' + encodeURIComponent(op)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['AdlsError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['FileOperationResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Sets the owner of a file or directory. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory for which to set the owner. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.owner] The AAD Object ID of the user owner of the + * file or directory. If empty, the property will remain unchanged. + * + * @param {string} [options.group] The AAD Object ID of the group owner of the + * file or directory. If empty, the property will remain unchanged. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _setOwner(accountName, path, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let owner = (options && options.owner !== undefined) ? options.owner : undefined; + let group = (options && options.group !== undefined) ? options.group : undefined; + let op = 'SETOWNER'; + // Validate + try { + if (accountName === null || accountName === undefined || typeof accountName.valueOf() !== 'string') { + throw new Error('accountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.adlsFileSystemDnsSuffix === null || this.client.adlsFileSystemDnsSuffix === undefined || typeof this.client.adlsFileSystemDnsSuffix.valueOf() !== 'string') { + throw new Error('this.client.adlsFileSystemDnsSuffix cannot be null or undefined and it must be of type string.'); + } + if (path === null || path === undefined || typeof path.valueOf() !== 'string') { + throw new Error('path cannot be null or undefined and it must be of type string.'); + } + if (owner !== null && owner !== undefined && typeof owner.valueOf() !== 'string') { + throw new Error('owner must be of type string.'); + } + if (group !== null && group !== undefined && typeof group.valueOf() !== 'string') { + throw new Error('group must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'webhdfs/v1/{path}'; + requestUrl = requestUrl.replace('{accountName}', accountName); + requestUrl = requestUrl.replace('{adlsFileSystemDnsSuffix}', this.client.adlsFileSystemDnsSuffix); + requestUrl = requestUrl.replace('{path}', encodeURIComponent(path)); + let queryParameters = []; + if (owner !== null && owner !== undefined) { + queryParameters.push('owner=' + encodeURIComponent(owner)); + } + if (group !== null && group !== undefined) { + queryParameters.push('group=' + encodeURIComponent(group)); + } + queryParameters.push('op=' + encodeURIComponent(op)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['AdlsError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Sets the permission of the file or folder. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory for which to set the permission. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.permission] A string representation of the + * permission (i.e 'rwx'). If empty, this property remains unchanged. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _setPermission(accountName, path, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let permission = (options && options.permission !== undefined) ? options.permission : undefined; + let op = 'SETPERMISSION'; + // Validate + try { + if (accountName === null || accountName === undefined || typeof accountName.valueOf() !== 'string') { + throw new Error('accountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.adlsFileSystemDnsSuffix === null || this.client.adlsFileSystemDnsSuffix === undefined || typeof this.client.adlsFileSystemDnsSuffix.valueOf() !== 'string') { + throw new Error('this.client.adlsFileSystemDnsSuffix cannot be null or undefined and it must be of type string.'); + } + if (path === null || path === undefined || typeof path.valueOf() !== 'string') { + throw new Error('path cannot be null or undefined and it must be of type string.'); + } + if (permission !== null && permission !== undefined && typeof permission.valueOf() !== 'string') { + throw new Error('permission must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'webhdfs/v1/{path}'; + requestUrl = requestUrl.replace('{accountName}', accountName); + requestUrl = requestUrl.replace('{adlsFileSystemDnsSuffix}', this.client.adlsFileSystemDnsSuffix); + requestUrl = requestUrl.replace('{path}', encodeURIComponent(path)); + let queryParameters = []; + if (permission !== null && permission !== undefined) { + queryParameters.push('permission=' + encodeURIComponent(permission)); + } + queryParameters.push('op=' + encodeURIComponent(op)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['AdlsError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a FileSystem. */ +class FileSystem { + /** + * Create a FileSystem. + * @param {DataLakeStoreFileSystemManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._setFileExpiry = _setFileExpiry; + this._concurrentAppend = _concurrentAppend; + this._checkAccess = _checkAccess; + this._mkdirs = _mkdirs; + this._concat = _concat; + this._msConcat = _msConcat; + this._listFileStatus = _listFileStatus; + this._getContentSummary = _getContentSummary; + this._getFileStatus = _getFileStatus; + this._open = _open; + this._append = _append; + this._create = _create; + this._setAcl = _setAcl; + this._modifyAclEntries = _modifyAclEntries; + this._removeAclEntries = _removeAclEntries; + this._removeDefaultAcl = _removeDefaultAcl; + this._removeAcl = _removeAcl; + this._getAclStatus = _getAclStatus; + this._deleteMethod = _deleteMethod; + this._rename = _rename; + this._setOwner = _setOwner; + this._setPermission = _setPermission; + } + + /** + * Sets or removes the expiration time on the specified file. This operation + * can only be executed against files. Folders are not supported. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file on which to set or remove the expiration time. + * + * @param {string} expiryOption Indicates the type of expiration to use for the + * file: 1. NeverExpire: ExpireTime is ignored. 2. RelativeToNow: ExpireTime is + * an integer in milliseconds representing the expiration date relative to when + * file expiration is updated. 3. RelativeToCreationDate: ExpireTime is an + * integer in milliseconds representing the expiration date relative to file + * creation. 4. Absolute: ExpireTime is an integer in milliseconds, as a Unix + * timestamp relative to 1/1/1970 00:00:00. Possible values include: + * 'NeverExpire', 'RelativeToNow', 'RelativeToCreationDate', 'Absolute' + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.expireTime] The time that the file will expire, + * corresponding to the ExpiryOption that was set. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + setFileExpiryWithHttpOperationResponse(accountName, path, expiryOption, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._setFileExpiry(accountName, path, expiryOption, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Sets or removes the expiration time on the specified file. This operation + * can only be executed against files. Folders are not supported. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file on which to set or remove the expiration time. + * + * @param {string} expiryOption Indicates the type of expiration to use for the + * file: 1. NeverExpire: ExpireTime is ignored. 2. RelativeToNow: ExpireTime is + * an integer in milliseconds representing the expiration date relative to when + * file expiration is updated. 3. RelativeToCreationDate: ExpireTime is an + * integer in milliseconds representing the expiration date relative to file + * creation. 4. Absolute: ExpireTime is an integer in milliseconds, as a Unix + * timestamp relative to 1/1/1970 00:00:00. Possible values include: + * 'NeverExpire', 'RelativeToNow', 'RelativeToCreationDate', 'Absolute' + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.expireTime] The time that the file will expire, + * corresponding to the ExpiryOption that was set. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + setFileExpiry(accountName, path, expiryOption, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._setFileExpiry(accountName, path, expiryOption, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._setFileExpiry(accountName, path, expiryOption, options, optionalCallback); + } + } + + /** + * Appends to the specified file, optionally first creating the file if it does + * not yet exist. This method supports multiple concurrent appends to the file. + * NOTE: The target must not contain data added by Create or normal (serial) + * Append. ConcurrentAppend and Append cannot be used interchangeably; once a + * target file has been modified using either of these append options, the + * other append option cannot be used on the target file. ConcurrentAppend does + * not guarantee order and can result in duplicated data landing in the target + * file. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file to which to append using concurrent append. + * + * @param {object} streamContents The file contents to include when appending + * to the file. The maximum content size is 4MB. For content larger than 4MB + * you must append the content in 4MB chunks. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.appendMode] Indicates the concurrent append call + * should create the file if it doesn't exist or just open the existing file + * for append. Possible values include: 'autocreate' + * + * @param {string} [options.syncFlag] Optionally indicates what to do after + * completion of the concurrent append. DATA indicates that more data will be + * sent immediately by the client, the file handle should remain open/locked, + * and file metadata (including file length, last modified time) should NOT get + * updated. METADATA indicates that more data will be sent immediately by the + * client, the file handle should remain open/locked, and file metadata should + * get updated. CLOSE indicates that the client is done sending data, the file + * handle should be closed/unlocked, and file metadata should get updated. + * Possible values include: 'DATA', 'METADATA', 'CLOSE' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + concurrentAppendWithHttpOperationResponse(accountName, path, streamContents, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._concurrentAppend(accountName, path, streamContents, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Appends to the specified file, optionally first creating the file if it does + * not yet exist. This method supports multiple concurrent appends to the file. + * NOTE: The target must not contain data added by Create or normal (serial) + * Append. ConcurrentAppend and Append cannot be used interchangeably; once a + * target file has been modified using either of these append options, the + * other append option cannot be used on the target file. ConcurrentAppend does + * not guarantee order and can result in duplicated data landing in the target + * file. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file to which to append using concurrent append. + * + * @param {object} streamContents The file contents to include when appending + * to the file. The maximum content size is 4MB. For content larger than 4MB + * you must append the content in 4MB chunks. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.appendMode] Indicates the concurrent append call + * should create the file if it doesn't exist or just open the existing file + * for append. Possible values include: 'autocreate' + * + * @param {string} [options.syncFlag] Optionally indicates what to do after + * completion of the concurrent append. DATA indicates that more data will be + * sent immediately by the client, the file handle should remain open/locked, + * and file metadata (including file length, last modified time) should NOT get + * updated. METADATA indicates that more data will be sent immediately by the + * client, the file handle should remain open/locked, and file metadata should + * get updated. CLOSE indicates that the client is done sending data, the file + * handle should be closed/unlocked, and file metadata should get updated. + * Possible values include: 'DATA', 'METADATA', 'CLOSE' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + concurrentAppend(accountName, path, streamContents, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._concurrentAppend(accountName, path, streamContents, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._concurrentAppend(accountName, path, streamContents, options, optionalCallback); + } + } + + /** + * Checks if the specified access is available at the given path. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory for which to check access. + * + * @param {string} fsaction File system operation read/write/execute in string + * form, matching regex pattern '[rwx-]{3}' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + checkAccessWithHttpOperationResponse(accountName, path, fsaction, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._checkAccess(accountName, path, fsaction, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Checks if the specified access is available at the given path. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory for which to check access. + * + * @param {string} fsaction File system operation read/write/execute in string + * form, matching regex pattern '[rwx-]{3}' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + checkAccess(accountName, path, fsaction, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._checkAccess(accountName, path, fsaction, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._checkAccess(accountName, path, fsaction, options, optionalCallback); + } + } + + /** + * Creates a directory. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * directory to create. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.permission] Optional octal permission with which + * the directory should be created. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + mkdirsWithHttpOperationResponse(accountName, path, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._mkdirs(accountName, path, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a directory. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * directory to create. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.permission] Optional octal permission with which + * the directory should be created. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {FileOperationResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link FileOperationResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + mkdirs(accountName, path, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._mkdirs(accountName, path, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._mkdirs(accountName, path, options, optionalCallback); + } + } + + /** + * Concatenates the list of source files into the destination file, removing + * all source files upon success. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * destination file resulting from the concatenation. + * + * @param {array} sources A list of comma separated Data Lake Store paths + * (starting with '/') of the files to concatenate, in the order in which they + * should be concatenated. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + concatWithHttpOperationResponse(accountName, path, sources, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._concat(accountName, path, sources, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Concatenates the list of source files into the destination file, removing + * all source files upon success. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * destination file resulting from the concatenation. + * + * @param {array} sources A list of comma separated Data Lake Store paths + * (starting with '/') of the files to concatenate, in the order in which they + * should be concatenated. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + concat(accountName, path, sources, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._concat(accountName, path, sources, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._concat(accountName, path, sources, options, optionalCallback); + } + } + + /** + * Concatenates the list of source files into the destination file, deleting + * all source files upon success. This method accepts more source file paths + * than the Concat method. This method and the parameters it accepts are + * subject to change for usability in an upcoming version. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * destination file resulting from the concatenation. + * + * @param {object} streamContents A list of Data Lake Store paths (starting + * with '/') of the source files. Must be a comma-separated path list in the + * format: sources=/file/path/1.txt,/file/path/2.txt,/file/path/lastfile.csv + * + * @param {object} [options] Optional Parameters. + * + * @param {boolean} [options.deleteSourceDirectory] Indicates that as an + * optimization instead of deleting each individual source stream, delete the + * source stream folder if all streams are in the same folder instead. This + * results in a substantial performance improvement when the only streams in + * the folder are part of the concatenation operation. WARNING: This includes + * the deletion of any other files that are not source files. Only set this to + * true when source files are the only files in the source directory. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + msConcatWithHttpOperationResponse(accountName, path, streamContents, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._msConcat(accountName, path, streamContents, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Concatenates the list of source files into the destination file, deleting + * all source files upon success. This method accepts more source file paths + * than the Concat method. This method and the parameters it accepts are + * subject to change for usability in an upcoming version. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * destination file resulting from the concatenation. + * + * @param {object} streamContents A list of Data Lake Store paths (starting + * with '/') of the source files. Must be a comma-separated path list in the + * format: sources=/file/path/1.txt,/file/path/2.txt,/file/path/lastfile.csv + * + * @param {object} [options] Optional Parameters. + * + * @param {boolean} [options.deleteSourceDirectory] Indicates that as an + * optimization instead of deleting each individual source stream, delete the + * source stream folder if all streams are in the same folder instead. This + * results in a substantial performance improvement when the only streams in + * the folder are part of the concatenation operation. WARNING: This includes + * the deletion of any other files that are not source files. Only set this to + * true when source files are the only files in the source directory. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + msConcat(accountName, path, streamContents, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._msConcat(accountName, path, streamContents, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._msConcat(accountName, path, streamContents, options, optionalCallback); + } + } + + /** + * Get the list of file status objects specified by the file path, with + * optional pagination parameters + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * directory to list. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.listSize] Gets or sets the number of items to + * return. Optional. + * + * @param {string} [options.listAfter] Gets or sets the item or lexographical + * index after which to begin returning results. For example, a file list of + * 'a','b','d' and listAfter='b' will return 'd', and a listAfter='c' will also + * return 'd'. Optional. + * + * @param {string} [options.listBefore] Gets or sets the item or lexographical + * index before which to begin returning results. For example, a file list of + * 'a','b','d' and listBefore='d' will return 'a','b', and a listBefore='c' + * will also return 'a','b'. Optional. + * + * @param {boolean} [options.tooId] An optional switch to return friendly names + * in place of owner and group. tooid=false returns friendly names instead of + * the AAD Object ID. Default value is true, returning AAD object IDs. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listFileStatusWithHttpOperationResponse(accountName, path, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listFileStatus(accountName, path, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get the list of file status objects specified by the file path, with + * optional pagination parameters + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * directory to list. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.listSize] Gets or sets the number of items to + * return. Optional. + * + * @param {string} [options.listAfter] Gets or sets the item or lexographical + * index after which to begin returning results. For example, a file list of + * 'a','b','d' and listAfter='b' will return 'd', and a listAfter='c' will also + * return 'd'. Optional. + * + * @param {string} [options.listBefore] Gets or sets the item or lexographical + * index before which to begin returning results. For example, a file list of + * 'a','b','d' and listBefore='d' will return 'a','b', and a listBefore='c' + * will also return 'a','b'. Optional. + * + * @param {boolean} [options.tooId] An optional switch to return friendly names + * in place of owner and group. tooid=false returns friendly names instead of + * the AAD Object ID. Default value is true, returning AAD object IDs. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {FileStatusesResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link FileStatusesResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listFileStatus(accountName, path, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listFileStatus(accountName, path, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listFileStatus(accountName, path, options, optionalCallback); + } + } + + /** + * Gets the file content summary object specified by the file path. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file for which to retrieve the summary. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getContentSummaryWithHttpOperationResponse(accountName, path, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getContentSummary(accountName, path, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the file content summary object specified by the file path. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file for which to retrieve the summary. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ContentSummaryResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ContentSummaryResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + getContentSummary(accountName, path, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getContentSummary(accountName, path, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getContentSummary(accountName, path, options, optionalCallback); + } + } + + /** + * Get the file status object specified by the file path. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory for which to retrieve the status. + * + * @param {object} [options] Optional Parameters. + * + * @param {boolean} [options.tooId] An optional switch to return friendly names + * in place of owner and group. tooid=false returns friendly names instead of + * the AAD Object ID. Default value is true, returning AAD object IDs. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getFileStatusWithHttpOperationResponse(accountName, path, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getFileStatus(accountName, path, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get the file status object specified by the file path. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory for which to retrieve the status. + * + * @param {object} [options] Optional Parameters. + * + * @param {boolean} [options.tooId] An optional switch to return friendly names + * in place of owner and group. tooid=false returns friendly names instead of + * the AAD Object ID. Default value is true, returning AAD object IDs. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {FileStatusResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link FileStatusResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + getFileStatus(accountName, path, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getFileStatus(accountName, path, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getFileStatus(accountName, path, options, optionalCallback); + } + } + + /** + * Opens and reads from the specified file. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file to open. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.length] The number of bytes that the server will + * attempt to retrieve. It will retrieve <= length bytes. + * + * @param {number} [options.offset] The byte offset to start reading data from. + * + * @param {uuid} [options.fileSessionId] Optional unique GUID per file + * indicating all the reads with the same fileSessionId are from the same + * client and same session. This will give a performance benefit. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + openWithHttpOperationResponse(accountName, path, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._open(accountName, path, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Opens and reads from the specified file. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file to open. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.length] The number of bytes that the server will + * attempt to retrieve. It will retrieve <= length bytes. + * + * @param {number} [options.offset] The byte offset to start reading data from. + * + * @param {uuid} [options.fileSessionId] Optional unique GUID per file + * indicating all the reads with the same fileSessionId are from the same + * client and same session. This will give a performance benefit. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {Object} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + open(accountName, path, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._open(accountName, path, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._open(accountName, path, options, optionalCallback); + } + } + + /** + * Used for serial appends to the specified file. NOTE: The target must not + * contain data added by ConcurrentAppend. ConcurrentAppend and Append cannot + * be used interchangeably; once a target file has been modified using either + * of these append options, the other append option cannot be used on the + * target file. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file to which to append. + * + * @param {object} streamContents The file contents to include when appending + * to the file. The maximum content size is 4MB. For content larger than 4MB + * you must append the content in 4MB chunks. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.offset] The optional offset in the stream to begin + * the append operation. Default is to append at the end of the stream. + * + * @param {string} [options.syncFlag] Optionally indicates what to do after + * completion of the concurrent append. DATA indicates that more data will be + * sent immediately by the client, the file handle should remain open/locked, + * and file metadata (including file length, last modified time) should NOT get + * updated. METADATA indicates that more data will be sent immediately by the + * client, the file handle should remain open/locked, and file metadata should + * get updated. CLOSE indicates that the client is done sending data, the file + * handle should be closed/unlocked, and file metadata should get updated. + * Possible values include: 'DATA', 'METADATA', 'CLOSE' + * + * @param {uuid} [options.leaseId] Optional unique GUID per file to ensure + * single writer semantics, meaning that only clients that append to the file + * with the same leaseId will be allowed to do so. + * + * @param {uuid} [options.fileSessionId] Optional unique GUID per file + * indicating all the appends with the same fileSessionId are from the same + * client and same session. This will give a performance benefit when syncFlag + * is DATA or METADATA. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + appendWithHttpOperationResponse(accountName, path, streamContents, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._append(accountName, path, streamContents, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Used for serial appends to the specified file. NOTE: The target must not + * contain data added by ConcurrentAppend. ConcurrentAppend and Append cannot + * be used interchangeably; once a target file has been modified using either + * of these append options, the other append option cannot be used on the + * target file. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file to which to append. + * + * @param {object} streamContents The file contents to include when appending + * to the file. The maximum content size is 4MB. For content larger than 4MB + * you must append the content in 4MB chunks. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.offset] The optional offset in the stream to begin + * the append operation. Default is to append at the end of the stream. + * + * @param {string} [options.syncFlag] Optionally indicates what to do after + * completion of the concurrent append. DATA indicates that more data will be + * sent immediately by the client, the file handle should remain open/locked, + * and file metadata (including file length, last modified time) should NOT get + * updated. METADATA indicates that more data will be sent immediately by the + * client, the file handle should remain open/locked, and file metadata should + * get updated. CLOSE indicates that the client is done sending data, the file + * handle should be closed/unlocked, and file metadata should get updated. + * Possible values include: 'DATA', 'METADATA', 'CLOSE' + * + * @param {uuid} [options.leaseId] Optional unique GUID per file to ensure + * single writer semantics, meaning that only clients that append to the file + * with the same leaseId will be allowed to do so. + * + * @param {uuid} [options.fileSessionId] Optional unique GUID per file + * indicating all the appends with the same fileSessionId are from the same + * client and same session. This will give a performance benefit when syncFlag + * is DATA or METADATA. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + append(accountName, path, streamContents, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._append(accountName, path, streamContents, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._append(accountName, path, streamContents, options, optionalCallback); + } + } + + /** + * Creates a file with optionally specified content. NOTE: If content is + * provided, the resulting file cannot be modified using ConcurrentAppend. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file to create. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.streamContents] The file contents to include when + * creating the file. This parameter is optional, resulting in an empty file if + * not specified. The maximum content size is 4MB. For content larger than + * 4MB you must append the content in 4MB chunks. + * + * @param {boolean} [options.overwrite] The indication of if the file should be + * overwritten. + * + * @param {string} [options.syncFlag] Optionally indicates what to do after + * completion of the create. DATA indicates that more data will be sent + * immediately by the client, the file handle should remain open/locked, and + * file metadata (including file length, last modified time) should NOT get + * updated. METADATA indicates that more data will be sent immediately by the + * client, the file handle should remain open/locked, and file metadata should + * get updated. CLOSE indicates that the client is done sending data, the file + * handle should be closed/unlocked, and file metadata should get updated. + * Possible values include: 'DATA', 'METADATA', 'CLOSE' + * + * @param {uuid} [options.leaseId] Optional unique GUID per file to ensure + * single writer semantics, meaning that only clients that append to the file + * with the same leaseId will be allowed to do so. + * + * @param {number} [options.permission] The octal representation of the unnamed + * user, mask and other permissions that should be set for the file when + * created. If not specified, it inherits these from the container. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createWithHttpOperationResponse(accountName, path, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._create(accountName, path, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a file with optionally specified content. NOTE: If content is + * provided, the resulting file cannot be modified using ConcurrentAppend. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file to create. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.streamContents] The file contents to include when + * creating the file. This parameter is optional, resulting in an empty file if + * not specified. The maximum content size is 4MB. For content larger than + * 4MB you must append the content in 4MB chunks. + * + * @param {boolean} [options.overwrite] The indication of if the file should be + * overwritten. + * + * @param {string} [options.syncFlag] Optionally indicates what to do after + * completion of the create. DATA indicates that more data will be sent + * immediately by the client, the file handle should remain open/locked, and + * file metadata (including file length, last modified time) should NOT get + * updated. METADATA indicates that more data will be sent immediately by the + * client, the file handle should remain open/locked, and file metadata should + * get updated. CLOSE indicates that the client is done sending data, the file + * handle should be closed/unlocked, and file metadata should get updated. + * Possible values include: 'DATA', 'METADATA', 'CLOSE' + * + * @param {uuid} [options.leaseId] Optional unique GUID per file to ensure + * single writer semantics, meaning that only clients that append to the file + * with the same leaseId will be allowed to do so. + * + * @param {number} [options.permission] The octal representation of the unnamed + * user, mask and other permissions that should be set for the file when + * created. If not specified, it inherits these from the container. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + create(accountName, path, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._create(accountName, path, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(accountName, path, options, optionalCallback); + } + } + + /** + * Sets the Access Control List (ACL) for a file or folder. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory on which to set the ACL. + * + * @param {string} aclspec The ACL spec included in ACL creation operations in + * the format '[default:]user|group|other::r|-w|-x|-' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + setAclWithHttpOperationResponse(accountName, path, aclspec, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._setAcl(accountName, path, aclspec, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Sets the Access Control List (ACL) for a file or folder. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory on which to set the ACL. + * + * @param {string} aclspec The ACL spec included in ACL creation operations in + * the format '[default:]user|group|other::r|-w|-x|-' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + setAcl(accountName, path, aclspec, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._setAcl(accountName, path, aclspec, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._setAcl(accountName, path, aclspec, options, optionalCallback); + } + } + + /** + * Modifies existing Access Control List (ACL) entries on a file or folder. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory with the ACL being modified. + * + * @param {string} aclspec The ACL specification included in ACL modification + * operations in the format '[default:]user|group|other::r|-w|-x|-' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + modifyAclEntriesWithHttpOperationResponse(accountName, path, aclspec, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._modifyAclEntries(accountName, path, aclspec, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Modifies existing Access Control List (ACL) entries on a file or folder. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory with the ACL being modified. + * + * @param {string} aclspec The ACL specification included in ACL modification + * operations in the format '[default:]user|group|other::r|-w|-x|-' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + modifyAclEntries(accountName, path, aclspec, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._modifyAclEntries(accountName, path, aclspec, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._modifyAclEntries(accountName, path, aclspec, options, optionalCallback); + } + } + + /** + * Removes existing Access Control List (ACL) entries for a file or folder. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory with the ACL being removed. + * + * @param {string} aclspec The ACL spec included in ACL removal operations in + * the format '[default:]user|group|other' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + removeAclEntriesWithHttpOperationResponse(accountName, path, aclspec, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._removeAclEntries(accountName, path, aclspec, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Removes existing Access Control List (ACL) entries for a file or folder. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory with the ACL being removed. + * + * @param {string} aclspec The ACL spec included in ACL removal operations in + * the format '[default:]user|group|other' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + removeAclEntries(accountName, path, aclspec, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._removeAclEntries(accountName, path, aclspec, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._removeAclEntries(accountName, path, aclspec, options, optionalCallback); + } + } + + /** + * Removes the existing Default Access Control List (ACL) of the specified + * directory. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * directory with the default ACL being removed. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + removeDefaultAclWithHttpOperationResponse(accountName, path, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._removeDefaultAcl(accountName, path, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Removes the existing Default Access Control List (ACL) of the specified + * directory. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * directory with the default ACL being removed. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + removeDefaultAcl(accountName, path, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._removeDefaultAcl(accountName, path, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._removeDefaultAcl(accountName, path, options, optionalCallback); + } + } + + /** + * Removes the existing Access Control List (ACL) of the specified file or + * directory. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory with the ACL being removed. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + removeAclWithHttpOperationResponse(accountName, path, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._removeAcl(accountName, path, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Removes the existing Access Control List (ACL) of the specified file or + * directory. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory with the ACL being removed. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + removeAcl(accountName, path, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._removeAcl(accountName, path, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._removeAcl(accountName, path, options, optionalCallback); + } + } + + /** + * Gets Access Control List (ACL) entries for the specified file or directory. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory for which to get the ACL. + * + * @param {object} [options] Optional Parameters. + * + * @param {boolean} [options.tooId] An optional switch to return friendly names + * in place of object ID for ACL entries. tooid=false returns friendly names + * instead of the AAD Object ID. Default value is true, returning AAD object + * IDs. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getAclStatusWithHttpOperationResponse(accountName, path, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getAclStatus(accountName, path, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets Access Control List (ACL) entries for the specified file or directory. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory for which to get the ACL. + * + * @param {object} [options] Optional Parameters. + * + * @param {boolean} [options.tooId] An optional switch to return friendly names + * in place of object ID for ACL entries. tooid=false returns friendly names + * instead of the AAD Object ID. Default value is true, returning AAD object + * IDs. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {AclStatusResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link AclStatusResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + getAclStatus(accountName, path, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getAclStatus(accountName, path, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getAclStatus(accountName, path, options, optionalCallback); + } + } + + /** + * Deletes the requested file or directory, optionally recursively. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory to delete. + * + * @param {object} [options] Optional Parameters. + * + * @param {boolean} [options.recursive] The optional switch indicating if the + * delete should be recursive + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(accountName, path, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(accountName, path, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the requested file or directory, optionally recursively. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory to delete. + * + * @param {object} [options] Optional Parameters. + * + * @param {boolean} [options.recursive] The optional switch indicating if the + * delete should be recursive + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {FileOperationResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link FileOperationResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(accountName, path, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(accountName, path, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(accountName, path, options, optionalCallback); + } + } + + /** + * Rename a file or directory. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory to move/rename. + * + * @param {string} destination The path to move/rename the file or folder to + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + renameWithHttpOperationResponse(accountName, path, destination, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._rename(accountName, path, destination, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Rename a file or directory. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory to move/rename. + * + * @param {string} destination The path to move/rename the file or folder to + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {FileOperationResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link FileOperationResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + rename(accountName, path, destination, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._rename(accountName, path, destination, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._rename(accountName, path, destination, options, optionalCallback); + } + } + + /** + * Sets the owner of a file or directory. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory for which to set the owner. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.owner] The AAD Object ID of the user owner of the + * file or directory. If empty, the property will remain unchanged. + * + * @param {string} [options.group] The AAD Object ID of the group owner of the + * file or directory. If empty, the property will remain unchanged. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + setOwnerWithHttpOperationResponse(accountName, path, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._setOwner(accountName, path, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Sets the owner of a file or directory. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory for which to set the owner. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.owner] The AAD Object ID of the user owner of the + * file or directory. If empty, the property will remain unchanged. + * + * @param {string} [options.group] The AAD Object ID of the group owner of the + * file or directory. If empty, the property will remain unchanged. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + setOwner(accountName, path, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._setOwner(accountName, path, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._setOwner(accountName, path, options, optionalCallback); + } + } + + /** + * Sets the permission of the file or folder. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory for which to set the permission. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.permission] A string representation of the + * permission (i.e 'rwx'). If empty, this property remains unchanged. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + setPermissionWithHttpOperationResponse(accountName, path, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._setPermission(accountName, path, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Sets the permission of the file or folder. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory for which to set the permission. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.permission] A string representation of the + * permission (i.e 'rwx'). If empty, this property remains unchanged. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + setPermission(accountName, path, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._setPermission(accountName, path, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._setPermission(accountName, path, options, optionalCallback); + } + } + +} + +module.exports = FileSystem; diff --git a/lib/services/datalake.Store/lib/filesystem/operations/index.d.ts b/lib/services/datalake.Store/lib/filesystem/operations/index.d.ts new file mode 100644 index 0000000000..cd17fe23fc --- /dev/null +++ b/lib/services/datalake.Store/lib/filesystem/operations/index.d.ts @@ -0,0 +1,1758 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. +*/ + +import { ServiceClientOptions, RequestOptions, ServiceCallback, HttpOperationResponse } from 'ms-rest'; +import * as stream from 'stream'; +import * as models from '../models'; + + +/** + * @class + * FileSystem + * __NOTE__: An instance of this class is automatically created for an + * instance of the DataLakeStoreFileSystemManagementClient. + */ +export interface FileSystem { + + + /** + * Sets or removes the expiration time on the specified file. This operation + * can only be executed against files. Folders are not supported. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file on which to set or remove the expiration time. + * + * @param {string} expiryOption Indicates the type of expiration to use for the + * file: 1. NeverExpire: ExpireTime is ignored. 2. RelativeToNow: ExpireTime is + * an integer in milliseconds representing the expiration date relative to when + * file expiration is updated. 3. RelativeToCreationDate: ExpireTime is an + * integer in milliseconds representing the expiration date relative to file + * creation. 4. Absolute: ExpireTime is an integer in milliseconds, as a Unix + * timestamp relative to 1/1/1970 00:00:00. Possible values include: + * 'NeverExpire', 'RelativeToNow', 'RelativeToCreationDate', 'Absolute' + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.expireTime] The time that the file will expire, + * corresponding to the ExpiryOption that was set. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + setFileExpiryWithHttpOperationResponse(accountName: string, path: string, expiryOption: string, options?: { expireTime? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Sets or removes the expiration time on the specified file. This operation + * can only be executed against files. Folders are not supported. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file on which to set or remove the expiration time. + * + * @param {string} expiryOption Indicates the type of expiration to use for the + * file: 1. NeverExpire: ExpireTime is ignored. 2. RelativeToNow: ExpireTime is + * an integer in milliseconds representing the expiration date relative to when + * file expiration is updated. 3. RelativeToCreationDate: ExpireTime is an + * integer in milliseconds representing the expiration date relative to file + * creation. 4. Absolute: ExpireTime is an integer in milliseconds, as a Unix + * timestamp relative to 1/1/1970 00:00:00. Possible values include: + * 'NeverExpire', 'RelativeToNow', 'RelativeToCreationDate', 'Absolute' + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.expireTime] The time that the file will expire, + * corresponding to the ExpiryOption that was set. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + setFileExpiry(accountName: string, path: string, expiryOption: string, options?: { expireTime? : number, customHeaders? : { [headerName: string]: string; } }): Promise; + setFileExpiry(accountName: string, path: string, expiryOption: string, callback: ServiceCallback): void; + setFileExpiry(accountName: string, path: string, expiryOption: string, options: { expireTime? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Appends to the specified file, optionally first creating the file if it does + * not yet exist. This method supports multiple concurrent appends to the file. + * NOTE: The target must not contain data added by Create or normal (serial) + * Append. ConcurrentAppend and Append cannot be used interchangeably; once a + * target file has been modified using either of these append options, the + * other append option cannot be used on the target file. ConcurrentAppend does + * not guarantee order and can result in duplicated data landing in the target + * file. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file to which to append using concurrent append. + * + * @param {object} streamContents The file contents to include when appending + * to the file. The maximum content size is 4MB. For content larger than 4MB + * you must append the content in 4MB chunks. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.appendMode] Indicates the concurrent append call + * should create the file if it doesn't exist or just open the existing file + * for append. Possible values include: 'autocreate' + * + * @param {string} [options.syncFlag] Optionally indicates what to do after + * completion of the concurrent append. DATA indicates that more data will be + * sent immediately by the client, the file handle should remain open/locked, + * and file metadata (including file length, last modified time) should NOT get + * updated. METADATA indicates that more data will be sent immediately by the + * client, the file handle should remain open/locked, and file metadata should + * get updated. CLOSE indicates that the client is done sending data, the file + * handle should be closed/unlocked, and file metadata should get updated. + * Possible values include: 'DATA', 'METADATA', 'CLOSE' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + concurrentAppendWithHttpOperationResponse(accountName: string, path: string, streamContents: stream.Readable, options?: { appendMode? : string, syncFlag? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Appends to the specified file, optionally first creating the file if it does + * not yet exist. This method supports multiple concurrent appends to the file. + * NOTE: The target must not contain data added by Create or normal (serial) + * Append. ConcurrentAppend and Append cannot be used interchangeably; once a + * target file has been modified using either of these append options, the + * other append option cannot be used on the target file. ConcurrentAppend does + * not guarantee order and can result in duplicated data landing in the target + * file. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file to which to append using concurrent append. + * + * @param {object} streamContents The file contents to include when appending + * to the file. The maximum content size is 4MB. For content larger than 4MB + * you must append the content in 4MB chunks. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.appendMode] Indicates the concurrent append call + * should create the file if it doesn't exist or just open the existing file + * for append. Possible values include: 'autocreate' + * + * @param {string} [options.syncFlag] Optionally indicates what to do after + * completion of the concurrent append. DATA indicates that more data will be + * sent immediately by the client, the file handle should remain open/locked, + * and file metadata (including file length, last modified time) should NOT get + * updated. METADATA indicates that more data will be sent immediately by the + * client, the file handle should remain open/locked, and file metadata should + * get updated. CLOSE indicates that the client is done sending data, the file + * handle should be closed/unlocked, and file metadata should get updated. + * Possible values include: 'DATA', 'METADATA', 'CLOSE' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + concurrentAppend(accountName: string, path: string, streamContents: stream.Readable, options?: { appendMode? : string, syncFlag? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + concurrentAppend(accountName: string, path: string, streamContents: stream.Readable, callback: ServiceCallback): void; + concurrentAppend(accountName: string, path: string, streamContents: stream.Readable, options: { appendMode? : string, syncFlag? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Checks if the specified access is available at the given path. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory for which to check access. + * + * @param {string} fsaction File system operation read/write/execute in string + * form, matching regex pattern '[rwx-]{3}' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + checkAccessWithHttpOperationResponse(accountName: string, path: string, fsaction: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Checks if the specified access is available at the given path. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory for which to check access. + * + * @param {string} fsaction File system operation read/write/execute in string + * form, matching regex pattern '[rwx-]{3}' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + checkAccess(accountName: string, path: string, fsaction: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + checkAccess(accountName: string, path: string, fsaction: string, callback: ServiceCallback): void; + checkAccess(accountName: string, path: string, fsaction: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a directory. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * directory to create. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.permission] Optional octal permission with which + * the directory should be created. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + mkdirsWithHttpOperationResponse(accountName: string, path: string, options?: { permission? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a directory. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * directory to create. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.permission] Optional octal permission with which + * the directory should be created. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {FileOperationResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {FileOperationResult} [result] - The deserialized result object if an error did not occur. + * See {@link FileOperationResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + mkdirs(accountName: string, path: string, options?: { permission? : number, customHeaders? : { [headerName: string]: string; } }): Promise; + mkdirs(accountName: string, path: string, callback: ServiceCallback): void; + mkdirs(accountName: string, path: string, options: { permission? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Concatenates the list of source files into the destination file, removing + * all source files upon success. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * destination file resulting from the concatenation. + * + * @param {array} sources A list of comma separated Data Lake Store paths + * (starting with '/') of the files to concatenate, in the order in which they + * should be concatenated. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + concatWithHttpOperationResponse(accountName: string, path: string, sources: string[], options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Concatenates the list of source files into the destination file, removing + * all source files upon success. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * destination file resulting from the concatenation. + * + * @param {array} sources A list of comma separated Data Lake Store paths + * (starting with '/') of the files to concatenate, in the order in which they + * should be concatenated. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + concat(accountName: string, path: string, sources: string[], options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + concat(accountName: string, path: string, sources: string[], callback: ServiceCallback): void; + concat(accountName: string, path: string, sources: string[], options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Concatenates the list of source files into the destination file, deleting + * all source files upon success. This method accepts more source file paths + * than the Concat method. This method and the parameters it accepts are + * subject to change for usability in an upcoming version. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * destination file resulting from the concatenation. + * + * @param {object} streamContents A list of Data Lake Store paths (starting + * with '/') of the source files. Must be a comma-separated path list in the + * format: sources=/file/path/1.txt,/file/path/2.txt,/file/path/lastfile.csv + * + * @param {object} [options] Optional Parameters. + * + * @param {boolean} [options.deleteSourceDirectory] Indicates that as an + * optimization instead of deleting each individual source stream, delete the + * source stream folder if all streams are in the same folder instead. This + * results in a substantial performance improvement when the only streams in + * the folder are part of the concatenation operation. WARNING: This includes + * the deletion of any other files that are not source files. Only set this to + * true when source files are the only files in the source directory. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + msConcatWithHttpOperationResponse(accountName: string, path: string, streamContents: stream.Readable, options?: { deleteSourceDirectory? : boolean, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Concatenates the list of source files into the destination file, deleting + * all source files upon success. This method accepts more source file paths + * than the Concat method. This method and the parameters it accepts are + * subject to change for usability in an upcoming version. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * destination file resulting from the concatenation. + * + * @param {object} streamContents A list of Data Lake Store paths (starting + * with '/') of the source files. Must be a comma-separated path list in the + * format: sources=/file/path/1.txt,/file/path/2.txt,/file/path/lastfile.csv + * + * @param {object} [options] Optional Parameters. + * + * @param {boolean} [options.deleteSourceDirectory] Indicates that as an + * optimization instead of deleting each individual source stream, delete the + * source stream folder if all streams are in the same folder instead. This + * results in a substantial performance improvement when the only streams in + * the folder are part of the concatenation operation. WARNING: This includes + * the deletion of any other files that are not source files. Only set this to + * true when source files are the only files in the source directory. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + msConcat(accountName: string, path: string, streamContents: stream.Readable, options?: { deleteSourceDirectory? : boolean, customHeaders? : { [headerName: string]: string; } }): Promise; + msConcat(accountName: string, path: string, streamContents: stream.Readable, callback: ServiceCallback): void; + msConcat(accountName: string, path: string, streamContents: stream.Readable, options: { deleteSourceDirectory? : boolean, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get the list of file status objects specified by the file path, with + * optional pagination parameters + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * directory to list. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.listSize] Gets or sets the number of items to + * return. Optional. + * + * @param {string} [options.listAfter] Gets or sets the item or lexographical + * index after which to begin returning results. For example, a file list of + * 'a','b','d' and listAfter='b' will return 'd', and a listAfter='c' will also + * return 'd'. Optional. + * + * @param {string} [options.listBefore] Gets or sets the item or lexographical + * index before which to begin returning results. For example, a file list of + * 'a','b','d' and listBefore='d' will return 'a','b', and a listBefore='c' + * will also return 'a','b'. Optional. + * + * @param {boolean} [options.tooId] An optional switch to return friendly names + * in place of owner and group. tooid=false returns friendly names instead of + * the AAD Object ID. Default value is true, returning AAD object IDs. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listFileStatusWithHttpOperationResponse(accountName: string, path: string, options?: { listSize? : number, listAfter? : string, listBefore? : string, tooId? : boolean, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get the list of file status objects specified by the file path, with + * optional pagination parameters + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * directory to list. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.listSize] Gets or sets the number of items to + * return. Optional. + * + * @param {string} [options.listAfter] Gets or sets the item or lexographical + * index after which to begin returning results. For example, a file list of + * 'a','b','d' and listAfter='b' will return 'd', and a listAfter='c' will also + * return 'd'. Optional. + * + * @param {string} [options.listBefore] Gets or sets the item or lexographical + * index before which to begin returning results. For example, a file list of + * 'a','b','d' and listBefore='d' will return 'a','b', and a listBefore='c' + * will also return 'a','b'. Optional. + * + * @param {boolean} [options.tooId] An optional switch to return friendly names + * in place of owner and group. tooid=false returns friendly names instead of + * the AAD Object ID. Default value is true, returning AAD object IDs. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {FileStatusesResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {FileStatusesResult} [result] - The deserialized result object if an error did not occur. + * See {@link FileStatusesResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listFileStatus(accountName: string, path: string, options?: { listSize? : number, listAfter? : string, listBefore? : string, tooId? : boolean, customHeaders? : { [headerName: string]: string; } }): Promise; + listFileStatus(accountName: string, path: string, callback: ServiceCallback): void; + listFileStatus(accountName: string, path: string, options: { listSize? : number, listAfter? : string, listBefore? : string, tooId? : boolean, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the file content summary object specified by the file path. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file for which to retrieve the summary. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getContentSummaryWithHttpOperationResponse(accountName: string, path: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the file content summary object specified by the file path. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file for which to retrieve the summary. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ContentSummaryResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ContentSummaryResult} [result] - The deserialized result object if an error did not occur. + * See {@link ContentSummaryResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + getContentSummary(accountName: string, path: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getContentSummary(accountName: string, path: string, callback: ServiceCallback): void; + getContentSummary(accountName: string, path: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get the file status object specified by the file path. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory for which to retrieve the status. + * + * @param {object} [options] Optional Parameters. + * + * @param {boolean} [options.tooId] An optional switch to return friendly names + * in place of owner and group. tooid=false returns friendly names instead of + * the AAD Object ID. Default value is true, returning AAD object IDs. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getFileStatusWithHttpOperationResponse(accountName: string, path: string, options?: { tooId? : boolean, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get the file status object specified by the file path. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory for which to retrieve the status. + * + * @param {object} [options] Optional Parameters. + * + * @param {boolean} [options.tooId] An optional switch to return friendly names + * in place of owner and group. tooid=false returns friendly names instead of + * the AAD Object ID. Default value is true, returning AAD object IDs. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {FileStatusResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {FileStatusResult} [result] - The deserialized result object if an error did not occur. + * See {@link FileStatusResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + getFileStatus(accountName: string, path: string, options?: { tooId? : boolean, customHeaders? : { [headerName: string]: string; } }): Promise; + getFileStatus(accountName: string, path: string, callback: ServiceCallback): void; + getFileStatus(accountName: string, path: string, options: { tooId? : boolean, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Opens and reads from the specified file. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file to open. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.length] The number of bytes that the server will + * attempt to retrieve. It will retrieve <= length bytes. + * + * @param {number} [options.offset] The byte offset to start reading data from. + * + * @param {uuid} [options.fileSessionId] Optional unique GUID per file + * indicating all the reads with the same fileSessionId are from the same + * client and same session. This will give a performance benefit. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + openWithHttpOperationResponse(accountName: string, path: string, options?: { length? : number, offset? : number, fileSessionId? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Opens and reads from the specified file. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file to open. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.length] The number of bytes that the server will + * attempt to retrieve. It will retrieve <= length bytes. + * + * @param {number} [options.offset] The byte offset to start reading data from. + * + * @param {uuid} [options.fileSessionId] Optional unique GUID per file + * indicating all the reads with the same fileSessionId are from the same + * client and same session. This will give a performance benefit. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {Object} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Object} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + open(accountName: string, path: string, options?: { length? : number, offset? : number, fileSessionId? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + open(accountName: string, path: string, callback: ServiceCallback): void; + open(accountName: string, path: string, options: { length? : number, offset? : number, fileSessionId? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Used for serial appends to the specified file. NOTE: The target must not + * contain data added by ConcurrentAppend. ConcurrentAppend and Append cannot + * be used interchangeably; once a target file has been modified using either + * of these append options, the other append option cannot be used on the + * target file. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file to which to append. + * + * @param {object} streamContents The file contents to include when appending + * to the file. The maximum content size is 4MB. For content larger than 4MB + * you must append the content in 4MB chunks. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.offset] The optional offset in the stream to begin + * the append operation. Default is to append at the end of the stream. + * + * @param {string} [options.syncFlag] Optionally indicates what to do after + * completion of the concurrent append. DATA indicates that more data will be + * sent immediately by the client, the file handle should remain open/locked, + * and file metadata (including file length, last modified time) should NOT get + * updated. METADATA indicates that more data will be sent immediately by the + * client, the file handle should remain open/locked, and file metadata should + * get updated. CLOSE indicates that the client is done sending data, the file + * handle should be closed/unlocked, and file metadata should get updated. + * Possible values include: 'DATA', 'METADATA', 'CLOSE' + * + * @param {uuid} [options.leaseId] Optional unique GUID per file to ensure + * single writer semantics, meaning that only clients that append to the file + * with the same leaseId will be allowed to do so. + * + * @param {uuid} [options.fileSessionId] Optional unique GUID per file + * indicating all the appends with the same fileSessionId are from the same + * client and same session. This will give a performance benefit when syncFlag + * is DATA or METADATA. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + appendWithHttpOperationResponse(accountName: string, path: string, streamContents: stream.Readable, options?: { offset? : number, syncFlag? : string, leaseId? : string, fileSessionId? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Used for serial appends to the specified file. NOTE: The target must not + * contain data added by ConcurrentAppend. ConcurrentAppend and Append cannot + * be used interchangeably; once a target file has been modified using either + * of these append options, the other append option cannot be used on the + * target file. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file to which to append. + * + * @param {object} streamContents The file contents to include when appending + * to the file. The maximum content size is 4MB. For content larger than 4MB + * you must append the content in 4MB chunks. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.offset] The optional offset in the stream to begin + * the append operation. Default is to append at the end of the stream. + * + * @param {string} [options.syncFlag] Optionally indicates what to do after + * completion of the concurrent append. DATA indicates that more data will be + * sent immediately by the client, the file handle should remain open/locked, + * and file metadata (including file length, last modified time) should NOT get + * updated. METADATA indicates that more data will be sent immediately by the + * client, the file handle should remain open/locked, and file metadata should + * get updated. CLOSE indicates that the client is done sending data, the file + * handle should be closed/unlocked, and file metadata should get updated. + * Possible values include: 'DATA', 'METADATA', 'CLOSE' + * + * @param {uuid} [options.leaseId] Optional unique GUID per file to ensure + * single writer semantics, meaning that only clients that append to the file + * with the same leaseId will be allowed to do so. + * + * @param {uuid} [options.fileSessionId] Optional unique GUID per file + * indicating all the appends with the same fileSessionId are from the same + * client and same session. This will give a performance benefit when syncFlag + * is DATA or METADATA. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + append(accountName: string, path: string, streamContents: stream.Readable, options?: { offset? : number, syncFlag? : string, leaseId? : string, fileSessionId? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + append(accountName: string, path: string, streamContents: stream.Readable, callback: ServiceCallback): void; + append(accountName: string, path: string, streamContents: stream.Readable, options: { offset? : number, syncFlag? : string, leaseId? : string, fileSessionId? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a file with optionally specified content. NOTE: If content is + * provided, the resulting file cannot be modified using ConcurrentAppend. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file to create. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.streamContents] The file contents to include when + * creating the file. This parameter is optional, resulting in an empty file if + * not specified. The maximum content size is 4MB. For content larger than + * 4MB you must append the content in 4MB chunks. + * + * @param {boolean} [options.overwrite] The indication of if the file should be + * overwritten. + * + * @param {string} [options.syncFlag] Optionally indicates what to do after + * completion of the create. DATA indicates that more data will be sent + * immediately by the client, the file handle should remain open/locked, and + * file metadata (including file length, last modified time) should NOT get + * updated. METADATA indicates that more data will be sent immediately by the + * client, the file handle should remain open/locked, and file metadata should + * get updated. CLOSE indicates that the client is done sending data, the file + * handle should be closed/unlocked, and file metadata should get updated. + * Possible values include: 'DATA', 'METADATA', 'CLOSE' + * + * @param {uuid} [options.leaseId] Optional unique GUID per file to ensure + * single writer semantics, meaning that only clients that append to the file + * with the same leaseId will be allowed to do so. + * + * @param {number} [options.permission] The octal representation of the unnamed + * user, mask and other permissions that should be set for the file when + * created. If not specified, it inherits these from the container. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createWithHttpOperationResponse(accountName: string, path: string, options?: { streamContents? : stream.Readable, overwrite? : boolean, syncFlag? : string, leaseId? : string, permission? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a file with optionally specified content. NOTE: If content is + * provided, the resulting file cannot be modified using ConcurrentAppend. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file to create. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.streamContents] The file contents to include when + * creating the file. This parameter is optional, resulting in an empty file if + * not specified. The maximum content size is 4MB. For content larger than + * 4MB you must append the content in 4MB chunks. + * + * @param {boolean} [options.overwrite] The indication of if the file should be + * overwritten. + * + * @param {string} [options.syncFlag] Optionally indicates what to do after + * completion of the create. DATA indicates that more data will be sent + * immediately by the client, the file handle should remain open/locked, and + * file metadata (including file length, last modified time) should NOT get + * updated. METADATA indicates that more data will be sent immediately by the + * client, the file handle should remain open/locked, and file metadata should + * get updated. CLOSE indicates that the client is done sending data, the file + * handle should be closed/unlocked, and file metadata should get updated. + * Possible values include: 'DATA', 'METADATA', 'CLOSE' + * + * @param {uuid} [options.leaseId] Optional unique GUID per file to ensure + * single writer semantics, meaning that only clients that append to the file + * with the same leaseId will be allowed to do so. + * + * @param {number} [options.permission] The octal representation of the unnamed + * user, mask and other permissions that should be set for the file when + * created. If not specified, it inherits these from the container. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + create(accountName: string, path: string, options?: { streamContents? : stream.Readable, overwrite? : boolean, syncFlag? : string, leaseId? : string, permission? : number, customHeaders? : { [headerName: string]: string; } }): Promise; + create(accountName: string, path: string, callback: ServiceCallback): void; + create(accountName: string, path: string, options: { streamContents? : stream.Readable, overwrite? : boolean, syncFlag? : string, leaseId? : string, permission? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Sets the Access Control List (ACL) for a file or folder. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory on which to set the ACL. + * + * @param {string} aclspec The ACL spec included in ACL creation operations in + * the format '[default:]user|group|other::r|-w|-x|-' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + setAclWithHttpOperationResponse(accountName: string, path: string, aclspec: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Sets the Access Control List (ACL) for a file or folder. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory on which to set the ACL. + * + * @param {string} aclspec The ACL spec included in ACL creation operations in + * the format '[default:]user|group|other::r|-w|-x|-' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + setAcl(accountName: string, path: string, aclspec: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + setAcl(accountName: string, path: string, aclspec: string, callback: ServiceCallback): void; + setAcl(accountName: string, path: string, aclspec: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Modifies existing Access Control List (ACL) entries on a file or folder. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory with the ACL being modified. + * + * @param {string} aclspec The ACL specification included in ACL modification + * operations in the format '[default:]user|group|other::r|-w|-x|-' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + modifyAclEntriesWithHttpOperationResponse(accountName: string, path: string, aclspec: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Modifies existing Access Control List (ACL) entries on a file or folder. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory with the ACL being modified. + * + * @param {string} aclspec The ACL specification included in ACL modification + * operations in the format '[default:]user|group|other::r|-w|-x|-' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + modifyAclEntries(accountName: string, path: string, aclspec: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + modifyAclEntries(accountName: string, path: string, aclspec: string, callback: ServiceCallback): void; + modifyAclEntries(accountName: string, path: string, aclspec: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Removes existing Access Control List (ACL) entries for a file or folder. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory with the ACL being removed. + * + * @param {string} aclspec The ACL spec included in ACL removal operations in + * the format '[default:]user|group|other' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + removeAclEntriesWithHttpOperationResponse(accountName: string, path: string, aclspec: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Removes existing Access Control List (ACL) entries for a file or folder. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory with the ACL being removed. + * + * @param {string} aclspec The ACL spec included in ACL removal operations in + * the format '[default:]user|group|other' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + removeAclEntries(accountName: string, path: string, aclspec: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + removeAclEntries(accountName: string, path: string, aclspec: string, callback: ServiceCallback): void; + removeAclEntries(accountName: string, path: string, aclspec: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Removes the existing Default Access Control List (ACL) of the specified + * directory. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * directory with the default ACL being removed. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + removeDefaultAclWithHttpOperationResponse(accountName: string, path: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Removes the existing Default Access Control List (ACL) of the specified + * directory. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * directory with the default ACL being removed. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + removeDefaultAcl(accountName: string, path: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + removeDefaultAcl(accountName: string, path: string, callback: ServiceCallback): void; + removeDefaultAcl(accountName: string, path: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Removes the existing Access Control List (ACL) of the specified file or + * directory. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory with the ACL being removed. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + removeAclWithHttpOperationResponse(accountName: string, path: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Removes the existing Access Control List (ACL) of the specified file or + * directory. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory with the ACL being removed. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + removeAcl(accountName: string, path: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + removeAcl(accountName: string, path: string, callback: ServiceCallback): void; + removeAcl(accountName: string, path: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets Access Control List (ACL) entries for the specified file or directory. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory for which to get the ACL. + * + * @param {object} [options] Optional Parameters. + * + * @param {boolean} [options.tooId] An optional switch to return friendly names + * in place of object ID for ACL entries. tooid=false returns friendly names + * instead of the AAD Object ID. Default value is true, returning AAD object + * IDs. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getAclStatusWithHttpOperationResponse(accountName: string, path: string, options?: { tooId? : boolean, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets Access Control List (ACL) entries for the specified file or directory. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory for which to get the ACL. + * + * @param {object} [options] Optional Parameters. + * + * @param {boolean} [options.tooId] An optional switch to return friendly names + * in place of object ID for ACL entries. tooid=false returns friendly names + * instead of the AAD Object ID. Default value is true, returning AAD object + * IDs. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {AclStatusResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {AclStatusResult} [result] - The deserialized result object if an error did not occur. + * See {@link AclStatusResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + getAclStatus(accountName: string, path: string, options?: { tooId? : boolean, customHeaders? : { [headerName: string]: string; } }): Promise; + getAclStatus(accountName: string, path: string, callback: ServiceCallback): void; + getAclStatus(accountName: string, path: string, options: { tooId? : boolean, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the requested file or directory, optionally recursively. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory to delete. + * + * @param {object} [options] Optional Parameters. + * + * @param {boolean} [options.recursive] The optional switch indicating if the + * delete should be recursive + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(accountName: string, path: string, options?: { recursive? : boolean, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the requested file or directory, optionally recursively. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory to delete. + * + * @param {object} [options] Optional Parameters. + * + * @param {boolean} [options.recursive] The optional switch indicating if the + * delete should be recursive + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {FileOperationResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {FileOperationResult} [result] - The deserialized result object if an error did not occur. + * See {@link FileOperationResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(accountName: string, path: string, options?: { recursive? : boolean, customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(accountName: string, path: string, callback: ServiceCallback): void; + deleteMethod(accountName: string, path: string, options: { recursive? : boolean, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Rename a file or directory. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory to move/rename. + * + * @param {string} destination The path to move/rename the file or folder to + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + renameWithHttpOperationResponse(accountName: string, path: string, destination: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Rename a file or directory. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory to move/rename. + * + * @param {string} destination The path to move/rename the file or folder to + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {FileOperationResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {FileOperationResult} [result] - The deserialized result object if an error did not occur. + * See {@link FileOperationResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + rename(accountName: string, path: string, destination: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + rename(accountName: string, path: string, destination: string, callback: ServiceCallback): void; + rename(accountName: string, path: string, destination: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Sets the owner of a file or directory. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory for which to set the owner. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.owner] The AAD Object ID of the user owner of the + * file or directory. If empty, the property will remain unchanged. + * + * @param {string} [options.group] The AAD Object ID of the group owner of the + * file or directory. If empty, the property will remain unchanged. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + setOwnerWithHttpOperationResponse(accountName: string, path: string, options?: { owner? : string, group? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Sets the owner of a file or directory. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory for which to set the owner. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.owner] The AAD Object ID of the user owner of the + * file or directory. If empty, the property will remain unchanged. + * + * @param {string} [options.group] The AAD Object ID of the group owner of the + * file or directory. If empty, the property will remain unchanged. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + setOwner(accountName: string, path: string, options?: { owner? : string, group? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + setOwner(accountName: string, path: string, callback: ServiceCallback): void; + setOwner(accountName: string, path: string, options: { owner? : string, group? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Sets the permission of the file or folder. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory for which to set the permission. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.permission] A string representation of the + * permission (i.e 'rwx'). If empty, this property remains unchanged. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + setPermissionWithHttpOperationResponse(accountName: string, path: string, options?: { permission? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Sets the permission of the file or folder. + * + * @param {string} accountName The Azure Data Lake Store account to execute + * filesystem operations on. + * + * @param {string} path The Data Lake Store path (starting with '/') of the + * file or directory for which to set the permission. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.permission] A string representation of the + * permission (i.e 'rwx'). If empty, this property remains unchanged. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + setPermission(accountName: string, path: string, options?: { permission? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + setPermission(accountName: string, path: string, callback: ServiceCallback): void; + setPermission(accountName: string, path: string, options: { permission? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} diff --git a/lib/services/datalake.Store/lib/filesystem/operations/index.js b/lib/services/datalake.Store/lib/filesystem/operations/index.js new file mode 100644 index 0000000000..bfe29f562c --- /dev/null +++ b/lib/services/datalake.Store/lib/filesystem/operations/index.js @@ -0,0 +1,17 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +exports.FileSystem = require('./fileSystem');