From ce2fcf031273035eb1e58a4fbb398c33f9a7076a Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 4 Dec 2018 11:07:05 -0800 Subject: [PATCH] Generated from dbf013554fc203756e3ab0752704c6f20f7ef847 (#4276) typo: managementgroups/resource-manager/Microsoft.Management - Resurse -> Recurse - Managment -> Management - Double word "the" --- .../managementgroupsManagement/LICENSE.txt | 42 +- .../managementgroupsManagement/README.md | 80 +- .../lib/managementGroupsAPI.d.ts | 185 ++++- .../lib/managementGroupsAPI.js | 690 +++++++++++++++++- .../models/checkNameAvailabilityRequest.js | 63 ++ .../lib/models/checkNameAvailabilityResult.js | 82 +++ .../models/createManagementGroupChildInfo.js | 120 +++ .../models/createManagementGroupDetails.js | 88 +++ .../models/createManagementGroupRequest.js | 108 ++- .../lib/models/createParentGroupInfo.js | 73 ++ .../lib/models/entityHierarchyItem.js | 114 +++ .../lib/models/entityInfo.js | 193 +++++ .../lib/models/entityListResult.js | 78 ++ .../lib/models/entityParentGroupInfo.js | 54 ++ .../lib/models/errorDetails.js | 13 +- .../lib/models/errorResponse.js | 11 +- .../lib/models/index.d.ts | 610 ++++++++++++---- .../lib/models/index.js | 14 +- .../lib/models/managementGroup.js | 47 +- .../lib/models/managementGroupChildInfo.js | 47 +- .../lib/models/managementGroupDetails.js | 17 +- .../lib/models/managementGroupInfo.js | 11 +- .../lib/models/managementGroupListResult.js | 2 +- .../lib/models/operation.js | 18 +- .../lib/models/operationDisplayProperties.js | 81 ++ .../lib/models/operationListResult.js | 2 +- .../lib/models/operationResults.js | 84 +++ .../lib/models/parentGroupInfo.js | 20 +- .../lib/models/patchManagementGroupRequest.js | 65 ++ .../lib/models/tenantBackfillStatusResult.js | 66 ++ .../lib/operations/entities.js | 683 +++++++++++++++++ .../lib/operations/index.d.ts | 536 ++++++++++++-- .../lib/operations/index.js | 1 + .../managementGroupSubscriptions.js | 6 - .../lib/operations/managementGroups.js | 664 ++++++++++++++--- .../managementgroupsManagement/package.json | 6 +- 36 files changed, 4507 insertions(+), 467 deletions(-) create mode 100644 lib/services/managementgroupsManagement/lib/models/checkNameAvailabilityRequest.js create mode 100644 lib/services/managementgroupsManagement/lib/models/checkNameAvailabilityResult.js create mode 100644 lib/services/managementgroupsManagement/lib/models/createManagementGroupChildInfo.js create mode 100644 lib/services/managementgroupsManagement/lib/models/createManagementGroupDetails.js create mode 100644 lib/services/managementgroupsManagement/lib/models/createParentGroupInfo.js create mode 100644 lib/services/managementgroupsManagement/lib/models/entityHierarchyItem.js create mode 100644 lib/services/managementgroupsManagement/lib/models/entityInfo.js create mode 100644 lib/services/managementgroupsManagement/lib/models/entityListResult.js create mode 100644 lib/services/managementgroupsManagement/lib/models/entityParentGroupInfo.js create mode 100644 lib/services/managementgroupsManagement/lib/models/operationDisplayProperties.js create mode 100644 lib/services/managementgroupsManagement/lib/models/operationResults.js create mode 100644 lib/services/managementgroupsManagement/lib/models/patchManagementGroupRequest.js create mode 100644 lib/services/managementgroupsManagement/lib/models/tenantBackfillStatusResult.js create mode 100644 lib/services/managementgroupsManagement/lib/operations/entities.js diff --git a/lib/services/managementgroupsManagement/LICENSE.txt b/lib/services/managementgroupsManagement/LICENSE.txt index a70e8cf660..5431ba98b9 100644 --- a/lib/services/managementgroupsManagement/LICENSE.txt +++ b/lib/services/managementgroupsManagement/LICENSE.txt @@ -1,21 +1,21 @@ -The MIT License (MIT) - -Copyright (c) 2018 Microsoft - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +The MIT License (MIT) + +Copyright (c) 2018 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/lib/services/managementgroupsManagement/README.md b/lib/services/managementgroupsManagement/README.md index 228407ac5c..0547e9fdb1 100644 --- a/lib/services/managementgroupsManagement/README.md +++ b/lib/services/managementgroupsManagement/README.md @@ -1,37 +1,43 @@ -# Microsoft Azure SDK for Node.js - ManagementGroupsAPI -This project provides a Node.js package for accessing Azure. Right now it supports: -- **Node.js version 6.x.x or higher** - -## Features - - -## How to Install - -```bash -npm install azure-arm-managementgroups -``` - -## How to use - -### Authentication, client creation and list managementGroups as an example. - -```javascript -const msRestAzure = require("ms-rest-azure"); -const ManagementGroupsAPI = require("azure-arm-managementgroups"); -msRestAzure.interactiveLogin().then((creds) => { - const subscriptionId = ""; - const client = new ManagementGroupsAPI(creds, subscriptionId); - const cacheControl = "testcacheControl"; - const skiptoken = "testskiptoken"; - return client.managementGroups.list(cacheControl, skiptoken).then((result) => { - console.log("The result is:"); - console.log(result); - }); -}).catch((err) => { - console.log('An error ocurred:'); - console.dir(err, {depth: null, colors: true}); -}); - -## Related projects - -- [Microsoft Azure SDK for Node.js](https://github.com/Azure/azure-sdk-for-node) +--- +uid: azure-arm-managementgroups +summary: *content + +--- +**This SDK will be deprecated next year and will be replaced by a new TypeScript-based isomorphic SDK (found at https://github.com/Azure/azure-sdk-for-js) which works on Node.js and browsers.** +## Microsoft Azure SDK for Node.js - ManagementGroupsAPI +This project provides a Node.js package for accessing Azure. Right now it supports: +- **Node.js version 6.x.x or higher** + +### Features + + +### How to Install + +```bash +npm install azure-arm-managementgroups +``` + +### How to use + +#### Authentication, client creation and list managementGroups as an example. + +```javascript +const msRestAzure = require("ms-rest-azure"); +const ManagementGroupsAPI = require("azure-arm-managementgroups"); +msRestAzure.interactiveLogin().then((creds) => { + const subscriptionId = ""; + const client = new ManagementGroupsAPI(creds, subscriptionId); + const cacheControl = "testcacheControl"; + const skiptoken = "testskiptoken"; + return client.managementGroups.list(cacheControl, skiptoken).then((result) => { + console.log("The result is:"); + console.log(result); + }); +}).catch((err) => { + console.log('An error occurred:'); + console.dir(err, {depth: null, colors: true}); +}); + +### Related projects + +- [Microsoft Azure SDK for Node.js](https://github.com/Azure/azure-sdk-for-node) diff --git a/lib/services/managementgroupsManagement/lib/managementGroupsAPI.d.ts b/lib/services/managementgroupsManagement/lib/managementGroupsAPI.d.ts index da85c3bbe1..1f6c04d79a 100644 --- a/lib/services/managementgroupsManagement/lib/managementGroupsAPI.d.ts +++ b/lib/services/managementgroupsManagement/lib/managementGroupsAPI.d.ts @@ -8,7 +8,7 @@ * regenerated. */ -import { ServiceClientCredentials } from 'ms-rest'; +import { ServiceClient, ServiceClientOptions, ServiceCallback, HttpOperationResponse, ServiceClientCredentials } from 'ms-rest'; import { AzureServiceClient, AzureServiceClientOptions } from 'ms-rest-azure'; import * as models from "./models"; import * as operations from "./operations"; @@ -32,11 +32,11 @@ export default class ManagementGroupsAPI extends AzureServiceClient { * * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy * - * @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response. + * @param {string} [options.acceptLanguage] - The preferred language for the response. * - * @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. * - * @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * @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, baseUri?: string, options?: AzureServiceClientOptions); @@ -55,6 +55,183 @@ export default class ManagementGroupsAPI extends AzureServiceClient { managementGroups: operations.ManagementGroups; managementGroupSubscriptions: operations.ManagementGroupSubscriptions; operations: operations.Operations; + entities: operations.Entities; + + + /** + * Checks if the specified management group name is valid and unique + * + * @param {object} checkNameAvailabilityRequest Management group name + * availability check parameters. + * + * @param {string} [checkNameAvailabilityRequest.name] the name to check for + * availability + * + * @param {string} [checkNameAvailabilityRequest.type] fully qualified resource + * type which includes provider namespace. Possible values include: + * '/providers/Microsoft.Management/managementGroups' + * + * @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. + */ + checkNameAvailabilityWithHttpOperationResponse(checkNameAvailabilityRequest: models.CheckNameAvailabilityRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Checks if the specified management group name is valid and unique + * + * @param {object} checkNameAvailabilityRequest Management group name + * availability check parameters. + * + * @param {string} [checkNameAvailabilityRequest.name] the name to check for + * availability + * + * @param {string} [checkNameAvailabilityRequest.type] fully qualified resource + * type which includes provider namespace. Possible values include: + * '/providers/Microsoft.Management/managementGroups' + * + * @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 {CheckNameAvailabilityResult} - 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. + * + * {CheckNameAvailabilityResult} [result] - The deserialized result object if an error did not occur. + * See {@link CheckNameAvailabilityResult} 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. + */ + checkNameAvailability(checkNameAvailabilityRequest: models.CheckNameAvailabilityRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + checkNameAvailability(checkNameAvailabilityRequest: models.CheckNameAvailabilityRequest, callback: ServiceCallback): void; + checkNameAvailability(checkNameAvailabilityRequest: models.CheckNameAvailabilityRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Starts backfilling subscriptions for the Tenant. + * + * @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. + */ + startTenantBackfillWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Starts backfilling subscriptions for the Tenant. + * + * @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 {TenantBackfillStatusResult} - 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. + * + * {TenantBackfillStatusResult} [result] - The deserialized result object if an error did not occur. + * See {@link TenantBackfillStatusResult} 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. + */ + startTenantBackfill(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + startTenantBackfill(callback: ServiceCallback): void; + startTenantBackfill(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets tenant backfill status + * + * @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. + */ + tenantBackfillStatusWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets tenant backfill status + * + * @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 {TenantBackfillStatusResult} - 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. + * + * {TenantBackfillStatusResult} [result] - The deserialized result object if an error did not occur. + * See {@link TenantBackfillStatusResult} 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. + */ + tenantBackfillStatus(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + tenantBackfillStatus(callback: ServiceCallback): void; + tenantBackfillStatus(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } export { ManagementGroupsAPI, models as ManagementGroupsAPIModels }; diff --git a/lib/services/managementgroupsManagement/lib/managementGroupsAPI.js b/lib/services/managementgroupsManagement/lib/managementGroupsAPI.js index 2792172ef8..b5837efb1c 100644 --- a/lib/services/managementgroupsManagement/lib/managementGroupsAPI.js +++ b/lib/services/managementgroupsManagement/lib/managementGroupsAPI.js @@ -17,11 +17,432 @@ const msRest = require('ms-rest'); const msRestAzure = require('ms-rest-azure'); const ServiceClient = msRestAzure.AzureServiceClient; +const WebResource = msRest.WebResource; const models = require('./models'); const operations = require('./operations'); +/** + * Checks if the specified management group name is valid and unique + * + * @param {object} checkNameAvailabilityRequest Management group name + * availability check parameters. + * + * @param {string} [checkNameAvailabilityRequest.name] the name to check for + * availability + * + * @param {string} [checkNameAvailabilityRequest.type] fully qualified resource + * type which includes provider namespace. Possible values include: + * '/providers/Microsoft.Management/managementGroups' + * + * @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 CheckNameAvailabilityResult} 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 _checkNameAvailability(checkNameAvailabilityRequest, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (checkNameAvailabilityRequest === null || checkNameAvailabilityRequest === undefined) { + throw new Error('checkNameAvailabilityRequest cannot be null or undefined.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.Management/checkNameAvailability'; + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (checkNameAvailabilityRequest !== null && checkNameAvailabilityRequest !== undefined) { + let requestModelMapper = new client.models['CheckNameAvailabilityRequest']().mapper(); + requestModel = client.serialize(requestModelMapper, checkNameAvailabilityRequest, 'checkNameAvailabilityRequest'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(checkNameAvailabilityRequest, null, 2)}.`); + return callback(serializationError); + } + 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['ErrorResponse']().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['CheckNameAvailabilityResult']().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); + }); +} + +/** + * Starts backfilling subscriptions for the Tenant. + * + * @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 TenantBackfillStatusResult} 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 _startTenantBackfill(options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.Management/startTenantBackfill'; + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.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['ErrorResponse']().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['TenantBackfillStatusResult']().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 tenant backfill status + * + * @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 TenantBackfillStatusResult} 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 _tenantBackfillStatus(options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.Management/tenantBackfillStatus'; + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.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.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.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['ErrorResponse']().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['TenantBackfillStatusResult']().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); + }); +} + /** Class representing a ManagementGroupsAPI. */ class ManagementGroupsAPI extends ServiceClient { /** @@ -33,9 +454,9 @@ class ManagementGroupsAPI extends ServiceClient { * @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.acceptLanguage] - Gets or sets the preferred language for the response. - * @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. - * @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * @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, baseUri, options) { if (credentials === null || credentials === undefined) { @@ -46,7 +467,7 @@ class ManagementGroupsAPI extends ServiceClient { super(credentials, options); - this.apiVersion = '2017-11-01-preview'; + this.apiVersion = '2018-03-01-preview'; this.acceptLanguage = 'en-US'; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; @@ -70,10 +491,271 @@ class ManagementGroupsAPI extends ServiceClient { this.managementGroups = new operations.ManagementGroups(this); this.managementGroupSubscriptions = new operations.ManagementGroupSubscriptions(this); this.operations = new operations.Operations(this); + this.entities = new operations.Entities(this); this.models = models; + this._checkNameAvailability = _checkNameAvailability; + this._startTenantBackfill = _startTenantBackfill; + this._tenantBackfillStatus = _tenantBackfillStatus; msRest.addSerializationMixin(this); } + /** + * Checks if the specified management group name is valid and unique + * + * @param {object} checkNameAvailabilityRequest Management group name + * availability check parameters. + * + * @param {string} [checkNameAvailabilityRequest.name] the name to check for + * availability + * + * @param {string} [checkNameAvailabilityRequest.type] fully qualified resource + * type which includes provider namespace. Possible values include: + * '/providers/Microsoft.Management/managementGroups' + * + * @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. + */ + checkNameAvailabilityWithHttpOperationResponse(checkNameAvailabilityRequest, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._checkNameAvailability(checkNameAvailabilityRequest, 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 management group name is valid and unique + * + * @param {object} checkNameAvailabilityRequest Management group name + * availability check parameters. + * + * @param {string} [checkNameAvailabilityRequest.name] the name to check for + * availability + * + * @param {string} [checkNameAvailabilityRequest.type] fully qualified resource + * type which includes provider namespace. Possible values include: + * '/providers/Microsoft.Management/managementGroups' + * + * @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 {CheckNameAvailabilityResult} - 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 CheckNameAvailabilityResult} 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. + */ + checkNameAvailability(checkNameAvailabilityRequest, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._checkNameAvailability(checkNameAvailabilityRequest, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._checkNameAvailability(checkNameAvailabilityRequest, options, optionalCallback); + } + } + + /** + * Starts backfilling subscriptions for the Tenant. + * + * @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. + */ + startTenantBackfillWithHttpOperationResponse(options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._startTenantBackfill(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Starts backfilling subscriptions for the Tenant. + * + * @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 {TenantBackfillStatusResult} - 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 TenantBackfillStatusResult} 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. + */ + startTenantBackfill(options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._startTenantBackfill(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._startTenantBackfill(options, optionalCallback); + } + } + + /** + * Gets tenant backfill status + * + * @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. + */ + tenantBackfillStatusWithHttpOperationResponse(options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._tenantBackfillStatus(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets tenant backfill status + * + * @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 {TenantBackfillStatusResult} - 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 TenantBackfillStatusResult} 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. + */ + tenantBackfillStatus(options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._tenantBackfillStatus(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._tenantBackfillStatus(options, optionalCallback); + } + } + } module.exports = ManagementGroupsAPI; diff --git a/lib/services/managementgroupsManagement/lib/models/checkNameAvailabilityRequest.js b/lib/services/managementgroupsManagement/lib/models/checkNameAvailabilityRequest.js new file mode 100644 index 0000000000..c91844aed1 --- /dev/null +++ b/lib/services/managementgroupsManagement/lib/models/checkNameAvailabilityRequest.js @@ -0,0 +1,63 @@ +/* + * 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'; + +/** + * Management group name availability check parameters. + * + */ +class CheckNameAvailabilityRequest { + /** + * Create a CheckNameAvailabilityRequest. + * @property {string} [name] the name to check for availability + * @property {string} [type] fully qualified resource type which includes + * provider namespace. Possible values include: + * '/providers/Microsoft.Management/managementGroups' + */ + constructor() { + } + + /** + * Defines the metadata of CheckNameAvailabilityRequest + * + * @returns {object} metadata of CheckNameAvailabilityRequest + * + */ + mapper() { + return { + required: false, + serializedName: 'CheckNameAvailabilityRequest', + type: { + name: 'Composite', + className: 'CheckNameAvailabilityRequest', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + serializedName: 'type', + type: { + name: 'Enum', + allowedValues: [ '/providers/Microsoft.Management/managementGroups' ] + } + } + } + } + }; + } +} + +module.exports = CheckNameAvailabilityRequest; diff --git a/lib/services/managementgroupsManagement/lib/models/checkNameAvailabilityResult.js b/lib/services/managementgroupsManagement/lib/models/checkNameAvailabilityResult.js new file mode 100644 index 0000000000..617efd4f80 --- /dev/null +++ b/lib/services/managementgroupsManagement/lib/models/checkNameAvailabilityResult.js @@ -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. + */ + +'use strict'; + +/** + * Describes the result of the request to check management group name + * availability. + * + */ +class CheckNameAvailabilityResult { + /** + * Create a CheckNameAvailabilityResult. + * @property {boolean} [nameAvailable] Required. True indicates name is valid + * and available. False indicates the name is invalid, unavailable, or both. + * @property {string} [reason] Required if nameAvailable == false. Invalid + * indicates the name provided does not match the resource provider's naming + * requirements (incorrect length, unsupported characters, etc.) + * AlreadyExists indicates that the name is already in use and is therefore + * unavailable. Possible values include: 'Invalid', 'AlreadyExists' + * @property {string} [message] Required if nameAvailable == false. + * Localized. If reason == invalid, provide the user with the reason why the + * given name is invalid, and provide the resource naming requirements so + * that the user can select a valid name. If reason == AlreadyExists, explain + * that is already in use, and direct them to select a different name. + */ + constructor() { + } + + /** + * Defines the metadata of CheckNameAvailabilityResult + * + * @returns {object} metadata of CheckNameAvailabilityResult + * + */ + mapper() { + return { + required: false, + serializedName: 'CheckNameAvailabilityResult', + type: { + name: 'Composite', + className: 'CheckNameAvailabilityResult', + modelProperties: { + nameAvailable: { + required: false, + readOnly: true, + serializedName: 'nameAvailable', + type: { + name: 'Boolean' + } + }, + reason: { + required: false, + readOnly: true, + serializedName: 'reason', + type: { + name: 'Enum', + allowedValues: [ 'Invalid', 'AlreadyExists' ] + } + }, + message: { + required: false, + readOnly: true, + serializedName: 'message', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = CheckNameAvailabilityResult; diff --git a/lib/services/managementgroupsManagement/lib/models/createManagementGroupChildInfo.js b/lib/services/managementgroupsManagement/lib/models/createManagementGroupChildInfo.js new file mode 100644 index 0000000000..987f5a35c0 --- /dev/null +++ b/lib/services/managementgroupsManagement/lib/models/createManagementGroupChildInfo.js @@ -0,0 +1,120 @@ +/* + * 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 child information of a management group used during creation. + * + */ +class CreateManagementGroupChildInfo { + /** + * Create a CreateManagementGroupChildInfo. + * @property {string} [type] The type of child resource. The fully qualified + * resource type which includes provider namespace (e.g. + * /providers/Microsoft.Management/managementGroups). Possible values + * include: '/providers/Microsoft.Management/managementGroups', + * '/subscriptions' + * @property {string} [id] The fully qualified ID for the child resource + * (management group or subscription). For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + * @property {string} [name] The name of the child entity. + * @property {string} [displayName] The friendly name of the child resource. + * @property {array} [roles] The roles definitions associated with the + * management group. + * @property {array} [children] The list of children. + */ + constructor() { + } + + /** + * Defines the metadata of CreateManagementGroupChildInfo + * + * @returns {object} metadata of CreateManagementGroupChildInfo + * + */ + mapper() { + return { + required: false, + serializedName: 'CreateManagementGroupChildInfo', + type: { + name: 'Composite', + className: 'CreateManagementGroupChildInfo', + modelProperties: { + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + displayName: { + required: false, + readOnly: true, + serializedName: 'displayName', + type: { + name: 'String' + } + }, + roles: { + required: false, + readOnly: true, + serializedName: 'roles', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + children: { + required: false, + readOnly: true, + serializedName: 'children', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'CreateManagementGroupChildInfoElementType', + type: { + name: 'Composite', + className: 'CreateManagementGroupChildInfo' + } + } + } + } + } + } + }; + } +} + +module.exports = CreateManagementGroupChildInfo; diff --git a/lib/services/managementgroupsManagement/lib/models/createManagementGroupDetails.js b/lib/services/managementgroupsManagement/lib/models/createManagementGroupDetails.js new file mode 100644 index 0000000000..50578738ec --- /dev/null +++ b/lib/services/managementgroupsManagement/lib/models/createManagementGroupDetails.js @@ -0,0 +1,88 @@ +/* + * 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 details of a management group used during creation. + * + */ +class CreateManagementGroupDetails { + /** + * Create a CreateManagementGroupDetails. + * @property {number} [version] The version number of the object. + * @property {date} [updatedTime] The date and time when this object was last + * updated. + * @property {string} [updatedBy] The identity of the principal or process + * that updated the object. + * @property {object} [parent] Parent. + * @property {string} [parent.id] The fully qualified ID for the parent + * management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + * @property {string} [parent.name] The name of the parent management group + * @property {string} [parent.displayName] The friendly name of the parent + * management group. + */ + constructor() { + } + + /** + * Defines the metadata of CreateManagementGroupDetails + * + * @returns {object} metadata of CreateManagementGroupDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'CreateManagementGroupDetails', + type: { + name: 'Composite', + className: 'CreateManagementGroupDetails', + modelProperties: { + version: { + required: false, + readOnly: true, + serializedName: 'version', + type: { + name: 'Number' + } + }, + updatedTime: { + required: false, + readOnly: true, + serializedName: 'updatedTime', + type: { + name: 'DateTime' + } + }, + updatedBy: { + required: false, + readOnly: true, + serializedName: 'updatedBy', + type: { + name: 'String' + } + }, + parent: { + required: false, + serializedName: 'parent', + type: { + name: 'Composite', + className: 'CreateParentGroupInfo' + } + } + } + } + }; + } +} + +module.exports = CreateManagementGroupDetails; diff --git a/lib/services/managementgroupsManagement/lib/models/createManagementGroupRequest.js b/lib/services/managementgroupsManagement/lib/models/createManagementGroupRequest.js index 016bab4229..2b28822f93 100644 --- a/lib/services/managementgroupsManagement/lib/models/createManagementGroupRequest.js +++ b/lib/services/managementgroupsManagement/lib/models/createManagementGroupRequest.js @@ -10,19 +10,47 @@ 'use strict'; +const models = require('./index'); + /** * Management group creation parameters. * + * @extends models['BaseResource'] */ -class CreateManagementGroupRequest { +class CreateManagementGroupRequest extends models['BaseResource'] { /** * Create a CreateManagementGroupRequest. - * @member {string} [displayName] The friendly name of the management group. - * @member {string} [parentId] (Optional) The fully qualified ID for the + * @property {string} [id] The fully qualified ID for the management group. + * For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + * @property {string} [type] The type of the resource. For example, + * /providers/Microsoft.Management/managementGroups + * @property {string} [name] The name of the management group. For example, + * 00000000-0000-0000-0000-000000000000 + * @property {string} [tenantId] The AAD Tenant ID associated with the + * management group. For example, 00000000-0000-0000-0000-000000000000 + * @property {string} [displayName] The friendly name of the management + * group. If no value is passed then this field will be set to the groupId. + * @property {array} [roles] The roles definitions associated with the + * management group. + * @property {object} [details] Details. + * @property {number} [details.version] The version number of the object. + * @property {date} [details.updatedTime] The date and time when this object + * was last updated. + * @property {string} [details.updatedBy] The identity of the principal or + * process that updated the object. + * @property {object} [details.parent] + * @property {string} [details.parent.id] The fully qualified ID for the * parent management group. For example, * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + * @property {string} [details.parent.name] The name of the parent management + * group + * @property {string} [details.parent.displayName] The friendly name of the + * parent management group. + * @property {array} [children] The list of children. */ constructor() { + super(); } /** @@ -39,19 +67,85 @@ class CreateManagementGroupRequest { name: 'Composite', className: 'CreateManagementGroupRequest', modelProperties: { - displayName: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + type: { required: false, - serializedName: 'displayName', + readOnly: true, + serializedName: 'type', type: { name: 'String' } }, - parentId: { + name: { required: false, - serializedName: 'parentId', + serializedName: 'name', type: { name: 'String' } + }, + tenantId: { + required: false, + readOnly: true, + serializedName: 'properties.tenantId', + type: { + name: 'String' + } + }, + displayName: { + required: false, + nullable: true, + serializedName: 'properties.displayName', + type: { + name: 'String' + } + }, + roles: { + required: false, + nullable: true, + readOnly: true, + serializedName: 'properties.roles', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + details: { + required: false, + serializedName: 'properties.details', + type: { + name: 'Composite', + className: 'CreateManagementGroupDetails' + } + }, + children: { + required: false, + nullable: true, + readOnly: true, + serializedName: 'properties.children', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'CreateManagementGroupChildInfoElementType', + type: { + name: 'Composite', + className: 'CreateManagementGroupChildInfo' + } + } + } } } } diff --git a/lib/services/managementgroupsManagement/lib/models/createParentGroupInfo.js b/lib/services/managementgroupsManagement/lib/models/createParentGroupInfo.js new file mode 100644 index 0000000000..ed0e606315 --- /dev/null +++ b/lib/services/managementgroupsManagement/lib/models/createParentGroupInfo.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'; + +/** + * (Optional) The ID of the parent management group used during creation. + * + */ +class CreateParentGroupInfo { + /** + * Create a CreateParentGroupInfo. + * @property {string} [id] The fully qualified ID for the parent management + * group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + * @property {string} [name] The name of the parent management group + * @property {string} [displayName] The friendly name of the parent + * management group. + */ + constructor() { + } + + /** + * Defines the metadata of CreateParentGroupInfo + * + * @returns {object} metadata of CreateParentGroupInfo + * + */ + mapper() { + return { + required: false, + serializedName: 'CreateParentGroupInfo', + type: { + name: 'Composite', + className: 'CreateParentGroupInfo', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + displayName: { + required: false, + readOnly: true, + serializedName: 'displayName', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = CreateParentGroupInfo; diff --git a/lib/services/managementgroupsManagement/lib/models/entityHierarchyItem.js b/lib/services/managementgroupsManagement/lib/models/entityHierarchyItem.js new file mode 100644 index 0000000000..b704beeb59 --- /dev/null +++ b/lib/services/managementgroupsManagement/lib/models/entityHierarchyItem.js @@ -0,0 +1,114 @@ +/* + * 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'); + +/** + * The management group details for the hierarchy view. + * + * @extends models['BaseResource'] + */ +class EntityHierarchyItem extends models['BaseResource'] { + /** + * Create a EntityHierarchyItem. + * @property {string} [id] The fully qualified ID for the management group. + * For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + * @property {string} [type] The type of the resource. For example, + * /providers/Microsoft.Management/managementGroups + * @property {string} [name] The name of the management group. For example, + * 00000000-0000-0000-0000-000000000000 + * @property {string} [displayName] The friendly name of the management + * group. + * @property {string} [permissions] Permissions. Possible values include: + * 'noaccess', 'view', 'edit', 'delete' + * @property {array} [children] The list of children. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of EntityHierarchyItem + * + * @returns {object} metadata of EntityHierarchyItem + * + */ + mapper() { + return { + required: false, + serializedName: 'EntityHierarchyItem', + type: { + name: 'Composite', + className: 'EntityHierarchyItem', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + displayName: { + required: false, + serializedName: 'properties.displayName', + type: { + name: 'String' + } + }, + permissions: { + required: false, + serializedName: 'properties.permissions', + type: { + name: 'String' + } + }, + children: { + required: false, + nullable: true, + serializedName: 'properties.children', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'EntityHierarchyItemElementType', + type: { + name: 'Composite', + className: 'EntityHierarchyItem' + } + } + } + } + } + } + }; + } +} + +module.exports = EntityHierarchyItem; diff --git a/lib/services/managementgroupsManagement/lib/models/entityInfo.js b/lib/services/managementgroupsManagement/lib/models/entityInfo.js new file mode 100644 index 0000000000..044426d6c5 --- /dev/null +++ b/lib/services/managementgroupsManagement/lib/models/entityInfo.js @@ -0,0 +1,193 @@ +/* + * 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 entity. + * + */ +class EntityInfo { + /** + * Create a EntityInfo. + * @property {string} [id] The fully qualified ID for the entity. For + * example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + * @property {string} [type] The type of the resource. For example, + * /providers/Microsoft.Management/managementGroups + * @property {string} [name] The name of the entity. For example, + * 00000000-0000-0000-0000-000000000000 + * @property {string} [tenantId] The AAD Tenant ID associated with the + * entity. For example, 00000000-0000-0000-0000-000000000000 + * @property {string} [displayName] The friendly name of the management + * group. + * @property {object} [parent] Parent. + * @property {string} [parent.id] The fully qualified ID for the parent + * management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + * @property {string} [permissions] Permissions. Possible values include: + * 'noaccess', 'view', 'edit', 'delete' + * @property {string} [inheritedPermissions] Inherited Permissions. Possible + * values include: 'noaccess', 'view', 'edit', 'delete' + * @property {number} [numberOfDescendants] Number of Descendants. + * @property {number} [numberOfChildren] Number of Children. Number of + * children is the number of Groups and Subscriptions that are exactly one + * level underneath the current Group. + * @property {number} [numberOfChildGroups] Number of Child Groups. Number of + * child groups is the number of Groups that are exactly one level underneath + * the current Group. + * @property {array} [parentDisplayNameChain] The parent display name chain + * from the root group to the immediate parent + * @property {array} [parentNameChain] The parent name chain from the root + * group to the immediate parent + */ + constructor() { + } + + /** + * Defines the metadata of EntityInfo + * + * @returns {object} metadata of EntityInfo + * + */ + mapper() { + return { + required: false, + serializedName: 'EntityInfo', + type: { + name: 'Composite', + className: 'EntityInfo', + modelProperties: { + id: { + required: false, + nullable: true, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + type: { + required: false, + nullable: true, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + tenantId: { + required: false, + nullable: true, + serializedName: 'properties.tenantId', + type: { + name: 'String' + } + }, + displayName: { + required: false, + nullable: true, + serializedName: 'properties.displayName', + type: { + name: 'String' + } + }, + parent: { + required: false, + nullable: true, + serializedName: 'properties.parent', + type: { + name: 'Composite', + className: 'EntityParentGroupInfo' + } + }, + permissions: { + required: false, + serializedName: 'properties.permissions', + type: { + name: 'String' + } + }, + inheritedPermissions: { + required: false, + serializedName: 'properties.inheritedPermissions', + type: { + name: 'String' + } + }, + numberOfDescendants: { + required: false, + nullable: true, + serializedName: 'properties.numberOfDescendants', + type: { + name: 'Number' + } + }, + numberOfChildren: { + required: false, + nullable: true, + serializedName: 'properties.numberOfChildren', + type: { + name: 'Number' + } + }, + numberOfChildGroups: { + required: false, + nullable: true, + serializedName: 'properties.numberOfChildGroups', + type: { + name: 'Number' + } + }, + parentDisplayNameChain: { + required: false, + nullable: true, + serializedName: 'properties.parentDisplayNameChain', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + parentNameChain: { + required: false, + nullable: true, + serializedName: 'properties.parentNameChain', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = EntityInfo; diff --git a/lib/services/managementgroupsManagement/lib/models/entityListResult.js b/lib/services/managementgroupsManagement/lib/models/entityListResult.js new file mode 100644 index 0000000000..8163aa5ad4 --- /dev/null +++ b/lib/services/managementgroupsManagement/lib/models/entityListResult.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'; + +/** + * Describes the result of the request to view entities. + */ +class EntityListResult extends Array { + /** + * Create a EntityListResult. + * @property {number} [count] Total count of records that match the filter + * @property {string} [nextLink] The URL to use for getting the next set of + * results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of EntityListResult + * + * @returns {object} metadata of EntityListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'EntityListResult', + type: { + name: 'Composite', + className: 'EntityListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'EntityInfoElementType', + type: { + name: 'Composite', + className: 'EntityInfo' + } + } + } + }, + count: { + required: false, + readOnly: true, + serializedName: 'count', + type: { + name: 'Number' + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = EntityListResult; diff --git a/lib/services/managementgroupsManagement/lib/models/entityParentGroupInfo.js b/lib/services/managementgroupsManagement/lib/models/entityParentGroupInfo.js new file mode 100644 index 0000000000..dfc8e2573e --- /dev/null +++ b/lib/services/managementgroupsManagement/lib/models/entityParentGroupInfo.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'; + +/** + * (Optional) The ID of the parent management group. + * + */ +class EntityParentGroupInfo { + /** + * Create a EntityParentGroupInfo. + * @property {string} [id] The fully qualified ID for the parent management + * group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + */ + constructor() { + } + + /** + * Defines the metadata of EntityParentGroupInfo + * + * @returns {object} metadata of EntityParentGroupInfo + * + */ + mapper() { + return { + required: false, + serializedName: 'EntityParentGroupInfo', + type: { + name: 'Composite', + className: 'EntityParentGroupInfo', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = EntityParentGroupInfo; diff --git a/lib/services/managementgroupsManagement/lib/models/errorDetails.js b/lib/services/managementgroupsManagement/lib/models/errorDetails.js index 1a66007dc8..c51ea30ef2 100644 --- a/lib/services/managementgroupsManagement/lib/models/errorDetails.js +++ b/lib/services/managementgroupsManagement/lib/models/errorDetails.js @@ -17,8 +17,10 @@ class ErrorDetails { /** * Create a ErrorDetails. - * @member {string} [code] One of a server-defined set of error codes. - * @member {string} [message] A human-readable representation of the error. + * @property {string} [code] One of a server-defined set of error codes. + * @property {string} [message] A human-readable representation of the error. + * @property {string} [details] A human-readable representation of the + * error's details. */ constructor() { } @@ -50,6 +52,13 @@ class ErrorDetails { type: { name: 'String' } + }, + details: { + required: false, + serializedName: 'details', + type: { + name: 'String' + } } } } diff --git a/lib/services/managementgroupsManagement/lib/models/errorResponse.js b/lib/services/managementgroupsManagement/lib/models/errorResponse.js index 7d22b48e4d..d3afd478de 100644 --- a/lib/services/managementgroupsManagement/lib/models/errorResponse.js +++ b/lib/services/managementgroupsManagement/lib/models/errorResponse.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * The error object. * @@ -19,10 +17,13 @@ const models = require('./index'); class ErrorResponse { /** * Create a ErrorResponse. - * @member {object} [error] Error. - * @member {string} [error.code] One of a server-defined set of error codes. - * @member {string} [error.message] A human-readable representation of the + * @property {object} [error] Error. + * @property {string} [error.code] One of a server-defined set of error + * codes. + * @property {string} [error.message] A human-readable representation of the * error. + * @property {string} [error.details] A human-readable representation of the + * error's details. */ constructor() { } diff --git a/lib/services/managementgroupsManagement/lib/models/index.d.ts b/lib/services/managementgroupsManagement/lib/models/index.d.ts index ebf1050925..f223332add 100644 --- a/lib/services/managementgroupsManagement/lib/models/index.d.ts +++ b/lib/services/managementgroupsManagement/lib/models/index.d.ts @@ -1,255 +1,573 @@ /* * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * 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. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { BaseResource } from 'ms-rest-azure'; -import { CloudError } from 'ms-rest-azure'; -import * as moment from 'moment'; +import { BaseResource, CloudError } from "ms-rest-azure"; +import * as moment from "moment"; -export { BaseResource } from 'ms-rest-azure'; -export { CloudError } from 'ms-rest-azure'; +export { + BaseResource, + CloudError +}; /** - * @class - * Initializes a new instance of the ErrorDetails class. - * @constructor * The details of the error. - * - * @member {string} [code] One of a server-defined set of error codes. - * @member {string} [message] A human-readable representation of the error. */ export interface ErrorDetails { + /** + * One of a server-defined set of error codes. + */ code?: string; + /** + * A human-readable representation of the error. + */ message?: string; + /** + * A human-readable representation of the error's details. + */ + details?: string; } /** - * @class - * Initializes a new instance of the ErrorResponse class. - * @constructor * The error object. - * - * @member {object} [error] Error. - * @member {string} [error.code] One of a server-defined set of error codes. - * @member {string} [error.message] A human-readable representation of the - * error. */ export interface ErrorResponse { + /** + * @summary Error + */ error?: ErrorDetails; } /** - * @class - * Initializes a new instance of the OperationDisplay class. - * @constructor * The object that represents the operation. - * - * @member {string} [provider] The name of the provider. - * @member {string} [resource] The resource on which the operation is - * performed. - * @member {string} [operation] The operation that can be performed. - * @member {string} [description] Operation description. */ -export interface OperationDisplay { +export interface OperationDisplayProperties { + /** + * The name of the provider. + */ readonly provider?: string; + /** + * The resource on which the operation is performed. + */ readonly resource?: string; + /** + * The operation that can be performed. + */ readonly operation?: string; + /** + * Operation description. + */ readonly description?: string; } /** - * @class - * Initializes a new instance of the Operation class. - * @constructor * Operation supported by the Microsoft.Management resource provider. - * - * @member {string} [name] Operation name: {provider}/{resource}/{operation}. - * @member {object} [display] The object that represents the operation. - * @member {string} [display.provider] The name of the provider. - * @member {string} [display.resource] The resource on which the operation is - * performed. - * @member {string} [display.operation] The operation that can be performed. - * @member {string} [display.description] Operation description. */ export interface Operation { + /** + * Operation name: {provider}/{resource}/{operation}. + */ readonly name?: string; - display?: OperationDisplay; + /** + * @summary Display + */ + display?: OperationDisplayProperties; +} + +/** + * Describes the result of the request to check management group name availability. + */ +export interface CheckNameAvailabilityResult { + /** + * Required. True indicates name is valid and available. False indicates the name is invalid, + * unavailable, or both. + */ + readonly nameAvailable?: boolean; + /** + * Required if nameAvailable == false. Invalid indicates the name provided does not match the + * resource provider's naming requirements (incorrect length, unsupported characters, etc.) + * AlreadyExists indicates that the name is already in use and is therefore unavailable. Possible + * values include: 'Invalid', 'AlreadyExists' + */ + readonly reason?: string; + /** + * Required if nameAvailable == false. Localized. If reason == invalid, provide the user with the + * reason why the given name is invalid, and provide the resource naming requirements so that the + * user can select a valid name. If reason == AlreadyExists, explain that is already in use, and + * direct them to select a different name. + */ + readonly message?: string; +} + +/** + * The tenant backfill status + */ +export interface TenantBackfillStatusResult { + /** + * The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000 + */ + readonly tenantId?: string; + /** + * The status of the Tenant Backfill. Possible values include: 'NotStarted', + * 'NotStartedButGroupsExist', 'Started', 'Failed', 'Cancelled', 'Completed' + */ + readonly status?: string; } /** - * @class - * Initializes a new instance of the ManagementGroupInfo class. - * @constructor * The management group resource. - * - * @member {string} [id] The fully qualified ID for the management group. For - * example, - * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 - * @member {string} [type] The type of the resource. For example, - * /providers/Microsoft.Management/managementGroups - * @member {string} [name] The name of the management group. For example, - * 00000000-0000-0000-0000-000000000000 - * @member {string} [tenantId] The AAD Tenant ID associated with the management - * group. For example, 00000000-0000-0000-0000-000000000000 - * @member {string} [displayName] The friendly name of the management group. */ export interface ManagementGroupInfo { + /** + * The fully qualified ID for the management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + */ readonly id?: string; + /** + * The type of the resource. For example, /providers/Microsoft.Management/managementGroups + */ readonly type?: string; + /** + * The name of the management group. For example, 00000000-0000-0000-0000-000000000000 + */ readonly name?: string; + /** + * The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000 + */ tenantId?: string; + /** + * The friendly name of the management group. + */ displayName?: string; } /** - * @class - * Initializes a new instance of the ParentGroupInfo class. - * @constructor * (Optional) The ID of the parent management group. - * - * @member {string} [parentId] The fully qualified ID for the parent management - * group. For example, - * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 - * @member {string} [displayName] The friendly name of the parent management - * group. */ export interface ParentGroupInfo { - parentId?: string; + /** + * The fully qualified ID for the parent management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + */ + id?: string; + /** + * The name of the parent management group + */ + name?: string; + /** + * The friendly name of the parent management group. + */ displayName?: string; } /** - * @class - * Initializes a new instance of the ManagementGroupDetails class. - * @constructor * The details of a management group. - * - * @member {number} [version] The version number of the object. - * @member {date} [updatedTime] The date and time when this object was last - * updated. - * @member {string} [updatedBy] The identity of the principal or process that - * updated the object. - * @member {object} [parent] Parent. - * @member {string} [parent.parentId] The fully qualified ID for the parent - * management group. For example, - * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 - * @member {string} [parent.displayName] The friendly name of the parent - * management group. */ export interface ManagementGroupDetails { + /** + * The version number of the object. + */ version?: number; + /** + * The date and time when this object was last updated. + */ updatedTime?: Date; + /** + * The identity of the principal or process that updated the object. + */ updatedBy?: string; + /** + * @summary Parent + */ parent?: ParentGroupInfo; } /** - * @class - * Initializes a new instance of the ManagementGroupChildInfo class. - * @constructor * The child information of a management group. - * - * @member {string} [childType] The type of child resource. Possible values - * include: 'ManagementGroup', 'Subscription' - * @member {string} [childId] The fully qualified ID for the child resource - * (management group or subscription). For example, - * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 - * @member {string} [displayName] The friendly name of the child resource. - * @member {array} [children] The list of children. */ export interface ManagementGroupChildInfo { - childType?: string; - childId?: string; + /** + * @summary The type of child resource. + * @description The fully qualified resource type which includes provider namespace (e.g. + * /providers/Microsoft.Management/managementGroups). Possible values include: + * '/providers/Microsoft.Management/managementGroups', '/subscriptions' + */ + type?: string; + /** + * The fully qualified ID for the child resource (management group or subscription). For + * example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + */ + id?: string; + /** + * The name of the child entity. + */ + name?: string; + /** + * The friendly name of the child resource. + */ displayName?: string; + /** + * The roles definitions associated with the management group. + */ + roles?: string[]; + /** + * The list of children. + */ children?: ManagementGroupChildInfo[]; } /** - * @class - * Initializes a new instance of the ManagementGroup class. - * @constructor * The management group details. - * - * @member {string} [id] The fully qualified ID for the management group. For - * example, - * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 - * @member {string} [type] The type of the resource. For example, - * /providers/Microsoft.Management/managementGroups - * @member {string} [name] The name of the management group. For example, - * 00000000-0000-0000-0000-000000000000 - * @member {string} [tenantId] The AAD Tenant ID associated with the management - * group. For example, 00000000-0000-0000-0000-000000000000 - * @member {string} [displayName] The friendly name of the management group. - * @member {object} [details] Details. - * @member {number} [details.version] The version number of the object. - * @member {date} [details.updatedTime] The date and time when this object was - * last updated. - * @member {string} [details.updatedBy] The identity of the principal or - * process that updated the object. - * @member {object} [details.parent] - * @member {string} [details.parent.parentId] The fully qualified ID for the - * parent management group. For example, - * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 - * @member {string} [details.parent.displayName] The friendly name of the - * parent management group. - * @member {array} [children] The list of children. */ export interface ManagementGroup extends BaseResource { + /** + * The fully qualified ID for the management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + */ readonly id?: string; + /** + * The type of the resource. For example, /providers/Microsoft.Management/managementGroups + */ readonly type?: string; + /** + * The name of the management group. For example, 00000000-0000-0000-0000-000000000000 + */ readonly name?: string; + /** + * The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000 + */ tenantId?: string; + /** + * The friendly name of the management group. + */ displayName?: string; + /** + * The role definitions associated with the management group. + */ + roles?: string[]; + /** + * @summary Details + */ details?: ManagementGroupDetails; + /** + * The list of children. + */ children?: ManagementGroupChildInfo[]; } /** - * @class - * Initializes a new instance of the CreateManagementGroupRequest class. - * @constructor - * Management group creation parameters. - * - * @member {string} [displayName] The friendly name of the management group. - * @member {string} [parentId] (Optional) The fully qualified ID for the parent - * management group. For example, - * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + * The results of an asynchronous operation. + */ +export interface OperationResults { + /** + * The fully qualified ID for the management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + */ + readonly id?: string; + /** + * The type of the resource. For example, /providers/Microsoft.Management/managementGroups + */ + readonly type?: string; + /** + * The name of the management group. For example, 00000000-0000-0000-0000-000000000000 + */ + readonly name?: string; + /** + * @summary Provisioning State + * @description Possible values include: 'Updating' + */ + provisioningState?: string; +} + +/** + * (Optional) The ID of the parent management group. + */ +export interface EntityParentGroupInfo { + /** + * The fully qualified ID for the parent management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + */ + id?: string; +} + +/** + * The entity. */ -export interface CreateManagementGroupRequest { +export interface EntityInfo { + /** + * The fully qualified ID for the entity. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + */ + readonly id?: string; + /** + * The type of the resource. For example, /providers/Microsoft.Management/managementGroups + */ + readonly type?: string; + /** + * The name of the entity. For example, 00000000-0000-0000-0000-000000000000 + */ + readonly name?: string; + /** + * The AAD Tenant ID associated with the entity. For example, + * 00000000-0000-0000-0000-000000000000 + */ + tenantId?: string; + /** + * The friendly name of the management group. + */ displayName?: string; + /** + * @summary Parent + */ + parent?: EntityParentGroupInfo; + /** + * @summary Permissions + * @description Possible values include: 'noaccess', 'view', 'edit', 'delete' + */ + permissions?: string; + /** + * @summary Inherited Permissions + * @description Possible values include: 'noaccess', 'view', 'edit', 'delete' + */ + inheritedPermissions?: string; + /** + * @summary Number of Descendants + */ + numberOfDescendants?: number; + /** + * @summary Number of Children + * @description Number of children is the number of Groups and Subscriptions that are exactly one + * level underneath the current Group. + */ + numberOfChildren?: number; + /** + * @summary Number of Child Groups + * @description Number of child groups is the number of Groups that are exactly one level + * underneath the current Group. + */ + numberOfChildGroups?: number; + /** + * The parent display name chain from the root group to the immediate parent + */ + parentDisplayNameChain?: string[]; + /** + * The parent name chain from the root group to the immediate parent + */ + parentNameChain?: string[]; +} + +/** + * The management group details for the hierarchy view. + */ +export interface EntityHierarchyItem extends BaseResource { + /** + * The fully qualified ID for the management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + */ + readonly id?: string; + /** + * The type of the resource. For example, /providers/Microsoft.Management/managementGroups + */ + readonly type?: string; + /** + * The name of the management group. For example, 00000000-0000-0000-0000-000000000000 + */ + readonly name?: string; + /** + * The friendly name of the management group. + */ + displayName?: string; + /** + * @summary Permissions + * @description Possible values include: 'noaccess', 'view', 'edit', 'delete' + */ + permissions?: string; + /** + * The list of children. + */ + children?: EntityHierarchyItem[]; +} + +/** + * Management group patch parameters. + */ +export interface PatchManagementGroupRequest { + /** + * The friendly name of the management group. + */ + displayName?: string; + /** + * (Optional) The fully qualified ID for the parent management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + */ parentId?: string; } +/** + * (Optional) The ID of the parent management group used during creation. + */ +export interface CreateParentGroupInfo { + /** + * The fully qualified ID for the parent management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + */ + id?: string; + /** + * The name of the parent management group + */ + readonly name?: string; + /** + * The friendly name of the parent management group. + */ + readonly displayName?: string; +} + +/** + * The details of a management group used during creation. + */ +export interface CreateManagementGroupDetails { + /** + * The version number of the object. + */ + readonly version?: number; + /** + * The date and time when this object was last updated. + */ + readonly updatedTime?: Date; + /** + * The identity of the principal or process that updated the object. + */ + readonly updatedBy?: string; + /** + * @summary Parent + */ + parent?: CreateParentGroupInfo; +} + +/** + * The child information of a management group used during creation. + */ +export interface CreateManagementGroupChildInfo { + /** + * @summary The type of child resource. + * @description The fully qualified resource type which includes provider namespace (e.g. + * /providers/Microsoft.Management/managementGroups). Possible values include: + * '/providers/Microsoft.Management/managementGroups', '/subscriptions' + */ + readonly type?: string; + /** + * The fully qualified ID for the child resource (management group or subscription). For + * example, /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + */ + readonly id?: string; + /** + * The name of the child entity. + */ + readonly name?: string; + /** + * The friendly name of the child resource. + */ + readonly displayName?: string; + /** + * The roles definitions associated with the management group. + */ + readonly roles?: string[]; + /** + * The list of children. + */ + readonly children?: CreateManagementGroupChildInfo[]; +} + +/** + * Management group creation parameters. + */ +export interface CreateManagementGroupRequest extends BaseResource { + /** + * The fully qualified ID for the management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + */ + readonly id?: string; + /** + * The type of the resource. For example, /providers/Microsoft.Management/managementGroups + */ + readonly type?: string; + /** + * The name of the management group. For example, 00000000-0000-0000-0000-000000000000 + */ + name?: string; + /** + * The AAD Tenant ID associated with the management group. For example, + * 00000000-0000-0000-0000-000000000000 + */ + readonly tenantId?: string; + /** + * The friendly name of the management group. If no value is passed then this field will be set + * to the groupId. + */ + displayName?: string; + /** + * The roles definitions associated with the management group. + */ + readonly roles?: string[]; + /** + * @summary Details + */ + details?: CreateManagementGroupDetails; + /** + * The list of children. + */ + readonly children?: CreateManagementGroupChildInfo[]; +} + +/** + * Management group name availability check parameters. + */ +export interface CheckNameAvailabilityRequest { + /** + * the name to check for availability + */ + name?: string; + /** + * fully qualified resource type which includes provider namespace. Possible values include: + * '/providers/Microsoft.Management/managementGroups' + */ + type?: string; +} /** - * @class - * Initializes a new instance of the ManagementGroupListResult class. - * @constructor * Describes the result of the request to list management groups. - * - * @member {string} [nextLink] The URL to use for getting the next set of - * results. */ export interface ManagementGroupListResult extends Array { + /** + * The URL to use for getting the next set of results. + */ readonly nextLink?: string; } /** - * @class - * Initializes a new instance of the OperationListResult class. - * @constructor * Describes the result of the request to list Microsoft.Management operations. - * - * @member {string} [nextLink] URL to get the next set of operation list - * results if there are any. */ export interface OperationListResult extends Array { + /** + * URL to get the next set of operation list results if there are any. + */ + readonly nextLink?: string; +} + +/** + * Describes the result of the request to view entities. + */ +export interface EntityListResult extends Array { + /** + * The URL to use for getting the next set of results. + */ readonly nextLink?: string; } diff --git a/lib/services/managementgroupsManagement/lib/models/index.js b/lib/services/managementgroupsManagement/lib/models/index.js index a839d739e3..ffc2efb9f7 100644 --- a/lib/services/managementgroupsManagement/lib/models/index.js +++ b/lib/services/managementgroupsManagement/lib/models/index.js @@ -20,13 +20,25 @@ exports.BaseResource = msRestAzure.BaseResource; exports.CloudError = msRestAzure.CloudError; exports.ErrorDetails = require('./errorDetails'); exports.ErrorResponse = require('./errorResponse'); -exports.OperationDisplay = require('./operationDisplay'); +exports.OperationDisplayProperties = require('./operationDisplayProperties'); exports.Operation = require('./operation'); +exports.CheckNameAvailabilityResult = require('./checkNameAvailabilityResult'); +exports.TenantBackfillStatusResult = require('./tenantBackfillStatusResult'); exports.ManagementGroupInfo = require('./managementGroupInfo'); exports.ParentGroupInfo = require('./parentGroupInfo'); exports.ManagementGroupDetails = require('./managementGroupDetails'); exports.ManagementGroupChildInfo = require('./managementGroupChildInfo'); exports.ManagementGroup = require('./managementGroup'); +exports.OperationResults = require('./operationResults'); +exports.EntityParentGroupInfo = require('./entityParentGroupInfo'); +exports.EntityInfo = require('./entityInfo'); +exports.EntityHierarchyItem = require('./entityHierarchyItem'); +exports.PatchManagementGroupRequest = require('./patchManagementGroupRequest'); +exports.CreateParentGroupInfo = require('./createParentGroupInfo'); +exports.CreateManagementGroupDetails = require('./createManagementGroupDetails'); +exports.CreateManagementGroupChildInfo = require('./createManagementGroupChildInfo'); exports.CreateManagementGroupRequest = require('./createManagementGroupRequest'); +exports.CheckNameAvailabilityRequest = require('./checkNameAvailabilityRequest'); exports.ManagementGroupListResult = require('./managementGroupListResult'); exports.OperationListResult = require('./operationListResult'); +exports.EntityListResult = require('./entityListResult'); diff --git a/lib/services/managementgroupsManagement/lib/models/managementGroup.js b/lib/services/managementgroupsManagement/lib/models/managementGroup.js index 67a1aef391..7369040b62 100644 --- a/lib/services/managementgroupsManagement/lib/models/managementGroup.js +++ b/lib/services/managementgroupsManagement/lib/models/managementGroup.js @@ -20,29 +20,34 @@ const models = require('./index'); class ManagementGroup extends models['BaseResource'] { /** * Create a ManagementGroup. - * @member {string} [id] The fully qualified ID for the management group. + * @property {string} [id] The fully qualified ID for the management group. * For example, * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 - * @member {string} [type] The type of the resource. For example, + * @property {string} [type] The type of the resource. For example, * /providers/Microsoft.Management/managementGroups - * @member {string} [name] The name of the management group. For example, + * @property {string} [name] The name of the management group. For example, * 00000000-0000-0000-0000-000000000000 - * @member {string} [tenantId] The AAD Tenant ID associated with the + * @property {string} [tenantId] The AAD Tenant ID associated with the * management group. For example, 00000000-0000-0000-0000-000000000000 - * @member {string} [displayName] The friendly name of the management group. - * @member {object} [details] Details. - * @member {number} [details.version] The version number of the object. - * @member {date} [details.updatedTime] The date and time when this object + * @property {string} [displayName] The friendly name of the management + * group. + * @property {array} [roles] The role definitions associated with the + * management group. + * @property {object} [details] Details. + * @property {number} [details.version] The version number of the object. + * @property {date} [details.updatedTime] The date and time when this object * was last updated. - * @member {string} [details.updatedBy] The identity of the principal or + * @property {string} [details.updatedBy] The identity of the principal or * process that updated the object. - * @member {object} [details.parent] - * @member {string} [details.parent.parentId] The fully qualified ID for the + * @property {object} [details.parent] + * @property {string} [details.parent.id] The fully qualified ID for the * parent management group. For example, * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 - * @member {string} [details.parent.displayName] The friendly name of the + * @property {string} [details.parent.name] The name of the parent management + * group + * @property {string} [details.parent.displayName] The friendly name of the * parent management group. - * @member {array} [children] The list of children. + * @property {array} [children] The list of children. */ constructor() { super(); @@ -100,6 +105,21 @@ class ManagementGroup extends models['BaseResource'] { name: 'String' } }, + roles: { + required: false, + nullable: true, + serializedName: 'properties.roles', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, details: { required: false, serializedName: 'properties.details', @@ -110,6 +130,7 @@ class ManagementGroup extends models['BaseResource'] { }, children: { required: false, + nullable: true, serializedName: 'properties.children', type: { name: 'Sequence', diff --git a/lib/services/managementgroupsManagement/lib/models/managementGroupChildInfo.js b/lib/services/managementgroupsManagement/lib/models/managementGroupChildInfo.js index 3d469cac20..d6dc487f14 100644 --- a/lib/services/managementgroupsManagement/lib/models/managementGroupChildInfo.js +++ b/lib/services/managementgroupsManagement/lib/models/managementGroupChildInfo.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * The child information of a management group. * @@ -19,13 +17,19 @@ const models = require('./index'); class ManagementGroupChildInfo { /** * Create a ManagementGroupChildInfo. - * @member {string} [childType] The type of child resource. Possible values - * include: 'ManagementGroup', 'Subscription' - * @member {string} [childId] The fully qualified ID for the child resource + * @property {string} [type] The type of child resource. The fully qualified + * resource type which includes provider namespace (e.g. + * /providers/Microsoft.Management/managementGroups). Possible values + * include: '/providers/Microsoft.Management/managementGroups', + * '/subscriptions' + * @property {string} [id] The fully qualified ID for the child resource * (management group or subscription). For example, * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 - * @member {string} [displayName] The friendly name of the child resource. - * @member {array} [children] The list of children. + * @property {string} [name] The name of the child entity. + * @property {string} [displayName] The friendly name of the child resource. + * @property {array} [roles] The roles definitions associated with the + * management group. + * @property {array} [children] The list of children. */ constructor() { } @@ -44,16 +48,23 @@ class ManagementGroupChildInfo { name: 'Composite', className: 'ManagementGroupChildInfo', modelProperties: { - childType: { + type: { + required: false, + serializedName: 'type', + type: { + name: 'String' + } + }, + id: { required: false, - serializedName: 'childType', + serializedName: 'id', type: { name: 'String' } }, - childId: { + name: { required: false, - serializedName: 'childId', + serializedName: 'name', type: { name: 'String' } @@ -65,6 +76,20 @@ class ManagementGroupChildInfo { name: 'String' } }, + roles: { + required: false, + serializedName: 'roles', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, children: { required: false, serializedName: 'children', diff --git a/lib/services/managementgroupsManagement/lib/models/managementGroupDetails.js b/lib/services/managementgroupsManagement/lib/models/managementGroupDetails.js index de7fca0aee..a2546837d6 100644 --- a/lib/services/managementgroupsManagement/lib/models/managementGroupDetails.js +++ b/lib/services/managementgroupsManagement/lib/models/managementGroupDetails.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * The details of a management group. * @@ -19,16 +17,17 @@ const models = require('./index'); class ManagementGroupDetails { /** * Create a ManagementGroupDetails. - * @member {number} [version] The version number of the object. - * @member {date} [updatedTime] The date and time when this object was last + * @property {number} [version] The version number of the object. + * @property {date} [updatedTime] The date and time when this object was last * updated. - * @member {string} [updatedBy] The identity of the principal or process that - * updated the object. - * @member {object} [parent] Parent. - * @member {string} [parent.parentId] The fully qualified ID for the parent + * @property {string} [updatedBy] The identity of the principal or process + * that updated the object. + * @property {object} [parent] Parent. + * @property {string} [parent.id] The fully qualified ID for the parent * management group. For example, * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 - * @member {string} [parent.displayName] The friendly name of the parent + * @property {string} [parent.name] The name of the parent management group + * @property {string} [parent.displayName] The friendly name of the parent * management group. */ constructor() { diff --git a/lib/services/managementgroupsManagement/lib/models/managementGroupInfo.js b/lib/services/managementgroupsManagement/lib/models/managementGroupInfo.js index da2d857693..f15e349a0c 100644 --- a/lib/services/managementgroupsManagement/lib/models/managementGroupInfo.js +++ b/lib/services/managementgroupsManagement/lib/models/managementGroupInfo.js @@ -17,16 +17,17 @@ class ManagementGroupInfo { /** * Create a ManagementGroupInfo. - * @member {string} [id] The fully qualified ID for the management group. + * @property {string} [id] The fully qualified ID for the management group. * For example, * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 - * @member {string} [type] The type of the resource. For example, + * @property {string} [type] The type of the resource. For example, * /providers/Microsoft.Management/managementGroups - * @member {string} [name] The name of the management group. For example, + * @property {string} [name] The name of the management group. For example, * 00000000-0000-0000-0000-000000000000 - * @member {string} [tenantId] The AAD Tenant ID associated with the + * @property {string} [tenantId] The AAD Tenant ID associated with the * management group. For example, 00000000-0000-0000-0000-000000000000 - * @member {string} [displayName] The friendly name of the management group. + * @property {string} [displayName] The friendly name of the management + * group. */ constructor() { } diff --git a/lib/services/managementgroupsManagement/lib/models/managementGroupListResult.js b/lib/services/managementgroupsManagement/lib/models/managementGroupListResult.js index de823d08ad..4147830381 100644 --- a/lib/services/managementgroupsManagement/lib/models/managementGroupListResult.js +++ b/lib/services/managementgroupsManagement/lib/models/managementGroupListResult.js @@ -16,7 +16,7 @@ class ManagementGroupListResult extends Array { /** * Create a ManagementGroupListResult. - * @member {string} [nextLink] The URL to use for getting the next set of + * @property {string} [nextLink] The URL to use for getting the next set of * results. */ constructor() { diff --git a/lib/services/managementgroupsManagement/lib/models/operation.js b/lib/services/managementgroupsManagement/lib/models/operation.js index 52a9bdfb44..79d590f923 100644 --- a/lib/services/managementgroupsManagement/lib/models/operation.js +++ b/lib/services/managementgroupsManagement/lib/models/operation.js @@ -10,8 +10,6 @@ 'use strict'; -const models = require('./index'); - /** * Operation supported by the Microsoft.Management resource provider. * @@ -19,13 +17,15 @@ const models = require('./index'); class Operation { /** * Create a Operation. - * @member {string} [name] Operation name: {provider}/{resource}/{operation}. - * @member {object} [display] The object that represents the operation. - * @member {string} [display.provider] The name of the provider. - * @member {string} [display.resource] The resource on which the operation is + * @property {string} [name] Operation name: + * {provider}/{resource}/{operation}. + * @property {object} [display] Display. + * @property {string} [display.provider] The name of the provider. + * @property {string} [display.resource] The resource on which the operation + * is performed. + * @property {string} [display.operation] The operation that can be * performed. - * @member {string} [display.operation] The operation that can be performed. - * @member {string} [display.description] Operation description. + * @property {string} [display.description] Operation description. */ constructor() { } @@ -57,7 +57,7 @@ class Operation { serializedName: 'display', type: { name: 'Composite', - className: 'OperationDisplay' + className: 'OperationDisplayProperties' } } } diff --git a/lib/services/managementgroupsManagement/lib/models/operationDisplayProperties.js b/lib/services/managementgroupsManagement/lib/models/operationDisplayProperties.js new file mode 100644 index 0000000000..fd9335a0c3 --- /dev/null +++ b/lib/services/managementgroupsManagement/lib/models/operationDisplayProperties.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. + */ + +'use strict'; + +/** + * The object that represents the operation. + * + */ +class OperationDisplayProperties { + /** + * Create a OperationDisplayProperties. + * @property {string} [provider] The name of the provider. + * @property {string} [resource] The resource on which the operation is + * performed. + * @property {string} [operation] The operation that can be performed. + * @property {string} [description] Operation description. + */ + constructor() { + } + + /** + * Defines the metadata of OperationDisplayProperties + * + * @returns {object} metadata of OperationDisplayProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationDisplayProperties', + type: { + name: 'Composite', + className: 'OperationDisplayProperties', + modelProperties: { + provider: { + required: false, + readOnly: true, + serializedName: 'provider', + type: { + name: 'String' + } + }, + resource: { + required: false, + readOnly: true, + serializedName: 'resource', + type: { + name: 'String' + } + }, + operation: { + required: false, + readOnly: true, + serializedName: 'operation', + type: { + name: 'String' + } + }, + description: { + required: false, + readOnly: true, + serializedName: 'description', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OperationDisplayProperties; diff --git a/lib/services/managementgroupsManagement/lib/models/operationListResult.js b/lib/services/managementgroupsManagement/lib/models/operationListResult.js index 1af1684b56..227db0fe87 100644 --- a/lib/services/managementgroupsManagement/lib/models/operationListResult.js +++ b/lib/services/managementgroupsManagement/lib/models/operationListResult.js @@ -16,7 +16,7 @@ class OperationListResult extends Array { /** * Create a OperationListResult. - * @member {string} [nextLink] URL to get the next set of operation list + * @property {string} [nextLink] URL to get the next set of operation list * results if there are any. */ constructor() { diff --git a/lib/services/managementgroupsManagement/lib/models/operationResults.js b/lib/services/managementgroupsManagement/lib/models/operationResults.js new file mode 100644 index 0000000000..b1dc9ef1c1 --- /dev/null +++ b/lib/services/managementgroupsManagement/lib/models/operationResults.js @@ -0,0 +1,84 @@ +/* + * 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 results of an asynchronous operation. + * + */ +class OperationResults { + /** + * Create a OperationResults. + * @property {string} [id] The fully qualified ID for the management group. + * For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + * @property {string} [type] The type of the resource. For example, + * /providers/Microsoft.Management/managementGroups + * @property {string} [name] The name of the management group. For example, + * 00000000-0000-0000-0000-000000000000 + * @property {string} [provisioningState] Provisioning State. Possible values + * include: 'Updating' + */ + constructor() { + } + + /** + * Defines the metadata of OperationResults + * + * @returns {object} metadata of OperationResults + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationResults', + type: { + name: 'Composite', + className: 'OperationResults', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OperationResults; diff --git a/lib/services/managementgroupsManagement/lib/models/parentGroupInfo.js b/lib/services/managementgroupsManagement/lib/models/parentGroupInfo.js index 3a5c2a4769..4e284ea93d 100644 --- a/lib/services/managementgroupsManagement/lib/models/parentGroupInfo.js +++ b/lib/services/managementgroupsManagement/lib/models/parentGroupInfo.js @@ -17,11 +17,12 @@ class ParentGroupInfo { /** * Create a ParentGroupInfo. - * @member {string} [parentId] The fully qualified ID for the parent - * management group. For example, + * @property {string} [id] The fully qualified ID for the parent management + * group. For example, * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 - * @member {string} [displayName] The friendly name of the parent management - * group. + * @property {string} [name] The name of the parent management group + * @property {string} [displayName] The friendly name of the parent + * management group. */ constructor() { } @@ -40,9 +41,16 @@ class ParentGroupInfo { name: 'Composite', className: 'ParentGroupInfo', modelProperties: { - parentId: { + id: { required: false, - serializedName: 'parentId', + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', type: { name: 'String' } diff --git a/lib/services/managementgroupsManagement/lib/models/patchManagementGroupRequest.js b/lib/services/managementgroupsManagement/lib/models/patchManagementGroupRequest.js new file mode 100644 index 0000000000..02067984c3 --- /dev/null +++ b/lib/services/managementgroupsManagement/lib/models/patchManagementGroupRequest.js @@ -0,0 +1,65 @@ +/* + * 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'; + +/** + * Management group patch parameters. + * + */ +class PatchManagementGroupRequest { + /** + * Create a PatchManagementGroupRequest. + * @property {string} [displayName] The friendly name of the management + * group. + * @property {string} [parentId] (Optional) The fully qualified ID for the + * parent management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + */ + constructor() { + } + + /** + * Defines the metadata of PatchManagementGroupRequest + * + * @returns {object} metadata of PatchManagementGroupRequest + * + */ + mapper() { + return { + required: false, + serializedName: 'PatchManagementGroupRequest', + type: { + name: 'Composite', + className: 'PatchManagementGroupRequest', + modelProperties: { + displayName: { + required: false, + nullable: true, + serializedName: 'displayName', + type: { + name: 'String' + } + }, + parentId: { + required: false, + nullable: true, + serializedName: 'parentId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = PatchManagementGroupRequest; diff --git a/lib/services/managementgroupsManagement/lib/models/tenantBackfillStatusResult.js b/lib/services/managementgroupsManagement/lib/models/tenantBackfillStatusResult.js new file mode 100644 index 0000000000..09628361f8 --- /dev/null +++ b/lib/services/managementgroupsManagement/lib/models/tenantBackfillStatusResult.js @@ -0,0 +1,66 @@ +/* + * 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 tenant backfill status + * + */ +class TenantBackfillStatusResult { + /** + * Create a TenantBackfillStatusResult. + * @property {string} [tenantId] The AAD Tenant ID associated with the + * management group. For example, 00000000-0000-0000-0000-000000000000 + * @property {string} [status] The status of the Tenant Backfill. Possible + * values include: 'NotStarted', 'NotStartedButGroupsExist', 'Started', + * 'Failed', 'Cancelled', 'Completed' + */ + constructor() { + } + + /** + * Defines the metadata of TenantBackfillStatusResult + * + * @returns {object} metadata of TenantBackfillStatusResult + * + */ + mapper() { + return { + required: false, + serializedName: 'TenantBackfillStatusResult', + type: { + name: 'Composite', + className: 'TenantBackfillStatusResult', + modelProperties: { + tenantId: { + required: false, + readOnly: true, + serializedName: 'tenantId', + type: { + name: 'String' + } + }, + status: { + required: false, + readOnly: true, + serializedName: 'status', + type: { + name: 'Enum', + allowedValues: [ 'NotStarted', 'NotStartedButGroupsExist', 'Started', 'Failed', 'Cancelled', 'Completed' ] + } + } + } + } + }; + } +} + +module.exports = TenantBackfillStatusResult; diff --git a/lib/services/managementgroupsManagement/lib/operations/entities.js b/lib/services/managementgroupsManagement/lib/operations/entities.js new file mode 100644 index 0000000000..28b26c6cd9 --- /dev/null +++ b/lib/services/managementgroupsManagement/lib/operations/entities.js @@ -0,0 +1,683 @@ +/* + * 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; + +/** + * List all entities (Management Groups, Subscriptions, etc.) for the + * authenticated user. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.skiptoken] Page continuation token is only used if + * a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include + * a token parameter that specifies a starting point to use for subsequent + * calls. + * + * @param {number} [options.skip] Number of entities to skip over when + * retrieving results. Passing this in will override $skipToken. + * + * @param {number} [options.top] Number of elements to return when retrieving + * results. Passing this in will override $skipToken. + * + * @param {string} [options.select] This parameter specifies the fields to + * include in the response. Can include any combination of + * Name,DisplayName,Type,ParentDisplayNameChain,ParentChain, e.g. + * '$select=Name,DisplayName,Type,ParentDisplayNameChain,ParentNameChain'. When + * specified the $select parameter can override select in $skipToken. + * + * @param {string} [options.search] The $search parameter is used in + * conjunction with the $filter parameter to return three different outputs + * depending on the parameter passed in. With $search=AllowedParents the API + * will return the entity info of all groups that the requested entity will be + * able to reparent to as determined by the user's permissions. With + * $search=AllowedChildren the API will return the entity info of all entities + * that can be added as children of the requested entity. With + * $search=ParentAndFirstLevelChildren the API will return the parent and + * first level of children that the user has either direct access to or + * indirect access via one of their descendants. Possible values include: + * 'AllowedParents', 'AllowedChildren', 'ParentAndFirstLevelChildren', + * 'ParentOnly', 'ChildrenOnly' + * + * @param {string} [options.filter] The filter parameter allows you to filter + * on the name or display name fields. You can check for equality on the name + * field (e.g. name eq '{entityName}') and you can check for substrings on + * either the name or display name fields(e.g. contains(name, + * '{substringToSearch}'), contains(displayName, '{substringToSearch')). Note + * that the '{entityName}' and '{substringToSearch}' fields are checked case + * insensitively. + * + * @param {string} [options.view] The view parameter allows clients to filter + * the type of data that is returned by the getEntities call. Possible values + * include: 'FullHierarchy', 'GroupsOnly', 'SubscriptionsOnly', 'Audit' + * + * @param {string} [options.groupName] A filter which allows the get entities + * call to focus on a particular group (i.e. "$filter=name eq 'groupName'") + * + * @param {string} [options.cacheControl] Indicates that the request shouldn't + * utilize any caches. + * + * @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 EntityListResult} 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 _list(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 skiptoken = (options && options.skiptoken !== undefined) ? options.skiptoken : undefined; + let skip = (options && options.skip !== undefined) ? options.skip : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let select = (options && options.select !== undefined) ? options.select : undefined; + let search = (options && options.search !== undefined) ? options.search : undefined; + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let view = (options && options.view !== undefined) ? options.view : undefined; + let groupName = (options && options.groupName !== undefined) ? options.groupName : undefined; + let cacheControl = (options && options.cacheControl !== undefined) ? options.cacheControl : 'no-cache'; + // 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 (skiptoken !== null && skiptoken !== undefined && typeof skiptoken.valueOf() !== 'string') { + throw new Error('skiptoken must be of type string.'); + } + if (skip !== null && skip !== undefined && typeof skip !== 'number') { + throw new Error('skip must be of type number.'); + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + if (select !== null && select !== undefined && typeof select.valueOf() !== 'string') { + throw new Error('select must be of type string.'); + } + if (search !== null && search !== undefined && typeof search.valueOf() !== 'string') { + throw new Error('search must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (view !== null && view !== undefined && typeof view.valueOf() !== 'string') { + throw new Error('view must be of type string.'); + } + if (groupName !== null && groupName !== undefined && typeof groupName.valueOf() !== 'string') { + throw new Error('groupName must be of type string.'); + } + if (cacheControl !== null && cacheControl !== undefined && typeof cacheControl.valueOf() !== 'string') { + throw new Error('cacheControl 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('/') ? '' : '/') + 'providers/Microsoft.Management/getEntities'; + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (skiptoken !== null && skiptoken !== undefined) { + queryParameters.push('$skiptoken=' + encodeURIComponent(skiptoken)); + } + if (skip !== null && skip !== undefined) { + queryParameters.push('$skip=' + encodeURIComponent(skip.toString())); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + if (select !== null && select !== undefined) { + queryParameters.push('$select=' + encodeURIComponent(select)); + } + if (search !== null && search !== undefined) { + queryParameters.push('$search=' + encodeURIComponent(search)); + } + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (view !== null && view !== undefined) { + queryParameters.push('$view=' + encodeURIComponent(view)); + } + if (groupName !== null && groupName !== undefined) { + queryParameters.push('groupName=' + encodeURIComponent(groupName)); + } + 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 (cacheControl !== undefined && cacheControl !== null) { + httpRequest.headers['Cache-Control'] = cacheControl; + } + 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['ErrorResponse']().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['EntityListResult']().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); + }); +} + +/** + * List all entities (Management Groups, Subscriptions, etc.) for the + * authenticated user. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.cacheControl] Indicates that the request shouldn't + * utilize any caches. + * + * @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 EntityListResult} 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 _listNext(nextPageLink, 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 cacheControl = (options && options.cacheControl !== undefined) ? options.cacheControl : 'no-cache'; + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (cacheControl !== null && cacheControl !== undefined && typeof cacheControl.valueOf() !== 'string') { + throw new Error('cacheControl 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 requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // 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 (cacheControl !== undefined && cacheControl !== null) { + httpRequest.headers['Cache-Control'] = cacheControl; + } + 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['ErrorResponse']().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['EntityListResult']().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); + }); +} + +/** Class representing a Entities. */ +class Entities { + /** + * Create a Entities. + * @param {ManagementGroupsAPI} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._listNext = _listNext; + } + + /** + * List all entities (Management Groups, Subscriptions, etc.) for the + * authenticated user. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.skiptoken] Page continuation token is only used if + * a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include + * a token parameter that specifies a starting point to use for subsequent + * calls. + * + * @param {number} [options.skip] Number of entities to skip over when + * retrieving results. Passing this in will override $skipToken. + * + * @param {number} [options.top] Number of elements to return when retrieving + * results. Passing this in will override $skipToken. + * + * @param {string} [options.select] This parameter specifies the fields to + * include in the response. Can include any combination of + * Name,DisplayName,Type,ParentDisplayNameChain,ParentChain, e.g. + * '$select=Name,DisplayName,Type,ParentDisplayNameChain,ParentNameChain'. When + * specified the $select parameter can override select in $skipToken. + * + * @param {string} [options.search] The $search parameter is used in + * conjunction with the $filter parameter to return three different outputs + * depending on the parameter passed in. With $search=AllowedParents the API + * will return the entity info of all groups that the requested entity will be + * able to reparent to as determined by the user's permissions. With + * $search=AllowedChildren the API will return the entity info of all entities + * that can be added as children of the requested entity. With + * $search=ParentAndFirstLevelChildren the API will return the parent and + * first level of children that the user has either direct access to or + * indirect access via one of their descendants. Possible values include: + * 'AllowedParents', 'AllowedChildren', 'ParentAndFirstLevelChildren', + * 'ParentOnly', 'ChildrenOnly' + * + * @param {string} [options.filter] The filter parameter allows you to filter + * on the name or display name fields. You can check for equality on the name + * field (e.g. name eq '{entityName}') and you can check for substrings on + * either the name or display name fields(e.g. contains(name, + * '{substringToSearch}'), contains(displayName, '{substringToSearch')). Note + * that the '{entityName}' and '{substringToSearch}' fields are checked case + * insensitively. + * + * @param {string} [options.view] The view parameter allows clients to filter + * the type of data that is returned by the getEntities call. Possible values + * include: 'FullHierarchy', 'GroupsOnly', 'SubscriptionsOnly', 'Audit' + * + * @param {string} [options.groupName] A filter which allows the get entities + * call to focus on a particular group (i.e. "$filter=name eq 'groupName'") + * + * @param {string} [options.cacheControl] Indicates that the request shouldn't + * utilize any caches. + * + * @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. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List all entities (Management Groups, Subscriptions, etc.) for the + * authenticated user. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.skiptoken] Page continuation token is only used if + * a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include + * a token parameter that specifies a starting point to use for subsequent + * calls. + * + * @param {number} [options.skip] Number of entities to skip over when + * retrieving results. Passing this in will override $skipToken. + * + * @param {number} [options.top] Number of elements to return when retrieving + * results. Passing this in will override $skipToken. + * + * @param {string} [options.select] This parameter specifies the fields to + * include in the response. Can include any combination of + * Name,DisplayName,Type,ParentDisplayNameChain,ParentChain, e.g. + * '$select=Name,DisplayName,Type,ParentDisplayNameChain,ParentNameChain'. When + * specified the $select parameter can override select in $skipToken. + * + * @param {string} [options.search] The $search parameter is used in + * conjunction with the $filter parameter to return three different outputs + * depending on the parameter passed in. With $search=AllowedParents the API + * will return the entity info of all groups that the requested entity will be + * able to reparent to as determined by the user's permissions. With + * $search=AllowedChildren the API will return the entity info of all entities + * that can be added as children of the requested entity. With + * $search=ParentAndFirstLevelChildren the API will return the parent and + * first level of children that the user has either direct access to or + * indirect access via one of their descendants. Possible values include: + * 'AllowedParents', 'AllowedChildren', 'ParentAndFirstLevelChildren', + * 'ParentOnly', 'ChildrenOnly' + * + * @param {string} [options.filter] The filter parameter allows you to filter + * on the name or display name fields. You can check for equality on the name + * field (e.g. name eq '{entityName}') and you can check for substrings on + * either the name or display name fields(e.g. contains(name, + * '{substringToSearch}'), contains(displayName, '{substringToSearch')). Note + * that the '{entityName}' and '{substringToSearch}' fields are checked case + * insensitively. + * + * @param {string} [options.view] The view parameter allows clients to filter + * the type of data that is returned by the getEntities call. Possible values + * include: 'FullHierarchy', 'GroupsOnly', 'SubscriptionsOnly', 'Audit' + * + * @param {string} [options.groupName] A filter which allows the get entities + * call to focus on a particular group (i.e. "$filter=name eq 'groupName'") + * + * @param {string} [options.cacheControl] Indicates that the request shouldn't + * utilize any caches. + * + * @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 {EntityListResult} - 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 EntityListResult} 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. + */ + list(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._list(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(options, optionalCallback); + } + } + + /** + * List all entities (Management Groups, Subscriptions, etc.) for the + * authenticated user. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.cacheControl] Indicates that the request shouldn't + * utilize any caches. + * + * @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. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List all entities (Management Groups, Subscriptions, etc.) for the + * authenticated user. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.cacheControl] Indicates that the request shouldn't + * utilize any caches. + * + * @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 {EntityListResult} - 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 EntityListResult} 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. + */ + listNext(nextPageLink, 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._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = Entities; diff --git a/lib/services/managementgroupsManagement/lib/operations/index.d.ts b/lib/services/managementgroupsManagement/lib/operations/index.d.ts index 14d8305fde..c576c0d4f3 100644 --- a/lib/services/managementgroupsManagement/lib/operations/index.d.ts +++ b/lib/services/managementgroupsManagement/lib/operations/index.d.ts @@ -24,18 +24,16 @@ export interface ManagementGroups { /** * List management groups for the authenticated user. * - * * @param {object} [options] Optional Parameters. * * @param {string} [options.cacheControl] Indicates that the request shouldn't * utilize any caches. * * @param {string} [options.skiptoken] Page continuation token is only used if - * a previous operation returned a partial result. - * If a previous response contains a nextLink element, the value of the - * nextLink element will include a token parameter that specifies a starting - * point to use for subsequent calls. - * + * a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include + * a token parameter that specifies a starting point to use for subsequent + * calls. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -51,18 +49,16 @@ export interface ManagementGroups { /** * List management groups for the authenticated user. * - * * @param {object} [options] Optional Parameters. * * @param {string} [options.cacheControl] Indicates that the request shouldn't * utilize any caches. * * @param {string} [options.skiptoken] Page continuation token is only used if - * a previous operation returned a partial result. - * If a previous response contains a nextLink element, the value of the - * nextLink element will include a token parameter that specifies a starting - * point to use for subsequent calls. - * + * a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include + * a token parameter that specifies a starting point to use for subsequent + * calls. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -98,7 +94,6 @@ export interface ManagementGroups { /** * Get the details of the management group. * - * * @param {string} groupId Management Group ID. * * @param {object} [options] Optional Parameters. @@ -109,7 +104,12 @@ export interface ManagementGroups { * * @param {boolean} [options.recurse] The $recurse=true query string parameter * allows clients to request inclusion of entire hierarchy in the response - * payload. + * payload. Note that $expand=children must be passed up if $recurse is set to + * true. + * + * @param {string} [options.filter] A filter which allows the exclusion of + * subscriptions from results (i.e. '$filter=children.childType ne + * Subscription') * * @param {string} [options.cacheControl] Indicates that the request shouldn't * utilize any caches. @@ -123,12 +123,11 @@ export interface ManagementGroups { * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(groupId: string, options?: { expand? : string, recurse? : boolean, cacheControl? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(groupId: string, options?: { expand? : string, recurse? : boolean, filter? : string, cacheControl? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Get the details of the management group. * - * * @param {string} groupId Management Group ID. * * @param {object} [options] Optional Parameters. @@ -139,7 +138,12 @@ export interface ManagementGroups { * * @param {boolean} [options.recurse] The $recurse=true query string parameter * allows clients to request inclusion of entire hierarchy in the response - * payload. + * payload. Note that $expand=children must be passed up if $recurse is set to + * true. + * + * @param {string} [options.filter] A filter which allows the exclusion of + * subscriptions from results (i.e. '$filter=children.childType ne + * Subscription') * * @param {string} [options.cacheControl] Indicates that the request shouldn't * utilize any caches. @@ -169,27 +173,33 @@ export interface ManagementGroups { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - get(groupId: string, options?: { expand? : string, recurse? : boolean, cacheControl? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + get(groupId: string, options?: { expand? : string, recurse? : boolean, filter? : string, cacheControl? : string, customHeaders? : { [headerName: string]: string; } }): Promise; get(groupId: string, callback: ServiceCallback): void; - get(groupId: string, options: { expand? : string, recurse? : boolean, cacheControl? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(groupId: string, options: { expand? : string, recurse? : boolean, filter? : string, cacheControl? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Create or update a management group. - * If a management group is already created and a subsequent create request is - * issued with different properties, the management group properties will be - * updated. - * + * Create or update a management group. If a management group is already + * created and a subsequent create request is issued with different properties, + * the management group properties will be updated. * * @param {string} groupId Management Group ID. * * @param {object} createManagementGroupRequest Management group creation * parameters. * + * @param {string} [createManagementGroupRequest.name] The name of the + * management group. For example, 00000000-0000-0000-0000-000000000000 + * * @param {string} [createManagementGroupRequest.displayName] The friendly name - * of the management group. + * of the management group. If no value is passed then this field will be set + * to the groupId. + * + * @param {object} [createManagementGroupRequest.details] Details * - * @param {string} [createManagementGroupRequest.parentId] (Optional) The fully + * @param {object} [createManagementGroupRequest.details.parent] Parent + * + * @param {string} [createManagementGroupRequest.details.parent.id] The fully * qualified ID for the parent management group. For example, * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 * @@ -203,28 +213,34 @@ export interface ManagementGroups { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateWithHttpOperationResponse(groupId: string, createManagementGroupRequest: models.CreateManagementGroupRequest, options?: { cacheControl? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + createOrUpdateWithHttpOperationResponse(groupId: string, createManagementGroupRequest: models.CreateManagementGroupRequest, options?: { cacheControl? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Create or update a management group. - * If a management group is already created and a subsequent create request is - * issued with different properties, the management group properties will be - * updated. - * + * Create or update a management group. If a management group is already + * created and a subsequent create request is issued with different properties, + * the management group properties will be updated. * * @param {string} groupId Management Group ID. * * @param {object} createManagementGroupRequest Management group creation * parameters. * + * @param {string} [createManagementGroupRequest.name] The name of the + * management group. For example, 00000000-0000-0000-0000-000000000000 + * * @param {string} [createManagementGroupRequest.displayName] The friendly name - * of the management group. + * of the management group. If no value is passed then this field will be set + * to the groupId. + * + * @param {object} [createManagementGroupRequest.details] Details + * + * @param {object} [createManagementGroupRequest.details.parent] Parent * - * @param {string} [createManagementGroupRequest.parentId] (Optional) The fully + * @param {string} [createManagementGroupRequest.details.parent.id] The fully * qualified ID for the parent management group. For example, * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 * @@ -243,6 +259,84 @@ export interface ManagementGroups { * * {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. + */ + createOrUpdate(groupId: string, createManagementGroupRequest: models.CreateManagementGroupRequest, options?: { cacheControl? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(groupId: string, createManagementGroupRequest: models.CreateManagementGroupRequest, callback: ServiceCallback): void; + createOrUpdate(groupId: string, createManagementGroupRequest: models.CreateManagementGroupRequest, options: { cacheControl? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Update a management group. + * + * @param {string} groupId Management Group ID. + * + * @param {object} patchGroupRequest Management group patch parameters. + * + * @param {string} [patchGroupRequest.displayName] The friendly name of the + * management group. + * + * @param {string} [patchGroupRequest.parentId] (Optional) The fully qualified + * ID for the parent management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.cacheControl] Indicates that the request shouldn't + * utilize any caches. + * + * @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. + */ + updateWithHttpOperationResponse(groupId: string, patchGroupRequest: models.PatchManagementGroupRequest, options?: { cacheControl? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Update a management group. + * + * @param {string} groupId Management Group ID. + * + * @param {object} patchGroupRequest Management group patch parameters. + * + * @param {string} [patchGroupRequest.displayName] The friendly name of the + * management group. + * + * @param {string} [patchGroupRequest.parentId] (Optional) The fully qualified + * ID for the parent management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.cacheControl] Indicates that the request shouldn't + * utilize any caches. + * + * @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 {ManagementGroup} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. @@ -258,24 +352,96 @@ export interface ManagementGroups { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - createOrUpdate(groupId: string, createManagementGroupRequest: models.CreateManagementGroupRequest, options?: { cacheControl? : string, customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(groupId: string, createManagementGroupRequest: models.CreateManagementGroupRequest, callback: ServiceCallback): void; - createOrUpdate(groupId: string, createManagementGroupRequest: models.CreateManagementGroupRequest, options: { cacheControl? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + update(groupId: string, patchGroupRequest: models.PatchManagementGroupRequest, options?: { cacheControl? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + update(groupId: string, patchGroupRequest: models.PatchManagementGroupRequest, callback: ServiceCallback): void; + update(groupId: string, patchGroupRequest: models.PatchManagementGroupRequest, options: { cacheControl? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Update a management group. + * Delete management group. If a management group contains child resources, the + * request will fail. + * + * @param {string} groupId Management Group ID. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.cacheControl] Indicates that the request shouldn't + * utilize any caches. + * + * @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(groupId: string, options?: { cacheControl? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete management group. If a management group contains child resources, the + * request will fail. + * + * @param {string} groupId Management Group ID. + * + * @param {object} [options] Optional Parameters. * + * @param {string} [options.cacheControl] Indicates that the request shouldn't + * utilize any caches. + * + * @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 {OperationResults} - 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. + * + * {OperationResults} [result] - The deserialized result object if an error did not occur. + * See {@link OperationResults} 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(groupId: string, options?: { cacheControl? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(groupId: string, callback: ServiceCallback): void; + deleteMethod(groupId: string, options: { cacheControl? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create or update a management group. If a management group is already + * created and a subsequent create request is issued with different properties, + * the management group properties will be updated. * * @param {string} groupId Management Group ID. * * @param {object} createManagementGroupRequest Management group creation * parameters. * + * @param {string} [createManagementGroupRequest.name] The name of the + * management group. For example, 00000000-0000-0000-0000-000000000000 + * * @param {string} [createManagementGroupRequest.displayName] The friendly name - * of the management group. + * of the management group. If no value is passed then this field will be set + * to the groupId. + * + * @param {object} [createManagementGroupRequest.details] Details * - * @param {string} [createManagementGroupRequest.parentId] (Optional) The fully + * @param {object} [createManagementGroupRequest.details.parent] Parent + * + * @param {string} [createManagementGroupRequest.details.parent.id] The fully * qualified ID for the parent management group. For example, * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 * @@ -289,25 +455,34 @@ export interface ManagementGroups { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - updateWithHttpOperationResponse(groupId: string, createManagementGroupRequest: models.CreateManagementGroupRequest, options?: { cacheControl? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + beginCreateOrUpdateWithHttpOperationResponse(groupId: string, createManagementGroupRequest: models.CreateManagementGroupRequest, options?: { cacheControl? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Update a management group. - * + * Create or update a management group. If a management group is already + * created and a subsequent create request is issued with different properties, + * the management group properties will be updated. * * @param {string} groupId Management Group ID. * * @param {object} createManagementGroupRequest Management group creation * parameters. * + * @param {string} [createManagementGroupRequest.name] The name of the + * management group. For example, 00000000-0000-0000-0000-000000000000 + * * @param {string} [createManagementGroupRequest.displayName] The friendly name - * of the management group. + * of the management group. If no value is passed then this field will be set + * to the groupId. * - * @param {string} [createManagementGroupRequest.parentId] (Optional) The fully + * @param {object} [createManagementGroupRequest.details] Details + * + * @param {object} [createManagementGroupRequest.details.parent] Parent + * + * @param {string} [createManagementGroupRequest.details.parent.id] The fully * qualified ID for the parent management group. For example, * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 * @@ -326,7 +501,7 @@ export interface ManagementGroups { * * {Promise} A promise is returned. * - * @resolve {ManagementGroup} - The deserialized result object. + * @resolve {Object} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -334,22 +509,20 @@ export interface ManagementGroups { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ManagementGroup} [result] - The deserialized result object if an error did not occur. - * See {@link ManagementGroup} for more information. + * {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. */ - update(groupId: string, createManagementGroupRequest: models.CreateManagementGroupRequest, options?: { cacheControl? : string, customHeaders? : { [headerName: string]: string; } }): Promise; - update(groupId: string, createManagementGroupRequest: models.CreateManagementGroupRequest, callback: ServiceCallback): void; - update(groupId: string, createManagementGroupRequest: models.CreateManagementGroupRequest, options: { cacheControl? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginCreateOrUpdate(groupId: string, createManagementGroupRequest: models.CreateManagementGroupRequest, options?: { cacheControl? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(groupId: string, createManagementGroupRequest: models.CreateManagementGroupRequest, callback: ServiceCallback): void; + beginCreateOrUpdate(groupId: string, createManagementGroupRequest: models.CreateManagementGroupRequest, options: { cacheControl? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Delete management group. - * If a management group contains child resources, the request will fail. - * + * Delete management group. If a management group contains child resources, the + * request will fail. * * @param {string} groupId Management Group ID. * @@ -363,16 +536,15 @@ export interface ManagementGroups { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - deleteMethodWithHttpOperationResponse(groupId: string, options?: { cacheControl? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + beginDeleteMethodWithHttpOperationResponse(groupId: string, options?: { cacheControl? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Delete management group. - * If a management group contains child resources, the request will fail. - * + * Delete management group. If a management group contains child resources, the + * request will fail. * * @param {string} groupId Management Group ID. * @@ -391,7 +563,7 @@ export interface ManagementGroups { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {OperationResults} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -399,21 +571,21 @@ export interface ManagementGroups { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {OperationResults} [result] - The deserialized result object if an error did not occur. + * See {@link OperationResults} 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(groupId: string, options?: { cacheControl? : string, customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(groupId: string, callback: ServiceCallback): void; - deleteMethod(groupId: string, options: { cacheControl? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginDeleteMethod(groupId: string, options?: { cacheControl? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(groupId: string, callback: ServiceCallback): void; + beginDeleteMethod(groupId: string, options: { cacheControl? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** * List management groups for the authenticated user. * - * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. * @@ -436,7 +608,6 @@ export interface ManagementGroups { /** * List management groups for the authenticated user. * - * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. * @@ -488,7 +659,6 @@ export interface ManagementGroupSubscriptions { /** * Associates existing subscription with the management group. * - * * @param {string} groupId Management Group ID. * * @param {string} subscriptionId Subscription ID. @@ -512,7 +682,6 @@ export interface ManagementGroupSubscriptions { /** * Associates existing subscription with the management group. * - * * @param {string} groupId Management Group ID. * * @param {string} subscriptionId Subscription ID. @@ -554,7 +723,6 @@ export interface ManagementGroupSubscriptions { /** * De-associates subscription from the management group. * - * * @param {string} groupId Management Group ID. * * @param {string} subscriptionId Subscription ID. @@ -578,7 +746,6 @@ export interface ManagementGroupSubscriptions { /** * De-associates subscription from the management group. * - * * @param {string} groupId Management Group ID. * * @param {string} subscriptionId Subscription ID. @@ -733,3 +900,228 @@ export interface Operations { listNext(nextPageLink: string, callback: ServiceCallback): void; listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } + +/** + * @class + * Entities + * __NOTE__: An instance of this class is automatically created for an + * instance of the ManagementGroupsAPI. + */ +export interface Entities { + + + /** + * List all entities (Management Groups, Subscriptions, etc.) for the + * authenticated user. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.skiptoken] Page continuation token is only used if + * a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include + * a token parameter that specifies a starting point to use for subsequent + * calls. + * + * @param {number} [options.skip] Number of entities to skip over when + * retrieving results. Passing this in will override $skipToken. + * + * @param {number} [options.top] Number of elements to return when retrieving + * results. Passing this in will override $skipToken. + * + * @param {string} [options.select] This parameter specifies the fields to + * include in the response. Can include any combination of + * Name,DisplayName,Type,ParentDisplayNameChain,ParentChain, e.g. + * '$select=Name,DisplayName,Type,ParentDisplayNameChain,ParentNameChain'. When + * specified the $select parameter can override select in $skipToken. + * + * @param {string} [options.search] The $search parameter is used in + * conjunction with the $filter parameter to return three different outputs + * depending on the parameter passed in. With $search=AllowedParents the API + * will return the entity info of all groups that the requested entity will be + * able to reparent to as determined by the user's permissions. With + * $search=AllowedChildren the API will return the entity info of all entities + * that can be added as children of the requested entity. With + * $search=ParentAndFirstLevelChildren the API will return the parent and + * first level of children that the user has either direct access to or + * indirect access via one of their descendants. Possible values include: + * 'AllowedParents', 'AllowedChildren', 'ParentAndFirstLevelChildren', + * 'ParentOnly', 'ChildrenOnly' + * + * @param {string} [options.filter] The filter parameter allows you to filter + * on the name or display name fields. You can check for equality on the name + * field (e.g. name eq '{entityName}') and you can check for substrings on + * either the name or display name fields(e.g. contains(name, + * '{substringToSearch}'), contains(displayName, '{substringToSearch')). Note + * that the '{entityName}' and '{substringToSearch}' fields are checked case + * insensitively. + * + * @param {string} [options.view] The view parameter allows clients to filter + * the type of data that is returned by the getEntities call. Possible values + * include: 'FullHierarchy', 'GroupsOnly', 'SubscriptionsOnly', 'Audit' + * + * @param {string} [options.groupName] A filter which allows the get entities + * call to focus on a particular group (i.e. "$filter=name eq 'groupName'") + * + * @param {string} [options.cacheControl] Indicates that the request shouldn't + * utilize any caches. + * + * @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. + */ + listWithHttpOperationResponse(options?: { skiptoken? : string, skip? : number, top? : number, select? : string, search? : string, filter? : string, view? : string, groupName? : string, cacheControl? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List all entities (Management Groups, Subscriptions, etc.) for the + * authenticated user. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.skiptoken] Page continuation token is only used if + * a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include + * a token parameter that specifies a starting point to use for subsequent + * calls. + * + * @param {number} [options.skip] Number of entities to skip over when + * retrieving results. Passing this in will override $skipToken. + * + * @param {number} [options.top] Number of elements to return when retrieving + * results. Passing this in will override $skipToken. + * + * @param {string} [options.select] This parameter specifies the fields to + * include in the response. Can include any combination of + * Name,DisplayName,Type,ParentDisplayNameChain,ParentChain, e.g. + * '$select=Name,DisplayName,Type,ParentDisplayNameChain,ParentNameChain'. When + * specified the $select parameter can override select in $skipToken. + * + * @param {string} [options.search] The $search parameter is used in + * conjunction with the $filter parameter to return three different outputs + * depending on the parameter passed in. With $search=AllowedParents the API + * will return the entity info of all groups that the requested entity will be + * able to reparent to as determined by the user's permissions. With + * $search=AllowedChildren the API will return the entity info of all entities + * that can be added as children of the requested entity. With + * $search=ParentAndFirstLevelChildren the API will return the parent and + * first level of children that the user has either direct access to or + * indirect access via one of their descendants. Possible values include: + * 'AllowedParents', 'AllowedChildren', 'ParentAndFirstLevelChildren', + * 'ParentOnly', 'ChildrenOnly' + * + * @param {string} [options.filter] The filter parameter allows you to filter + * on the name or display name fields. You can check for equality on the name + * field (e.g. name eq '{entityName}') and you can check for substrings on + * either the name or display name fields(e.g. contains(name, + * '{substringToSearch}'), contains(displayName, '{substringToSearch')). Note + * that the '{entityName}' and '{substringToSearch}' fields are checked case + * insensitively. + * + * @param {string} [options.view] The view parameter allows clients to filter + * the type of data that is returned by the getEntities call. Possible values + * include: 'FullHierarchy', 'GroupsOnly', 'SubscriptionsOnly', 'Audit' + * + * @param {string} [options.groupName] A filter which allows the get entities + * call to focus on a particular group (i.e. "$filter=name eq 'groupName'") + * + * @param {string} [options.cacheControl] Indicates that the request shouldn't + * utilize any caches. + * + * @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 {EntityListResult} - 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. + * + * {EntityListResult} [result] - The deserialized result object if an error did not occur. + * See {@link EntityListResult} 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. + */ + list(options?: { skiptoken? : string, skip? : number, top? : number, select? : string, search? : string, filter? : string, view? : string, groupName? : string, cacheControl? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { skiptoken? : string, skip? : number, top? : number, select? : string, search? : string, filter? : string, view? : string, groupName? : string, cacheControl? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List all entities (Management Groups, Subscriptions, etc.) for the + * authenticated user. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.cacheControl] Indicates that the request shouldn't + * utilize any caches. + * + * @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. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { cacheControl? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List all entities (Management Groups, Subscriptions, etc.) for the + * authenticated user. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.cacheControl] Indicates that the request shouldn't + * utilize any caches. + * + * @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 {EntityListResult} - 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. + * + * {EntityListResult} [result] - The deserialized result object if an error did not occur. + * See {@link EntityListResult} 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. + */ + listNext(nextPageLink: string, options?: { cacheControl? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { cacheControl? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} diff --git a/lib/services/managementgroupsManagement/lib/operations/index.js b/lib/services/managementgroupsManagement/lib/operations/index.js index 67c9b2b056..c42ad21886 100644 --- a/lib/services/managementgroupsManagement/lib/operations/index.js +++ b/lib/services/managementgroupsManagement/lib/operations/index.js @@ -17,3 +17,4 @@ exports.ManagementGroups = require('./managementGroups'); exports.ManagementGroupSubscriptions = require('./managementGroupSubscriptions'); exports.Operations = require('./operations'); +exports.Entities = require('./entities'); diff --git a/lib/services/managementgroupsManagement/lib/operations/managementGroupSubscriptions.js b/lib/services/managementgroupsManagement/lib/operations/managementGroupSubscriptions.js index 9e5c9fe2d8..5007b6b89d 100644 --- a/lib/services/managementgroupsManagement/lib/operations/managementGroupSubscriptions.js +++ b/lib/services/managementgroupsManagement/lib/operations/managementGroupSubscriptions.js @@ -17,7 +17,6 @@ const WebResource = msRest.WebResource; /** * Associates existing subscription with the management group. * - * * @param {string} groupId Management Group ID. * * @param {string} subscriptionId Subscription ID. @@ -152,7 +151,6 @@ function _create(groupId, subscriptionId, options, callback) { /** * De-associates subscription from the management group. * - * * @param {string} groupId Management Group ID. * * @param {string} subscriptionId Subscription ID. @@ -299,7 +297,6 @@ class ManagementGroupSubscriptions { /** * Associates existing subscription with the management group. * - * * @param {string} groupId Management Group ID. * * @param {string} subscriptionId Subscription ID. @@ -335,7 +332,6 @@ class ManagementGroupSubscriptions { /** * Associates existing subscription with the management group. * - * * @param {string} groupId Management Group ID. * * @param {string} subscriptionId Subscription ID. @@ -392,7 +388,6 @@ class ManagementGroupSubscriptions { /** * De-associates subscription from the management group. * - * * @param {string} groupId Management Group ID. * * @param {string} subscriptionId Subscription ID. @@ -428,7 +423,6 @@ class ManagementGroupSubscriptions { /** * De-associates subscription from the management group. * - * * @param {string} groupId Management Group ID. * * @param {string} subscriptionId Subscription ID. diff --git a/lib/services/managementgroupsManagement/lib/operations/managementGroups.js b/lib/services/managementgroupsManagement/lib/operations/managementGroups.js index cb081b66c9..8a620aa21e 100644 --- a/lib/services/managementgroupsManagement/lib/operations/managementGroups.js +++ b/lib/services/managementgroupsManagement/lib/operations/managementGroups.js @@ -17,18 +17,16 @@ const WebResource = msRest.WebResource; /** * List management groups for the authenticated user. * - * * @param {object} [options] Optional Parameters. * * @param {string} [options.cacheControl] Indicates that the request shouldn't * utilize any caches. * * @param {string} [options.skiptoken] Page continuation token is only used if - * a previous operation returned a partial result. - * If a previous response contains a nextLink element, the value of the - * nextLink element will include a token parameter that specifies a starting - * point to use for subsequent calls. - * + * a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include + * a token parameter that specifies a starting point to use for subsequent + * calls. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -173,7 +171,6 @@ function _list(options, callback) { /** * Get the details of the management group. * - * * @param {string} groupId Management Group ID. * * @param {object} [options] Optional Parameters. @@ -184,7 +181,12 @@ function _list(options, callback) { * * @param {boolean} [options.recurse] The $recurse=true query string parameter * allows clients to request inclusion of entire hierarchy in the response - * payload. + * payload. Note that $expand=children must be passed up if $recurse is set to + * true. + * + * @param {string} [options.filter] A filter which allows the exclusion of + * subscriptions from results (i.e. '$filter=children.childType ne + * Subscription') * * @param {string} [options.cacheControl] Indicates that the request shouldn't * utilize any caches. @@ -217,6 +219,7 @@ function _get(groupId, options, callback) { } let expand = (options && options.expand !== undefined) ? options.expand : undefined; let recurse = (options && options.recurse !== undefined) ? options.recurse : undefined; + let filter = (options && options.filter !== undefined) ? options.filter : undefined; let cacheControl = (options && options.cacheControl !== undefined) ? options.cacheControl : 'no-cache'; // Validate try { @@ -232,6 +235,9 @@ function _get(groupId, options, callback) { if (recurse !== null && recurse !== undefined && typeof recurse !== 'boolean') { throw new Error('recurse must be of type boolean.'); } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } if (cacheControl !== null && cacheControl !== undefined && typeof cacheControl.valueOf() !== 'string') { throw new Error('cacheControl must be of type string.'); } @@ -254,6 +260,9 @@ function _get(groupId, options, callback) { if (recurse !== null && recurse !== undefined) { queryParameters.push('$recurse=' + encodeURIComponent(recurse.toString())); } + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -339,22 +348,29 @@ function _get(groupId, options, callback) { }); } + /** - * Create or update a management group. - * If a management group is already created and a subsequent create request is - * issued with different properties, the management group properties will be - * updated. - * + * Create or update a management group. If a management group is already + * created and a subsequent create request is issued with different properties, + * the management group properties will be updated. * * @param {string} groupId Management Group ID. * * @param {object} createManagementGroupRequest Management group creation * parameters. * + * @param {string} [createManagementGroupRequest.name] The name of the + * management group. For example, 00000000-0000-0000-0000-000000000000 + * * @param {string} [createManagementGroupRequest.displayName] The friendly name - * of the management group. + * of the management group. If no value is passed then this field will be set + * to the groupId. + * + * @param {object} [createManagementGroupRequest.details] Details * - * @param {string} [createManagementGroupRequest.parentId] (Optional) The fully + * @param {object} [createManagementGroupRequest.details.parent] Parent + * + * @param {string} [createManagementGroupRequest.details.parent.id] The fully * qualified ID for the parent management group. For example, * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 * @@ -373,7 +389,6 @@ function _get(groupId, options, callback) { * {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 ManagementGroup} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * @@ -386,6 +401,99 @@ function _createOrUpdate(groupId, createManagementGroupRequest, options, callbac callback = options; options = null; } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(groupId, createManagementGroupRequest, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = { + required: false, + serializedName: 'parsedResponse', + type: { + name: 'Object' + } + }; + 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); + }); + }); +} + +/** + * Update a management group. + * + * @param {string} groupId Management Group ID. + * + * @param {object} patchGroupRequest Management group patch parameters. + * + * @param {string} [patchGroupRequest.displayName] The friendly name of the + * management group. + * + * @param {string} [patchGroupRequest.parentId] (Optional) The fully qualified + * ID for the parent management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.cacheControl] Indicates that the request shouldn't + * utilize any caches. + * + * @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 ManagementGroup} 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 _update(groupId, patchGroupRequest, 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.'); } @@ -398,12 +506,12 @@ function _createOrUpdate(groupId, createManagementGroupRequest, options, callbac 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 (createManagementGroupRequest === null || createManagementGroupRequest === undefined) { - throw new Error('createManagementGroupRequest cannot be null or undefined.'); - } if (cacheControl !== null && cacheControl !== undefined && typeof cacheControl.valueOf() !== 'string') { throw new Error('cacheControl must be of type string.'); } + if (patchGroupRequest === null || patchGroupRequest === undefined) { + throw new Error('patchGroupRequest cannot be null or undefined.'); + } 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.'); } @@ -423,7 +531,7 @@ function _createOrUpdate(groupId, createManagementGroupRequest, options, callbac // Create HTTP transport objects let httpRequest = new WebResource(); - httpRequest.method = 'PUT'; + httpRequest.method = 'PATCH'; httpRequest.url = requestUrl; httpRequest.headers = {}; // Set Headers @@ -448,14 +556,14 @@ function _createOrUpdate(groupId, createManagementGroupRequest, options, callbac let requestContent = null; let requestModel = null; try { - if (createManagementGroupRequest !== null && createManagementGroupRequest !== undefined) { - let requestModelMapper = new client.models['CreateManagementGroupRequest']().mapper(); - requestModel = client.serialize(requestModelMapper, createManagementGroupRequest, 'createManagementGroupRequest'); + if (patchGroupRequest !== null && patchGroupRequest !== undefined) { + let requestModelMapper = new client.models['PatchManagementGroupRequest']().mapper(); + requestModel = client.serialize(requestModelMapper, patchGroupRequest, 'patchGroupRequest'); requestContent = JSON.stringify(requestModel); } } catch (error) { let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(createManagementGroupRequest, null, 2)}.`); + `payload - ${JSON.stringify(patchGroupRequest, null, 2)}.`); return callback(serializationError); } httpRequest.body = requestContent; @@ -516,19 +624,108 @@ function _createOrUpdate(groupId, createManagementGroupRequest, options, callbac }); } + /** - * Update a management group. + * Delete management group. If a management group contains child resources, the + * request will fail. * + * @param {string} groupId Management Group ID. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.cacheControl] Indicates that the request shouldn't + * utilize any caches. + * + * @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 OperationResults} 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(groupId, 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.'); + } + + // Send request + this.beginDeleteMethod(groupId, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['OperationResults']().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); + }); + }); +} + +/** + * Create or update a management group. If a management group is already + * created and a subsequent create request is issued with different properties, + * the management group properties will be updated. * * @param {string} groupId Management Group ID. * * @param {object} createManagementGroupRequest Management group creation * parameters. * + * @param {string} [createManagementGroupRequest.name] The name of the + * management group. For example, 00000000-0000-0000-0000-000000000000 + * * @param {string} [createManagementGroupRequest.displayName] The friendly name - * of the management group. + * of the management group. If no value is passed then this field will be set + * to the groupId. + * + * @param {object} [createManagementGroupRequest.details] Details * - * @param {string} [createManagementGroupRequest.parentId] (Optional) The fully + * @param {object} [createManagementGroupRequest.details.parent] Parent + * + * @param {string} [createManagementGroupRequest.details.parent.id] The fully * qualified ID for the parent management group. For example, * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 * @@ -547,13 +744,12 @@ function _createOrUpdate(groupId, createManagementGroupRequest, options, callbac * {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 ManagementGroup} 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 _update(groupId, createManagementGroupRequest, options, callback) { +function _beginCreateOrUpdate(groupId, createManagementGroupRequest, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -572,12 +768,12 @@ function _update(groupId, createManagementGroupRequest, options, callback) { 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 (createManagementGroupRequest === null || createManagementGroupRequest === undefined) { - throw new Error('createManagementGroupRequest cannot be null or undefined.'); - } if (cacheControl !== null && cacheControl !== undefined && typeof cacheControl.valueOf() !== 'string') { throw new Error('cacheControl must be of type string.'); } + if (createManagementGroupRequest === null || createManagementGroupRequest === undefined) { + throw new Error('createManagementGroupRequest cannot be null or undefined.'); + } 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.'); } @@ -597,7 +793,7 @@ function _update(groupId, createManagementGroupRequest, options, callback) { // Create HTTP transport objects let httpRequest = new WebResource(); - httpRequest.method = 'PATCH'; + httpRequest.method = 'PUT'; httpRequest.url = requestUrl; httpRequest.headers = {}; // Set Headers @@ -639,7 +835,7 @@ function _update(groupId, createManagementGroupRequest, options, callback) { return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200) { + if (statusCode !== 200 && statusCode !== 202) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -685,15 +881,31 @@ function _update(groupId, createManagementGroupRequest, options, callback) { return callback(deserializationError); } } + // Deserialize Response + if (statusCode === 202) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['OperationResults']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } return callback(null, result, httpRequest, response); }); } /** - * Delete management group. - * If a management group contains child resources, the request will fail. - * + * Delete management group. If a management group contains child resources, the + * request will fail. * * @param {string} groupId Management Group ID. * @@ -711,13 +923,14 @@ function _update(groupId, createManagementGroupRequest, options, callback) { * * {Error} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link OperationResults} 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(groupId, options, callback) { +function _beginDeleteMethod(groupId, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -786,7 +999,7 @@ function _deleteMethod(groupId, options, callback) { return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 204) { + if (statusCode !== 202 && statusCode !== 204) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -815,6 +1028,23 @@ function _deleteMethod(groupId, options, callback) { // Create Result let result = null; if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 202) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['OperationResults']().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); }); @@ -823,7 +1053,6 @@ function _deleteMethod(groupId, options, callback) { /** * List management groups for the authenticated user. * - * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. * @@ -973,24 +1202,24 @@ class ManagementGroups { this._createOrUpdate = _createOrUpdate; this._update = _update; this._deleteMethod = _deleteMethod; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginDeleteMethod = _beginDeleteMethod; this._listNext = _listNext; } /** * List management groups for the authenticated user. * - * * @param {object} [options] Optional Parameters. * * @param {string} [options.cacheControl] Indicates that the request shouldn't * utilize any caches. * * @param {string} [options.skiptoken] Page continuation token is only used if - * a previous operation returned a partial result. - * If a previous response contains a nextLink element, the value of the - * nextLink element will include a token parameter that specifies a starting - * point to use for subsequent calls. - * + * a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include + * a token parameter that specifies a starting point to use for subsequent + * calls. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -1018,18 +1247,16 @@ class ManagementGroups { /** * List management groups for the authenticated user. * - * * @param {object} [options] Optional Parameters. * * @param {string} [options.cacheControl] Indicates that the request shouldn't * utilize any caches. * * @param {string} [options.skiptoken] Page continuation token is only used if - * a previous operation returned a partial result. - * If a previous response contains a nextLink element, the value of the - * nextLink element will include a token parameter that specifies a starting - * point to use for subsequent calls. - * + * a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element will include + * a token parameter that specifies a starting point to use for subsequent + * calls. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -1080,7 +1307,6 @@ class ManagementGroups { /** * Get the details of the management group. * - * * @param {string} groupId Management Group ID. * * @param {object} [options] Optional Parameters. @@ -1091,7 +1317,12 @@ class ManagementGroups { * * @param {boolean} [options.recurse] The $recurse=true query string parameter * allows clients to request inclusion of entire hierarchy in the response - * payload. + * payload. Note that $expand=children must be passed up if $recurse is set to + * true. + * + * @param {string} [options.filter] A filter which allows the exclusion of + * subscriptions from results (i.e. '$filter=children.childType ne + * Subscription') * * @param {string} [options.cacheControl] Indicates that the request shouldn't * utilize any caches. @@ -1122,7 +1353,6 @@ class ManagementGroups { /** * Get the details of the management group. * - * * @param {string} groupId Management Group ID. * * @param {object} [options] Optional Parameters. @@ -1133,7 +1363,12 @@ class ManagementGroups { * * @param {boolean} [options.recurse] The $recurse=true query string parameter * allows clients to request inclusion of entire hierarchy in the response - * payload. + * payload. Note that $expand=children must be passed up if $recurse is set to + * true. + * + * @param {string} [options.filter] A filter which allows the exclusion of + * subscriptions from results (i.e. '$filter=children.childType ne + * Subscription') * * @param {string} [options.cacheControl] Indicates that the request shouldn't * utilize any caches. @@ -1184,21 +1419,27 @@ class ManagementGroups { } /** - * Create or update a management group. - * If a management group is already created and a subsequent create request is - * issued with different properties, the management group properties will be - * updated. - * + * Create or update a management group. If a management group is already + * created and a subsequent create request is issued with different properties, + * the management group properties will be updated. * * @param {string} groupId Management Group ID. * * @param {object} createManagementGroupRequest Management group creation * parameters. * + * @param {string} [createManagementGroupRequest.name] The name of the + * management group. For example, 00000000-0000-0000-0000-000000000000 + * * @param {string} [createManagementGroupRequest.displayName] The friendly name - * of the management group. + * of the management group. If no value is passed then this field will be set + * to the groupId. + * + * @param {object} [createManagementGroupRequest.details] Details + * + * @param {object} [createManagementGroupRequest.details.parent] Parent * - * @param {string} [createManagementGroupRequest.parentId] (Optional) The fully + * @param {string} [createManagementGroupRequest.details.parent.id] The fully * qualified ID for the parent management group. For example, * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 * @@ -1212,7 +1453,7 @@ class ManagementGroups { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ @@ -1231,21 +1472,27 @@ class ManagementGroups { } /** - * Create or update a management group. - * If a management group is already created and a subsequent create request is - * issued with different properties, the management group properties will be - * updated. - * + * Create or update a management group. If a management group is already + * created and a subsequent create request is issued with different properties, + * the management group properties will be updated. * * @param {string} groupId Management Group ID. * * @param {object} createManagementGroupRequest Management group creation * parameters. * + * @param {string} [createManagementGroupRequest.name] The name of the + * management group. For example, 00000000-0000-0000-0000-000000000000 + * * @param {string} [createManagementGroupRequest.displayName] The friendly name - * of the management group. + * of the management group. If no value is passed then this field will be set + * to the groupId. + * + * @param {object} [createManagementGroupRequest.details] Details * - * @param {string} [createManagementGroupRequest.parentId] (Optional) The fully + * @param {object} [createManagementGroupRequest.details.parent] Parent + * + * @param {string} [createManagementGroupRequest.details.parent.id] The fully * qualified ID for the parent management group. For example, * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 * @@ -1264,7 +1511,7 @@ class ManagementGroups { * * {Promise} A promise is returned * - * @resolve {ManagementGroup} - The deserialized result object. + * @resolve {Object} - The deserialized result object. * * @reject {Error} - The error object. * @@ -1273,7 +1520,6 @@ class ManagementGroups { * {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 ManagementGroup} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * @@ -1302,17 +1548,15 @@ class ManagementGroups { /** * Update a management group. * - * * @param {string} groupId Management Group ID. * - * @param {object} createManagementGroupRequest Management group creation - * parameters. + * @param {object} patchGroupRequest Management group patch parameters. * - * @param {string} [createManagementGroupRequest.displayName] The friendly name - * of the management group. + * @param {string} [patchGroupRequest.displayName] The friendly name of the + * management group. * - * @param {string} [createManagementGroupRequest.parentId] (Optional) The fully - * qualified ID for the parent management group. For example, + * @param {string} [patchGroupRequest.parentId] (Optional) The fully qualified + * ID for the parent management group. For example, * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 * * @param {object} [options] Optional Parameters. @@ -1329,11 +1573,11 @@ class ManagementGroups { * * @reject {Error} - The error object. */ - updateWithHttpOperationResponse(groupId, createManagementGroupRequest, options) { + updateWithHttpOperationResponse(groupId, patchGroupRequest, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._update(groupId, createManagementGroupRequest, options, (err, result, request, response) => { + self._update(groupId, patchGroupRequest, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -1346,17 +1590,15 @@ class ManagementGroups { /** * Update a management group. * - * * @param {string} groupId Management Group ID. * - * @param {object} createManagementGroupRequest Management group creation - * parameters. + * @param {object} patchGroupRequest Management group patch parameters. * - * @param {string} [createManagementGroupRequest.displayName] The friendly name - * of the management group. + * @param {string} [patchGroupRequest.displayName] The friendly name of the + * management group. * - * @param {string} [createManagementGroupRequest.parentId] (Optional) The fully - * qualified ID for the parent management group. For example, + * @param {string} [patchGroupRequest.parentId] (Optional) The fully qualified + * ID for the parent management group. For example, * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 * * @param {object} [options] Optional Parameters. @@ -1389,7 +1631,7 @@ class ManagementGroups { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - update(groupId, createManagementGroupRequest, options, optionalCallback) { + update(groupId, patchGroupRequest, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -1398,21 +1640,20 @@ class ManagementGroups { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._update(groupId, createManagementGroupRequest, options, (err, result, request, response) => { + self._update(groupId, patchGroupRequest, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._update(groupId, createManagementGroupRequest, options, optionalCallback); + return self._update(groupId, patchGroupRequest, options, optionalCallback); } } /** - * Delete management group. - * If a management group contains child resources, the request will fail. - * + * Delete management group. If a management group contains child resources, the + * request will fail. * * @param {string} groupId Management Group ID. * @@ -1426,7 +1667,7 @@ class ManagementGroups { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ @@ -1445,9 +1686,8 @@ class ManagementGroups { } /** - * Delete management group. - * If a management group contains child resources, the request will fail. - * + * Delete management group. If a management group contains child resources, the + * request will fail. * * @param {string} groupId Management Group ID. * @@ -1466,7 +1706,7 @@ class ManagementGroups { * * {Promise} A promise is returned * - * @resolve {null} - The deserialized result object. + * @resolve {OperationResults} - The deserialized result object. * * @reject {Error} - The error object. * @@ -1474,7 +1714,8 @@ class ManagementGroups { * * {Error} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link OperationResults} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * @@ -1501,8 +1742,224 @@ class ManagementGroups { } /** - * List management groups for the authenticated user. + * Create or update a management group. If a management group is already + * created and a subsequent create request is issued with different properties, + * the management group properties will be updated. + * + * @param {string} groupId Management Group ID. + * + * @param {object} createManagementGroupRequest Management group creation + * parameters. + * + * @param {string} [createManagementGroupRequest.name] The name of the + * management group. For example, 00000000-0000-0000-0000-000000000000 + * + * @param {string} [createManagementGroupRequest.displayName] The friendly name + * of the management group. If no value is passed then this field will be set + * to the groupId. + * + * @param {object} [createManagementGroupRequest.details] Details + * + * @param {object} [createManagementGroupRequest.details.parent] Parent + * + * @param {string} [createManagementGroupRequest.details.parent.id] The fully + * qualified ID for the parent management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.cacheControl] Indicates that the request shouldn't + * utilize any caches. + * + * @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. + */ + beginCreateOrUpdateWithHttpOperationResponse(groupId, createManagementGroupRequest, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(groupId, createManagementGroupRequest, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create or update a management group. If a management group is already + * created and a subsequent create request is issued with different properties, + * the management group properties will be updated. + * + * @param {string} groupId Management Group ID. + * + * @param {object} createManagementGroupRequest Management group creation + * parameters. + * + * @param {string} [createManagementGroupRequest.name] The name of the + * management group. For example, 00000000-0000-0000-0000-000000000000 + * + * @param {string} [createManagementGroupRequest.displayName] The friendly name + * of the management group. If no value is passed then this field will be set + * to the groupId. + * + * @param {object} [createManagementGroupRequest.details] Details + * + * @param {object} [createManagementGroupRequest.details.parent] Parent + * + * @param {string} [createManagementGroupRequest.details.parent.id] The fully + * qualified ID for the parent management group. For example, + * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.cacheControl] Indicates that the request shouldn't + * utilize any caches. + * + * @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. + */ + beginCreateOrUpdate(groupId, createManagementGroupRequest, 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._beginCreateOrUpdate(groupId, createManagementGroupRequest, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(groupId, createManagementGroupRequest, options, optionalCallback); + } + } + + /** + * Delete management group. If a management group contains child resources, the + * request will fail. + * + * @param {string} groupId Management Group ID. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.cacheControl] Indicates that the request shouldn't + * utilize any caches. + * + * @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. + */ + beginDeleteMethodWithHttpOperationResponse(groupId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(groupId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete management group. If a management group contains child resources, the + * request will fail. + * + * @param {string} groupId Management Group ID. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.cacheControl] Indicates that the request shouldn't + * utilize any caches. + * + * @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 {OperationResults} - 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 OperationResults} 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. + */ + beginDeleteMethod(groupId, 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._beginDeleteMethod(groupId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(groupId, options, optionalCallback); + } + } + + /** + * List management groups for the authenticated user. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -1538,7 +1995,6 @@ class ManagementGroups { /** * List management groups for the authenticated user. * - * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. * diff --git a/lib/services/managementgroupsManagement/package.json b/lib/services/managementgroupsManagement/package.json index 22d1628d82..fa2f29041f 100644 --- a/lib/services/managementgroupsManagement/package.json +++ b/lib/services/managementgroupsManagement/package.json @@ -14,12 +14,12 @@ "license": "MIT", "main": "./lib/managementGroupsAPI.js", "types": "./lib/managementGroupsAPI.d.ts", - "homepage": "http://github.com/azure/azure-sdk-for-node", + "homepage": "https://github.com/azure/azure-sdk-for-node/tree/master/lib/services/managementgroupsManagement", "repository": { "type": "git", "url": "https://github.com/azure/azure-sdk-for-node.git" }, "bugs": { - "url": "http://github.com/Azure/azure-sdk-for-node/issues" + "url": "https://github.com/azure/azure-sdk-for-node/issues" } -} \ No newline at end of file +}