diff --git a/lib/services/apimanagement/lib/models/index.d.ts b/lib/services/apimanagement/lib/models/index.d.ts index 6555a15fe6..7651557730 100644 --- a/lib/services/apimanagement/lib/models/index.d.ts +++ b/lib/services/apimanagement/lib/models/index.d.ts @@ -939,22 +939,65 @@ export interface SchemaContract extends Resource { * @constructor * Issue Contract details. * - * @member {string} title The issue title. - * @member {string} description Text describing the issue. * @member {date} [createdDate] Date and time when the issue was created. * @member {string} [state] Status of the issue. Possible values include: * 'proposed', 'open', 'removed', 'resolved', 'closed' - * @member {string} userId A resource identifier for the user created the - * issue. * @member {string} [apiId] A resource identifier for the API the issue was * created for. + * @member {string} title The issue title. + * @member {string} description Text describing the issue. + * @member {string} userId A resource identifier for the user created the + * issue. */ export interface IssueContract extends Resource { + createdDate?: Date; + state?: string; + apiId?: string; title: string; description: string; + userId: string; +} + +/** + * @class + * Initializes a new instance of the IssueUpdateContract class. + * @constructor + * Issue update Parameters. + * + * @member {date} [createdDate] Date and time when the issue was created. + * @member {string} [state] Status of the issue. Possible values include: + * 'proposed', 'open', 'removed', 'resolved', 'closed' + * @member {string} [apiId] A resource identifier for the API the issue was + * created for. + * @member {string} [title] The issue title. + * @member {string} [description] Text describing the issue. + * @member {string} [userId] A resource identifier for the user created the + * issue. + */ +export interface IssueUpdateContract { + createdDate?: Date; + state?: string; + apiId?: string; + title?: string; + description?: string; + userId?: string; +} + +/** + * @class + * Initializes a new instance of the IssueContractBaseProperties class. + * @constructor + * Issue contract Base Properties. + * + * @member {date} [createdDate] Date and time when the issue was created. + * @member {string} [state] Status of the issue. Possible values include: + * 'proposed', 'open', 'removed', 'resolved', 'closed' + * @member {string} [apiId] A resource identifier for the API the issue was + * created for. + */ +export interface IssueContractBaseProperties { createdDate?: Date; state?: string; - userId: string; apiId?: string; } @@ -2679,7 +2722,7 @@ export interface UserIdentityContract { export interface UserEntityBaseParameters { state?: string; note?: string; - readonly identities?: UserIdentityContract[]; + identities?: UserIdentityContract[]; } /** @@ -2706,7 +2749,7 @@ export interface UserEntityBaseParameters { export interface UserContract extends Resource { state?: string; note?: string; - readonly identities?: UserIdentityContract[]; + identities?: UserIdentityContract[]; firstName?: string; lastName?: string; email?: string; @@ -3833,7 +3876,7 @@ export interface GenerateSsoUrlResult { export interface UserCreateParameters { state?: string; note?: string; - readonly identities?: UserIdentityContract[]; + identities?: UserIdentityContract[]; email: string; firstName: string; lastName: string; @@ -3892,7 +3935,7 @@ export interface UserTokenResult { export interface UserUpdateParameters { state?: string; note?: string; - readonly identities?: UserIdentityContract[]; + identities?: UserIdentityContract[]; email?: string; password?: string; firstName?: string; diff --git a/lib/services/apimanagement/lib/models/index.js b/lib/services/apimanagement/lib/models/index.js index eead049a1a..e8800de2c3 100644 --- a/lib/services/apimanagement/lib/models/index.js +++ b/lib/services/apimanagement/lib/models/index.js @@ -51,6 +51,8 @@ exports.OperationEntityBaseContract = require('./operationEntityBaseContract'); exports.OperationUpdateContract = require('./operationUpdateContract'); exports.SchemaContract = require('./schemaContract'); exports.IssueContract = require('./issueContract'); +exports.IssueUpdateContract = require('./issueUpdateContract'); +exports.IssueContractBaseProperties = require('./issueContractBaseProperties'); exports.IssueCommentContract = require('./issueCommentContract'); exports.IssueAttachmentContract = require('./issueAttachmentContract'); exports.LoggerContract = require('./loggerContract'); diff --git a/lib/services/apimanagement/lib/models/issueContract.js b/lib/services/apimanagement/lib/models/issueContract.js index a6aed2c2c8..16424b112f 100644 --- a/lib/services/apimanagement/lib/models/issueContract.js +++ b/lib/services/apimanagement/lib/models/issueContract.js @@ -20,15 +20,15 @@ const models = require('./index'); class IssueContract extends models['Resource'] { /** * Create a IssueContract. - * @member {string} title The issue title. - * @member {string} description Text describing the issue. * @member {date} [createdDate] Date and time when the issue was created. * @member {string} [state] Status of the issue. Possible values include: * 'proposed', 'open', 'removed', 'resolved', 'closed' - * @member {string} userId A resource identifier for the user created the - * issue. * @member {string} [apiId] A resource identifier for the API the issue was * created for. + * @member {string} title The issue title. + * @member {string} description Text describing the issue. + * @member {string} userId A resource identifier for the user created the + * issue. */ constructor() { super(); @@ -72,44 +72,44 @@ class IssueContract extends models['Resource'] { name: 'String' } }, - title: { - required: true, - serializedName: 'properties.title', + createdDate: { + required: false, + serializedName: 'properties.createdDate', type: { - name: 'String' + name: 'DateTime' } }, - description: { - required: true, - serializedName: 'properties.description', + state: { + required: false, + serializedName: 'properties.state', type: { name: 'String' } }, - createdDate: { + apiId: { required: false, - serializedName: 'properties.createdDate', + serializedName: 'properties.apiId', type: { - name: 'DateTime' + name: 'String' } }, - state: { - required: false, - serializedName: 'properties.state', + title: { + required: true, + serializedName: 'properties.title', type: { name: 'String' } }, - userId: { + description: { required: true, - serializedName: 'properties.userId', + serializedName: 'properties.description', type: { name: 'String' } }, - apiId: { - required: false, - serializedName: 'properties.apiId', + userId: { + required: true, + serializedName: 'properties.userId', type: { name: 'String' } diff --git a/lib/services/apimanagement/lib/models/issueContractBaseProperties.js b/lib/services/apimanagement/lib/models/issueContractBaseProperties.js new file mode 100644 index 0000000000..0f593b4c9c --- /dev/null +++ b/lib/services/apimanagement/lib/models/issueContractBaseProperties.js @@ -0,0 +1,70 @@ +/* + * 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'; + +/** + * Issue contract Base Properties. + * + */ +class IssueContractBaseProperties { + /** + * Create a IssueContractBaseProperties. + * @member {date} [createdDate] Date and time when the issue was created. + * @member {string} [state] Status of the issue. Possible values include: + * 'proposed', 'open', 'removed', 'resolved', 'closed' + * @member {string} [apiId] A resource identifier for the API the issue was + * created for. + */ + constructor() { + } + + /** + * Defines the metadata of IssueContractBaseProperties + * + * @returns {object} metadata of IssueContractBaseProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'IssueContractBaseProperties', + type: { + name: 'Composite', + className: 'IssueContractBaseProperties', + modelProperties: { + createdDate: { + required: false, + serializedName: 'createdDate', + type: { + name: 'DateTime' + } + }, + state: { + required: false, + serializedName: 'state', + type: { + name: 'String' + } + }, + apiId: { + required: false, + serializedName: 'apiId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = IssueContractBaseProperties; diff --git a/lib/services/apimanagement/lib/models/issueUpdateContract.js b/lib/services/apimanagement/lib/models/issueUpdateContract.js new file mode 100644 index 0000000000..a7f4567e66 --- /dev/null +++ b/lib/services/apimanagement/lib/models/issueUpdateContract.js @@ -0,0 +1,95 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Issue update Parameters. + * + */ +class IssueUpdateContract { + /** + * Create a IssueUpdateContract. + * @member {date} [createdDate] Date and time when the issue was created. + * @member {string} [state] Status of the issue. Possible values include: + * 'proposed', 'open', 'removed', 'resolved', 'closed' + * @member {string} [apiId] A resource identifier for the API the issue was + * created for. + * @member {string} [title] The issue title. + * @member {string} [description] Text describing the issue. + * @member {string} [userId] A resource identifier for the user created the + * issue. + */ + constructor() { + } + + /** + * Defines the metadata of IssueUpdateContract + * + * @returns {object} metadata of IssueUpdateContract + * + */ + mapper() { + return { + required: false, + serializedName: 'IssueUpdateContract', + type: { + name: 'Composite', + className: 'IssueUpdateContract', + modelProperties: { + createdDate: { + required: false, + serializedName: 'properties.createdDate', + type: { + name: 'DateTime' + } + }, + state: { + required: false, + serializedName: 'properties.state', + type: { + name: 'String' + } + }, + apiId: { + required: false, + serializedName: 'properties.apiId', + type: { + name: 'String' + } + }, + title: { + required: false, + serializedName: 'properties.title', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + userId: { + required: false, + serializedName: 'properties.userId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = IssueUpdateContract; diff --git a/lib/services/apimanagement/lib/models/userContract.js b/lib/services/apimanagement/lib/models/userContract.js index 417385fece..3b96123ed1 100644 --- a/lib/services/apimanagement/lib/models/userContract.js +++ b/lib/services/apimanagement/lib/models/userContract.js @@ -95,7 +95,6 @@ class UserContract extends models['Resource'] { }, identities: { required: false, - readOnly: true, serializedName: 'properties.identities', type: { name: 'Sequence', diff --git a/lib/services/apimanagement/lib/models/userCreateParameters.js b/lib/services/apimanagement/lib/models/userCreateParameters.js index b35ec3061c..67ba7f342e 100644 --- a/lib/services/apimanagement/lib/models/userCreateParameters.js +++ b/lib/services/apimanagement/lib/models/userCreateParameters.js @@ -69,7 +69,6 @@ class UserCreateParameters { }, identities: { required: false, - readOnly: true, serializedName: 'properties.identities', type: { name: 'Sequence', diff --git a/lib/services/apimanagement/lib/models/userEntityBaseParameters.js b/lib/services/apimanagement/lib/models/userEntityBaseParameters.js index 4bdb627965..dc5084f203 100644 --- a/lib/services/apimanagement/lib/models/userEntityBaseParameters.js +++ b/lib/services/apimanagement/lib/models/userEntityBaseParameters.js @@ -60,7 +60,6 @@ class UserEntityBaseParameters { }, identities: { required: false, - readOnly: true, serializedName: 'identities', type: { name: 'Sequence', diff --git a/lib/services/apimanagement/lib/models/userUpdateParameters.js b/lib/services/apimanagement/lib/models/userUpdateParameters.js index 55d918eab0..5269d46b93 100644 --- a/lib/services/apimanagement/lib/models/userUpdateParameters.js +++ b/lib/services/apimanagement/lib/models/userUpdateParameters.js @@ -65,7 +65,6 @@ class UserUpdateParameters { }, identities: { required: false, - readOnly: true, serializedName: 'properties.identities', type: { name: 'Sequence', diff --git a/lib/services/apimanagement/lib/operations/apiIssue.js b/lib/services/apimanagement/lib/operations/apiIssue.js index e0690110da..0f9ce8b7d9 100644 --- a/lib/services/apimanagement/lib/operations/apiIssue.js +++ b/lib/services/apimanagement/lib/operations/apiIssue.js @@ -643,22 +643,22 @@ function _get(resourceGroupName, serviceName, apiId, issueId, options, callback) * * @param {object} parameters Create parameters. * - * @param {string} parameters.title The issue title. - * - * @param {string} parameters.description Text describing the issue. - * * @param {date} [parameters.createdDate] Date and time when the issue was * created. * * @param {string} [parameters.state] Status of the issue. Possible values * include: 'proposed', 'open', 'removed', 'resolved', 'closed' * - * @param {string} parameters.userId A resource identifier for the user created - * the issue. - * * @param {string} [parameters.apiId] A resource identifier for the API the * issue was created for. * + * @param {string} parameters.title The issue title. + * + * @param {string} parameters.description Text describing the issue. + * + * @param {string} parameters.userId A resource identifier for the user created + * the issue. + * * @param {object} [options] Optional Parameters. * * @param {string} [options.ifMatch] ETag of the Issue Entity. ETag should @@ -893,6 +893,236 @@ function _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, paramet }); } +/** + * Updates an existing issue for an API. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} serviceName The name of the API Management service. + * + * @param {string} apiId API identifier. Must be unique in the current API + * Management service instance. + * + * @param {string} issueId Issue identifier. Must be unique in the current API + * Management service instance. + * + * @param {object} parameters Update parameters. + * + * @param {date} [parameters.createdDate] Date and time when the issue was + * created. + * + * @param {string} [parameters.state] Status of the issue. Possible values + * include: 'proposed', 'open', 'removed', 'resolved', 'closed' + * + * @param {string} [parameters.apiId] A resource identifier for the API the + * issue was created for. + * + * @param {string} [parameters.title] The issue title. + * + * @param {string} [parameters.description] Text describing the issue. + * + * @param {string} [parameters.userId] A resource identifier for the user + * created the issue. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.ifMatch] ETag of the Issue Entity. ETag should + * match the current entity state from the header response of the GET request + * or it should be * for unconditional update. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, serviceName, apiId, issueId, parameters, 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 ifMatch = (options && options.ifMatch !== undefined) ? options.ifMatch : undefined; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (serviceName === null || serviceName === undefined || typeof serviceName.valueOf() !== 'string') { + throw new Error('serviceName cannot be null or undefined and it must be of type string.'); + } + if (serviceName !== null && serviceName !== undefined) { + if (serviceName.length > 50) + { + throw new Error('"serviceName" should satisfy the constraint - "MaxLength": 50'); + } + if (serviceName.length < 1) + { + throw new Error('"serviceName" should satisfy the constraint - "MinLength": 1'); + } + if (serviceName.match(/^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$/) === null) + { + throw new Error('"serviceName" should satisfy the constraint - "Pattern": /^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$/'); + } + } + if (apiId === null || apiId === undefined || typeof apiId.valueOf() !== 'string') { + throw new Error('apiId cannot be null or undefined and it must be of type string.'); + } + if (apiId !== null && apiId !== undefined) { + if (apiId.length > 80) + { + throw new Error('"apiId" should satisfy the constraint - "MaxLength": 80'); + } + if (apiId.length < 1) + { + throw new Error('"apiId" should satisfy the constraint - "MinLength": 1'); + } + if (apiId.match(/(^[\w]+$)|(^[\w][\w\-]+[\w]$)/) === null) + { + throw new Error('"apiId" should satisfy the constraint - "Pattern": /(^[\w]+$)|(^[\w][\w\-]+[\w]$)/'); + } + } + if (issueId === null || issueId === undefined || typeof issueId.valueOf() !== 'string') { + throw new Error('issueId cannot be null or undefined and it must be of type string.'); + } + if (issueId !== null && issueId !== undefined) { + if (issueId.length > 256) + { + throw new Error('"issueId" should satisfy the constraint - "MaxLength": 256'); + } + if (issueId.length < 1) + { + throw new Error('"issueId" should satisfy the constraint - "MinLength": 1'); + } + if (issueId.match(/^[^*#&+:<>?]+$/) === null) + { + throw new Error('"issueId" should satisfy the constraint - "Pattern": /^[^*#&+:<>?]+$/'); + } + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (ifMatch !== null && ifMatch !== undefined && typeof ifMatch.valueOf() !== 'string') { + throw new Error('ifMatch must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serviceName}', encodeURIComponent(serviceName)); + requestUrl = requestUrl.replace('{apiId}', encodeURIComponent(apiId)); + requestUrl = requestUrl.replace('{issueId}', encodeURIComponent(issueId)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + 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 (ifMatch !== undefined && ifMatch !== null) { + httpRequest.headers['If-Match'] = ifMatch; + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['IssueUpdateContract']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, 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 !== 204) { + 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; + + return callback(null, result, httpRequest, response); + }); +} + /** * Deletes the specified Issue from an API. * @@ -1227,6 +1457,7 @@ class ApiIssue { this._getEntityTag = _getEntityTag; this._get = _get; this._createOrUpdate = _createOrUpdate; + this._update = _update; this._deleteMethod = _deleteMethod; this._listByServiceNext = _listByServiceNext; } @@ -1561,22 +1792,22 @@ class ApiIssue { * * @param {object} parameters Create parameters. * - * @param {string} parameters.title The issue title. - * - * @param {string} parameters.description Text describing the issue. - * * @param {date} [parameters.createdDate] Date and time when the issue was * created. * * @param {string} [parameters.state] Status of the issue. Possible values * include: 'proposed', 'open', 'removed', 'resolved', 'closed' * - * @param {string} parameters.userId A resource identifier for the user created - * the issue. - * * @param {string} [parameters.apiId] A resource identifier for the API the * issue was created for. * + * @param {string} parameters.title The issue title. + * + * @param {string} parameters.description Text describing the issue. + * + * @param {string} parameters.userId A resource identifier for the user created + * the issue. + * * @param {object} [options] Optional Parameters. * * @param {string} [options.ifMatch] ETag of the Issue Entity. ETag should @@ -1621,22 +1852,22 @@ class ApiIssue { * * @param {object} parameters Create parameters. * - * @param {string} parameters.title The issue title. - * - * @param {string} parameters.description Text describing the issue. - * * @param {date} [parameters.createdDate] Date and time when the issue was * created. * * @param {string} [parameters.state] Status of the issue. Possible values * include: 'proposed', 'open', 'removed', 'resolved', 'closed' * - * @param {string} parameters.userId A resource identifier for the user created - * the issue. - * * @param {string} [parameters.apiId] A resource identifier for the API the * issue was created for. * + * @param {string} parameters.title The issue title. + * + * @param {string} parameters.description Text describing the issue. + * + * @param {string} parameters.userId A resource identifier for the user created + * the issue. + * * @param {object} [options] Optional Parameters. * * @param {string} [options.ifMatch] ETag of the Issue Entity. ETag should @@ -1688,6 +1919,147 @@ class ApiIssue { } } + /** + * Updates an existing issue for an API. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} serviceName The name of the API Management service. + * + * @param {string} apiId API identifier. Must be unique in the current API + * Management service instance. + * + * @param {string} issueId Issue identifier. Must be unique in the current API + * Management service instance. + * + * @param {object} parameters Update parameters. + * + * @param {date} [parameters.createdDate] Date and time when the issue was + * created. + * + * @param {string} [parameters.state] Status of the issue. Possible values + * include: 'proposed', 'open', 'removed', 'resolved', 'closed' + * + * @param {string} [parameters.apiId] A resource identifier for the API the + * issue was created for. + * + * @param {string} [parameters.title] The issue title. + * + * @param {string} [parameters.description] Text describing the issue. + * + * @param {string} [parameters.userId] A resource identifier for the user + * created the issue. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.ifMatch] ETag of the Issue Entity. ETag should + * match the current entity state from the header response of the GET request + * or it should be * for unconditional update. + * + * @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. + */ + updateWithHttpOperationResponse(resourceGroupName, serviceName, apiId, issueId, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, serviceName, apiId, issueId, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates an existing issue for an API. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} serviceName The name of the API Management service. + * + * @param {string} apiId API identifier. Must be unique in the current API + * Management service instance. + * + * @param {string} issueId Issue identifier. Must be unique in the current API + * Management service instance. + * + * @param {object} parameters Update parameters. + * + * @param {date} [parameters.createdDate] Date and time when the issue was + * created. + * + * @param {string} [parameters.state] Status of the issue. Possible values + * include: 'proposed', 'open', 'removed', 'resolved', 'closed' + * + * @param {string} [parameters.apiId] A resource identifier for the API the + * issue was created for. + * + * @param {string} [parameters.title] The issue title. + * + * @param {string} [parameters.description] Text describing the issue. + * + * @param {string} [parameters.userId] A resource identifier for the user + * created the issue. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.ifMatch] ETag of the Issue Entity. ETag should + * match the current entity state from the header response of the GET request + * or it should be * for unconditional update. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName, serviceName, apiId, issueId, parameters, 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._update(resourceGroupName, serviceName, apiId, issueId, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, serviceName, apiId, issueId, parameters, options, optionalCallback); + } + } + /** * Deletes the specified Issue from an API. * diff --git a/lib/services/apimanagement/lib/operations/index.d.ts b/lib/services/apimanagement/lib/operations/index.d.ts index 2ca8c1db27..844a54153e 100644 --- a/lib/services/apimanagement/lib/operations/index.d.ts +++ b/lib/services/apimanagement/lib/operations/index.d.ts @@ -5582,22 +5582,22 @@ export interface ApiIssue { * * @param {object} parameters Create parameters. * - * @param {string} parameters.title The issue title. - * - * @param {string} parameters.description Text describing the issue. - * * @param {date} [parameters.createdDate] Date and time when the issue was * created. * * @param {string} [parameters.state] Status of the issue. Possible values * include: 'proposed', 'open', 'removed', 'resolved', 'closed' * - * @param {string} parameters.userId A resource identifier for the user created - * the issue. - * * @param {string} [parameters.apiId] A resource identifier for the API the * issue was created for. * + * @param {string} parameters.title The issue title. + * + * @param {string} parameters.description Text describing the issue. + * + * @param {string} parameters.userId A resource identifier for the user created + * the issue. + * * @param {object} [options] Optional Parameters. * * @param {string} [options.ifMatch] ETag of the Issue Entity. ETag should @@ -5630,22 +5630,22 @@ export interface ApiIssue { * * @param {object} parameters Create parameters. * - * @param {string} parameters.title The issue title. - * - * @param {string} parameters.description Text describing the issue. - * * @param {date} [parameters.createdDate] Date and time when the issue was * created. * * @param {string} [parameters.state] Status of the issue. Possible values * include: 'proposed', 'open', 'removed', 'resolved', 'closed' * - * @param {string} parameters.userId A resource identifier for the user created - * the issue. - * * @param {string} [parameters.apiId] A resource identifier for the API the * issue was created for. * + * @param {string} parameters.title The issue title. + * + * @param {string} parameters.description Text describing the issue. + * + * @param {string} parameters.userId A resource identifier for the user created + * the issue. + * * @param {object} [options] Optional Parameters. * * @param {string} [options.ifMatch] ETag of the Issue Entity. ETag should @@ -5682,6 +5682,120 @@ export interface ApiIssue { createOrUpdate(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, parameters: models.IssueContract, options: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + /** + * Updates an existing issue for an API. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} serviceName The name of the API Management service. + * + * @param {string} apiId API identifier. Must be unique in the current API + * Management service instance. + * + * @param {string} issueId Issue identifier. Must be unique in the current API + * Management service instance. + * + * @param {object} parameters Update parameters. + * + * @param {date} [parameters.createdDate] Date and time when the issue was + * created. + * + * @param {string} [parameters.state] Status of the issue. Possible values + * include: 'proposed', 'open', 'removed', 'resolved', 'closed' + * + * @param {string} [parameters.apiId] A resource identifier for the API the + * issue was created for. + * + * @param {string} [parameters.title] The issue title. + * + * @param {string} [parameters.description] Text describing the issue. + * + * @param {string} [parameters.userId] A resource identifier for the user + * created the issue. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.ifMatch] ETag of the Issue Entity. ETag should + * match the current entity state from the header response of the GET request + * or it should be * for unconditional update. + * + * @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(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, parameters: models.IssueUpdateContract, options?: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates an existing issue for an API. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} serviceName The name of the API Management service. + * + * @param {string} apiId API identifier. Must be unique in the current API + * Management service instance. + * + * @param {string} issueId Issue identifier. Must be unique in the current API + * Management service instance. + * + * @param {object} parameters Update parameters. + * + * @param {date} [parameters.createdDate] Date and time when the issue was + * created. + * + * @param {string} [parameters.state] Status of the issue. Possible values + * include: 'proposed', 'open', 'removed', 'resolved', 'closed' + * + * @param {string} [parameters.apiId] A resource identifier for the API the + * issue was created for. + * + * @param {string} [parameters.title] The issue title. + * + * @param {string} [parameters.description] Text describing the issue. + * + * @param {string} [parameters.userId] A resource identifier for the user + * created the issue. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.ifMatch] ETag of the Issue Entity. ETag should + * match the current entity state from the header response of the GET request + * or it should be * for unconditional update. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, parameters: models.IssueUpdateContract, options?: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, parameters: models.IssueUpdateContract, callback: ServiceCallback): void; + update(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, parameters: models.IssueUpdateContract, options: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + /** * Deletes the specified Issue from an API. * @@ -25753,6 +25867,8 @@ export interface User { * @param {string} [parameters.note] Optional note about a user set by the * administrator. * + * @param {array} [parameters.identities] Collection of user identities. + * * @param {string} parameters.email Email address. Must not be empty and must * be unique within the service instance. * @@ -25803,6 +25919,8 @@ export interface User { * @param {string} [parameters.note] Optional note about a user set by the * administrator. * + * @param {array} [parameters.identities] Collection of user identities. + * * @param {string} parameters.email Email address. Must not be empty and must * be unique within the service instance. * @@ -25872,6 +25990,8 @@ export interface User { * @param {string} [parameters.note] Optional note about a user set by the * administrator. * + * @param {array} [parameters.identities] Collection of user identities. + * * @param {string} [parameters.email] Email address. Must not be empty and must * be unique within the service instance. * @@ -25918,6 +26038,8 @@ export interface User { * @param {string} [parameters.note] Optional note about a user set by the * administrator. * + * @param {array} [parameters.identities] Collection of user identities. + * * @param {string} [parameters.email] Email address. Must not be empty and must * be unique within the service instance. * diff --git a/lib/services/apimanagement/lib/operations/user.js b/lib/services/apimanagement/lib/operations/user.js index a279c6c018..0dac152210 100644 --- a/lib/services/apimanagement/lib/operations/user.js +++ b/lib/services/apimanagement/lib/operations/user.js @@ -594,6 +594,8 @@ function _get(resourceGroupName, serviceName, uid, options, callback) { * @param {string} [parameters.note] Optional note about a user set by the * administrator. * + * @param {array} [parameters.identities] Collection of user identities. + * * @param {string} parameters.email Email address. Must not be empty and must * be unique within the service instance. * @@ -843,6 +845,8 @@ function _createOrUpdate(resourceGroupName, serviceName, uid, parameters, option * @param {string} [parameters.note] Optional note about a user set by the * administrator. * + * @param {array} [parameters.identities] Collection of user identities. + * * @param {string} [parameters.email] Email address. Must not be empty and must * be unique within the service instance. * @@ -2097,6 +2101,8 @@ class User { * @param {string} [parameters.note] Optional note about a user set by the * administrator. * + * @param {array} [parameters.identities] Collection of user identities. + * * @param {string} parameters.email Email address. Must not be empty and must * be unique within the service instance. * @@ -2159,6 +2165,8 @@ class User { * @param {string} [parameters.note] Optional note about a user set by the * administrator. * + * @param {array} [parameters.identities] Collection of user identities. + * * @param {string} parameters.email Email address. Must not be empty and must * be unique within the service instance. * @@ -2243,6 +2251,8 @@ class User { * @param {string} [parameters.note] Optional note about a user set by the * administrator. * + * @param {array} [parameters.identities] Collection of user identities. + * * @param {string} [parameters.email] Email address. Must not be empty and must * be unique within the service instance. * @@ -2301,6 +2311,8 @@ class User { * @param {string} [parameters.note] Optional note about a user set by the * administrator. * + * @param {array} [parameters.identities] Collection of user identities. + * * @param {string} [parameters.email] Email address. Must not be empty and must * be unique within the service instance. *