diff --git a/lib/services/iotcentral/lib/iotCentralClient.d.ts b/lib/services/iotcentral/lib/iotCentralClient.d.ts index ba5feaff35..800e93ec54 100644 --- a/lib/services/iotcentral/lib/iotCentralClient.d.ts +++ b/lib/services/iotcentral/lib/iotCentralClient.d.ts @@ -21,7 +21,7 @@ export default class IotCentralClient extends AzureServiceClient { * @class * @param {credentials} credentials - Credentials needed for the client to connect to Azure. * - * @param {uuid} subscriptionId - The subscription identifier. + * @param {string} subscriptionId - The subscription identifier. * * @param {string} [baseUri] - The base URI of the service. * diff --git a/lib/services/iotcentral/lib/iotCentralClient.js b/lib/services/iotcentral/lib/iotCentralClient.js index cdf53658d7..bbe1db6fd6 100644 --- a/lib/services/iotcentral/lib/iotCentralClient.js +++ b/lib/services/iotcentral/lib/iotCentralClient.js @@ -27,7 +27,7 @@ class IotCentralClient extends ServiceClient { /** * Create a IotCentralClient. * @param {credentials} credentials - Credentials needed for the client to connect to Azure. - * @param {uuid} subscriptionId - The subscription identifier. + * @param {string} subscriptionId - The subscription identifier. * @param {string} [baseUri] - The base URI of the service. * @param {object} [options] - The parameter options * @param {Array} [options.filters] - Filters to be added to the request pipeline diff --git a/lib/services/iotcentral/lib/operations/apps.js b/lib/services/iotcentral/lib/operations/apps.js index 134dee6621..62e3b3ef1b 100644 --- a/lib/services/iotcentral/lib/operations/apps.js +++ b/lib/services/iotcentral/lib/operations/apps.js @@ -53,35 +53,18 @@ function _get(resourceGroupName, resourceName, options, callback) { } // Validate try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string' || !msRest.isValidUuid(this.client.subscriptionId)) { - throw new Error('this.client.subscriptionId cannot be null or undefined and it 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.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } - if (resourceGroupName !== null && resourceGroupName !== undefined) { - if (resourceGroupName.length > 64) - { - throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 64'); - } - if (resourceGroupName.length < 1) - { - throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); - } - } if (resourceName === null || resourceName === undefined || typeof resourceName.valueOf() !== 'string') { throw new Error('resourceName cannot be null or undefined and it must be of type string.'); } - if (resourceName !== null && resourceName !== undefined) { - if (resourceName.length > 100) - { - throw new Error('"resourceName" should satisfy the constraint - "MaxLength": 100'); - } - if (resourceName.length < 1) - { - throw new Error('"resourceName" should satisfy the constraint - "MinLength": 1'); - } - } 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.'); } @@ -92,7 +75,7 @@ function _get(resourceGroupName, resourceName, options, callback) { // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/IoTApps/{resourceName}'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId.toString())); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); let queryParameters = []; @@ -475,8 +458,11 @@ function _listBySubscription(options, callback) { } // Validate try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string' || !msRest.isValidUuid(this.client.subscriptionId)) { - throw new Error('this.client.subscriptionId cannot be null or undefined and it 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.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId 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.'); @@ -488,7 +474,7 @@ function _listBySubscription(options, callback) { // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/IoTApps'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId.toString())); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { @@ -609,22 +595,15 @@ function _listByResourceGroup(resourceGroupName, options, callback) { } // Validate try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string' || !msRest.isValidUuid(this.client.subscriptionId)) { - throw new Error('this.client.subscriptionId cannot be null or undefined and it 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.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } - if (resourceGroupName !== null && resourceGroupName !== undefined) { - if (resourceGroupName.length > 64) - { - throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 64'); - } - if (resourceGroupName.length < 1) - { - throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); - } - } 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.'); } @@ -635,7 +614,7 @@ function _listByResourceGroup(resourceGroupName, options, callback) { // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/IoTApps'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId.toString())); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); @@ -758,8 +737,11 @@ function _checkNameAvailability(name, options, callback) { } // Validate try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string' || !msRest.isValidUuid(this.client.subscriptionId)) { - throw new Error('this.client.subscriptionId cannot be null or undefined and it 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.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } if (name === null || name === undefined || typeof name.valueOf() !== 'string') { throw new Error('name cannot be null or undefined and it must be of type string.'); @@ -779,7 +761,7 @@ function _checkNameAvailability(name, options, callback) { // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/checkNameAvailability'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId.toString())); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); if (queryParameters.length > 0) { @@ -941,35 +923,18 @@ function _beginCreateOrUpdate(resourceGroupName, resourceName, app, options, cal } // Validate try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string' || !msRest.isValidUuid(this.client.subscriptionId)) { - throw new Error('this.client.subscriptionId cannot be null or undefined and it 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.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } - if (resourceGroupName !== null && resourceGroupName !== undefined) { - if (resourceGroupName.length > 64) - { - throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 64'); - } - if (resourceGroupName.length < 1) - { - throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); - } - } if (resourceName === null || resourceName === undefined || typeof resourceName.valueOf() !== 'string') { throw new Error('resourceName cannot be null or undefined and it must be of type string.'); } - if (resourceName !== null && resourceName !== undefined) { - if (resourceName.length > 100) - { - throw new Error('"resourceName" should satisfy the constraint - "MaxLength": 100'); - } - if (resourceName.length < 1) - { - throw new Error('"resourceName" should satisfy the constraint - "MinLength": 1'); - } - } if (app === null || app === undefined) { throw new Error('app cannot be null or undefined.'); } @@ -983,7 +948,7 @@ function _beginCreateOrUpdate(resourceGroupName, resourceName, app, options, cal // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/IoTApps/{resourceName}'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId.toString())); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); let queryParameters = []; @@ -1154,35 +1119,18 @@ function _beginUpdate(resourceGroupName, resourceName, appPatch, options, callba } // Validate try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string' || !msRest.isValidUuid(this.client.subscriptionId)) { - throw new Error('this.client.subscriptionId cannot be null or undefined and it 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.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } - if (resourceGroupName !== null && resourceGroupName !== undefined) { - if (resourceGroupName.length > 64) - { - throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 64'); - } - if (resourceGroupName.length < 1) - { - throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); - } - } if (resourceName === null || resourceName === undefined || typeof resourceName.valueOf() !== 'string') { throw new Error('resourceName cannot be null or undefined and it must be of type string.'); } - if (resourceName !== null && resourceName !== undefined) { - if (resourceName.length > 100) - { - throw new Error('"resourceName" should satisfy the constraint - "MaxLength": 100'); - } - if (resourceName.length < 1) - { - throw new Error('"resourceName" should satisfy the constraint - "MinLength": 1'); - } - } if (appPatch === null || appPatch === undefined) { throw new Error('appPatch cannot be null or undefined.'); } @@ -1196,7 +1144,7 @@ function _beginUpdate(resourceGroupName, resourceName, appPatch, options, callba // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/IoTApps/{resourceName}'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId.toString())); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); let queryParameters = []; @@ -1335,35 +1283,18 @@ function _beginDeleteMethod(resourceGroupName, resourceName, options, callback) } // Validate try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string' || !msRest.isValidUuid(this.client.subscriptionId)) { - throw new Error('this.client.subscriptionId cannot be null or undefined and it 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.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } - if (resourceGroupName !== null && resourceGroupName !== undefined) { - if (resourceGroupName.length > 64) - { - throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 64'); - } - if (resourceGroupName.length < 1) - { - throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); - } - } if (resourceName === null || resourceName === undefined || typeof resourceName.valueOf() !== 'string') { throw new Error('resourceName cannot be null or undefined and it must be of type string.'); } - if (resourceName !== null && resourceName !== undefined) { - if (resourceName.length > 100) - { - throw new Error('"resourceName" should satisfy the constraint - "MaxLength": 100'); - } - if (resourceName.length < 1) - { - throw new Error('"resourceName" should satisfy the constraint - "MinLength": 1'); - } - } 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.'); } @@ -1374,7 +1305,7 @@ function _beginDeleteMethod(resourceGroupName, resourceName, options, callback) // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.IoTCentral/IoTApps/{resourceName}'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId.toString())); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{resourceName}', encodeURIComponent(resourceName)); let queryParameters = []; diff --git a/lib/services/iotcentral/lib/operations/operations.js b/lib/services/iotcentral/lib/operations/operations.js index 532ae30eaf..cd2600ac65 100644 --- a/lib/services/iotcentral/lib/operations/operations.js +++ b/lib/services/iotcentral/lib/operations/operations.js @@ -47,6 +47,9 @@ function _list(options, callback) { } // Validate try { + 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.'); }