From 2faff81f1ad21df041ba1c8dd458ee74fa306e99 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 3 Apr 2018 12:04:07 -0700 Subject: [PATCH 1/8] Generated from 33f79dd230b9b6291d1a5ac0568723d8e5a44aac (#2620) Support for Non Xml Encoded policies --- lib/services/apimanagement/LICENSE.txt | 42 +++++----- lib/services/apimanagement/README.md | 76 +++++++++---------- .../apimanagement/lib/models/index.d.ts | 3 +- .../lib/models/policyContract.js | 3 +- .../lib/operations/apiOperationPolicy.js | 6 +- .../apimanagement/lib/operations/apiPolicy.js | 6 +- .../apimanagement/lib/operations/index.d.ts | 16 ++-- .../apimanagement/lib/operations/policy.js | 6 +- .../lib/operations/productPolicy.js | 6 +- 9 files changed, 83 insertions(+), 81 deletions(-) diff --git a/lib/services/apimanagement/LICENSE.txt b/lib/services/apimanagement/LICENSE.txt index a70e8cf660..5431ba98b9 100644 --- a/lib/services/apimanagement/LICENSE.txt +++ b/lib/services/apimanagement/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/apimanagement/README.md b/lib/services/apimanagement/README.md index 49ab69189f..33a2a09333 100644 --- a/lib/services/apimanagement/README.md +++ b/lib/services/apimanagement/README.md @@ -1,38 +1,38 @@ -# Microsoft Azure SDK for Node.js - ApiManagementClient -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-apimanagement -``` - -## How to use - -### Authentication, client creation and listByService policy as an example. - -```javascript -const msRestAzure = require("ms-rest-azure"); -const ApiManagementClient = require("azure-arm-apimanagement"); -msRestAzure.interactiveLogin().then((creds) => { - const subscriptionId = ""; - const client = new ApiManagementClient(creds, subscriptionId); - const resourceGroupName = "testresourceGroupName"; - const serviceName = "testserviceName"; - const scope = "Tenant"; - return client.policy.listByService(resourceGroupName, serviceName, scope).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) +# Microsoft Azure SDK for Node.js - ApiManagementClient +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-apimanagement +``` + +## How to use + +### Authentication, client creation and listByService policy as an example. + +```javascript +const msRestAzure = require("ms-rest-azure"); +const ApiManagementClient = require("azure-arm-apimanagement"); +msRestAzure.interactiveLogin().then((creds) => { + const subscriptionId = ""; + const client = new ApiManagementClient(creds, subscriptionId); + const resourceGroupName = "testresourceGroupName"; + const serviceName = "testserviceName"; + const scope = "Tenant"; + return client.policy.listByService(resourceGroupName, serviceName, scope).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) diff --git a/lib/services/apimanagement/lib/models/index.d.ts b/lib/services/apimanagement/lib/models/index.d.ts index 7aaebd0e66..4d9a030f90 100644 --- a/lib/services/apimanagement/lib/models/index.d.ts +++ b/lib/services/apimanagement/lib/models/index.d.ts @@ -76,7 +76,8 @@ export interface Resource extends BaseResource { * @member {string} policyContent Json escaped Xml Encoded contents of the * Policy. * @member {string} [contentFormat] Format of the policyContent. Possible - * values include: 'xml', 'xml-link'. Default value: 'xml' . + * values include: 'xml', 'xml-link', 'rawxml', 'rawxml-link'. Default value: + * 'xml' . */ export interface PolicyContract extends Resource { policyContent: string; diff --git a/lib/services/apimanagement/lib/models/policyContract.js b/lib/services/apimanagement/lib/models/policyContract.js index 2e7ab71a6d..f335557dff 100644 --- a/lib/services/apimanagement/lib/models/policyContract.js +++ b/lib/services/apimanagement/lib/models/policyContract.js @@ -23,7 +23,8 @@ class PolicyContract extends models['Resource'] { * @member {string} policyContent Json escaped Xml Encoded contents of the * Policy. * @member {string} [contentFormat] Format of the policyContent. Possible - * values include: 'xml', 'xml-link'. Default value: 'xml' . + * values include: 'xml', 'xml-link', 'rawxml', 'rawxml-link'. Default value: + * 'xml' . */ constructor() { super(); diff --git a/lib/services/apimanagement/lib/operations/apiOperationPolicy.js b/lib/services/apimanagement/lib/operations/apiOperationPolicy.js index 2a504649ca..02ff39bf3f 100644 --- a/lib/services/apimanagement/lib/operations/apiOperationPolicy.js +++ b/lib/services/apimanagement/lib/operations/apiOperationPolicy.js @@ -630,7 +630,7 @@ function _get(resourceGroupName, serviceName, apiId, operationId, options, callb * of the Policy. * * @param {string} [parameters.contentFormat] Format of the policyContent. - * Possible values include: 'xml', 'xml-link' + * Possible values include: 'xml', 'xml-link', 'rawxml', 'rawxml-link' * * @param {object} [options] Optional Parameters. * @@ -1400,7 +1400,7 @@ class ApiOperationPolicy { * of the Policy. * * @param {string} [parameters.contentFormat] Format of the policyContent. - * Possible values include: 'xml', 'xml-link' + * Possible values include: 'xml', 'xml-link', 'rawxml', 'rawxml-link' * * @param {object} [options] Optional Parameters. * @@ -1450,7 +1450,7 @@ class ApiOperationPolicy { * of the Policy. * * @param {string} [parameters.contentFormat] Format of the policyContent. - * Possible values include: 'xml', 'xml-link' + * Possible values include: 'xml', 'xml-link', 'rawxml', 'rawxml-link' * * @param {object} [options] Optional Parameters. * diff --git a/lib/services/apimanagement/lib/operations/apiPolicy.js b/lib/services/apimanagement/lib/operations/apiPolicy.js index 600e185bb5..048a63f56c 100644 --- a/lib/services/apimanagement/lib/operations/apiPolicy.js +++ b/lib/services/apimanagement/lib/operations/apiPolicy.js @@ -564,7 +564,7 @@ function _get(resourceGroupName, serviceName, apiId, options, callback) { * of the Policy. * * @param {string} [parameters.contentFormat] Format of the policyContent. - * Possible values include: 'xml', 'xml-link' + * Possible values include: 'xml', 'xml-link', 'rawxml', 'rawxml-link' * * @param {object} [options] Optional Parameters. * @@ -1274,7 +1274,7 @@ class ApiPolicy { * of the Policy. * * @param {string} [parameters.contentFormat] Format of the policyContent. - * Possible values include: 'xml', 'xml-link' + * Possible values include: 'xml', 'xml-link', 'rawxml', 'rawxml-link' * * @param {object} [options] Optional Parameters. * @@ -1321,7 +1321,7 @@ class ApiPolicy { * of the Policy. * * @param {string} [parameters.contentFormat] Format of the policyContent. - * Possible values include: 'xml', 'xml-link' + * Possible values include: 'xml', 'xml-link', 'rawxml', 'rawxml-link' * * @param {object} [options] Optional Parameters. * diff --git a/lib/services/apimanagement/lib/operations/index.d.ts b/lib/services/apimanagement/lib/operations/index.d.ts index bd0f55da27..0b13b0b4ed 100644 --- a/lib/services/apimanagement/lib/operations/index.d.ts +++ b/lib/services/apimanagement/lib/operations/index.d.ts @@ -220,7 +220,7 @@ export interface Policy { * of the Policy. * * @param {string} [parameters.contentFormat] Format of the policyContent. - * Possible values include: 'xml', 'xml-link' + * Possible values include: 'xml', 'xml-link', 'rawxml', 'rawxml-link' * * @param {object} [options] Optional Parameters. * @@ -249,7 +249,7 @@ export interface Policy { * of the Policy. * * @param {string} [parameters.contentFormat] Format of the policyContent. - * Possible values include: 'xml', 'xml-link' + * Possible values include: 'xml', 'xml-link', 'rawxml', 'rawxml-link' * * @param {object} [options] Optional Parameters. * @@ -3168,7 +3168,7 @@ export interface ApiOperationPolicy { * of the Policy. * * @param {string} [parameters.contentFormat] Format of the policyContent. - * Possible values include: 'xml', 'xml-link' + * Possible values include: 'xml', 'xml-link', 'rawxml', 'rawxml-link' * * @param {object} [options] Optional Parameters. * @@ -3206,7 +3206,7 @@ export interface ApiOperationPolicy { * of the Policy. * * @param {string} [parameters.contentFormat] Format of the policyContent. - * Possible values include: 'xml', 'xml-link' + * Possible values include: 'xml', 'xml-link', 'rawxml', 'rawxml-link' * * @param {object} [options] Optional Parameters. * @@ -3702,7 +3702,7 @@ export interface ApiPolicy { * of the Policy. * * @param {string} [parameters.contentFormat] Format of the policyContent. - * Possible values include: 'xml', 'xml-link' + * Possible values include: 'xml', 'xml-link', 'rawxml', 'rawxml-link' * * @param {object} [options] Optional Parameters. * @@ -3737,7 +3737,7 @@ export interface ApiPolicy { * of the Policy. * * @param {string} [parameters.contentFormat] Format of the policyContent. - * Possible values include: 'xml', 'xml-link' + * Possible values include: 'xml', 'xml-link', 'rawxml', 'rawxml-link' * * @param {object} [options] Optional Parameters. * @@ -17333,7 +17333,7 @@ export interface ProductPolicy { * of the Policy. * * @param {string} [parameters.contentFormat] Format of the policyContent. - * Possible values include: 'xml', 'xml-link' + * Possible values include: 'xml', 'xml-link', 'rawxml', 'rawxml-link' * * @param {object} [options] Optional Parameters. * @@ -17367,7 +17367,7 @@ export interface ProductPolicy { * of the Policy. * * @param {string} [parameters.contentFormat] Format of the policyContent. - * Possible values include: 'xml', 'xml-link' + * Possible values include: 'xml', 'xml-link', 'rawxml', 'rawxml-link' * * @param {object} [options] Optional Parameters. * diff --git a/lib/services/apimanagement/lib/operations/policy.js b/lib/services/apimanagement/lib/operations/policy.js index 7b144325dc..dd48fa49e1 100644 --- a/lib/services/apimanagement/lib/operations/policy.js +++ b/lib/services/apimanagement/lib/operations/policy.js @@ -507,7 +507,7 @@ function _get(resourceGroupName, serviceName, options, callback) { * of the Policy. * * @param {string} [parameters.contentFormat] Format of the policyContent. - * Possible values include: 'xml', 'xml-link' + * Possible values include: 'xml', 'xml-link', 'rawxml', 'rawxml-link' * * @param {object} [options] Optional Parameters. * @@ -1146,7 +1146,7 @@ class Policy { * of the Policy. * * @param {string} [parameters.contentFormat] Format of the policyContent. - * Possible values include: 'xml', 'xml-link' + * Possible values include: 'xml', 'xml-link', 'rawxml', 'rawxml-link' * * @param {object} [options] Optional Parameters. * @@ -1187,7 +1187,7 @@ class Policy { * of the Policy. * * @param {string} [parameters.contentFormat] Format of the policyContent. - * Possible values include: 'xml', 'xml-link' + * Possible values include: 'xml', 'xml-link', 'rawxml', 'rawxml-link' * * @param {object} [options] Optional Parameters. * diff --git a/lib/services/apimanagement/lib/operations/productPolicy.js b/lib/services/apimanagement/lib/operations/productPolicy.js index 5a805671d5..99192fadd6 100644 --- a/lib/services/apimanagement/lib/operations/productPolicy.js +++ b/lib/services/apimanagement/lib/operations/productPolicy.js @@ -559,7 +559,7 @@ function _get(resourceGroupName, serviceName, productId, options, callback) { * of the Policy. * * @param {string} [parameters.contentFormat] Format of the policyContent. - * Possible values include: 'xml', 'xml-link' + * Possible values include: 'xml', 'xml-link', 'rawxml', 'rawxml-link' * * @param {object} [options] Optional Parameters. * @@ -1259,7 +1259,7 @@ class ProductPolicy { * of the Policy. * * @param {string} [parameters.contentFormat] Format of the policyContent. - * Possible values include: 'xml', 'xml-link' + * Possible values include: 'xml', 'xml-link', 'rawxml', 'rawxml-link' * * @param {object} [options] Optional Parameters. * @@ -1305,7 +1305,7 @@ class ProductPolicy { * of the Policy. * * @param {string} [parameters.contentFormat] Format of the policyContent. - * Possible values include: 'xml', 'xml-link' + * Possible values include: 'xml', 'xml-link', 'rawxml', 'rawxml-link' * * @param {object} [options] Optional Parameters. * From dc0df8f5d52c4b5355f6f7fc8e13e3e70b73b104 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 12 Apr 2018 15:11:34 -0700 Subject: [PATCH 2/8] Generated from 15622320814a0839c12b7d8e99c35db9a5adb662 (#2654) Issues Resource added to version 2018-01-01 --- lib/services/apimanagement/README.md | 7 +- .../lib/apiManagementClient.d.ts | 8 + .../apimanagement/lib/apiManagementClient.js | 8 + .../apimanagement/lib/models/apiCollection.js | 2 + .../lib/models/apiReleaseCollection.js | 2 + .../lib/models/apiRevisionCollection.js | 2 + .../apimanagement/lib/models/index.d.ts | 106 +- .../apimanagement/lib/models/index.js | 6 + .../lib/models/issueAttachmentCollection.js | 69 + .../lib/models/issueAttachmentContract.js | 98 ++ .../lib/models/issueCollection.js | 69 + .../lib/models/issueCommentCollection.js | 69 + .../lib/models/issueCommentContract.js | 97 + .../apimanagement/lib/models/issueContract.js | 123 ++ .../lib/models/operationCollection.js | 2 + .../lib/models/schemaCollection.js | 2 + .../lib/operations/apiIssuAttachment.js | 341 ++++ .../lib/operations/apiIssuComment.js | 341 ++++ .../apimanagement/lib/operations/apiIssue.js | 1323 ++++++++++++++ .../lib/operations/apiIssueAttachment.js | 1108 ++++++++++++ .../lib/operations/apiIssueAttachments.js | 613 +++++++ .../lib/operations/apiIssueComment.js | 1098 ++++++++++++ .../lib/operations/apiIssueComments.js | 613 +++++++ .../apimanagement/lib/operations/apiIssues.js | 588 +++++++ .../apimanagement/lib/operations/index.d.ts | 1558 +++++++++++++++++ .../apimanagement/lib/operations/index.js | 8 + lib/services/apimanagement/package.json | 2 +- 27 files changed, 8256 insertions(+), 7 deletions(-) create mode 100644 lib/services/apimanagement/lib/models/issueAttachmentCollection.js create mode 100644 lib/services/apimanagement/lib/models/issueAttachmentContract.js create mode 100644 lib/services/apimanagement/lib/models/issueCollection.js create mode 100644 lib/services/apimanagement/lib/models/issueCommentCollection.js create mode 100644 lib/services/apimanagement/lib/models/issueCommentContract.js create mode 100644 lib/services/apimanagement/lib/models/issueContract.js create mode 100644 lib/services/apimanagement/lib/operations/apiIssuAttachment.js create mode 100644 lib/services/apimanagement/lib/operations/apiIssuComment.js create mode 100644 lib/services/apimanagement/lib/operations/apiIssue.js create mode 100644 lib/services/apimanagement/lib/operations/apiIssueAttachment.js create mode 100644 lib/services/apimanagement/lib/operations/apiIssueAttachments.js create mode 100644 lib/services/apimanagement/lib/operations/apiIssueComment.js create mode 100644 lib/services/apimanagement/lib/operations/apiIssueComments.js create mode 100644 lib/services/apimanagement/lib/operations/apiIssues.js diff --git a/lib/services/apimanagement/README.md b/lib/services/apimanagement/README.md index 33a2a09333..41fea6aa20 100644 --- a/lib/services/apimanagement/README.md +++ b/lib/services/apimanagement/README.md @@ -1,3 +1,8 @@ +--- +uid: azure-arm-apimanagement +summary: *content + +--- # Microsoft Azure SDK for Node.js - ApiManagementClient This project provides a Node.js package for accessing Azure. Right now it supports: - **Node.js version 6.x.x or higher** @@ -29,7 +34,7 @@ msRestAzure.interactiveLogin().then((creds) => { console.log(result); }); }).catch((err) => { - console.log('An error ocurred:'); + console.log('An error occurred:'); console.dir(err, {depth: null, colors: true}); }); diff --git a/lib/services/apimanagement/lib/apiManagementClient.d.ts b/lib/services/apimanagement/lib/apiManagementClient.d.ts index ef9d37e2fa..1bd5a82d4f 100644 --- a/lib/services/apimanagement/lib/apiManagementClient.d.ts +++ b/lib/services/apimanagement/lib/apiManagementClient.d.ts @@ -69,6 +69,14 @@ export default class ApiManagementClient extends AzureServiceClient { apiSchema: operations.ApiSchema; apiDiagnostic: operations.ApiDiagnostic; apiDiagnosticLogger: operations.ApiDiagnosticLogger; + apiIssues: operations.ApiIssues; + apiIssue: operations.ApiIssue; + apiIssueComments: operations.ApiIssueComments; + apiIssuComment: operations.ApiIssuComment; + apiIssueComment: operations.ApiIssueComment; + apiIssueAttachments: operations.ApiIssueAttachments; + apiIssuAttachment: operations.ApiIssuAttachment; + apiIssueAttachment: operations.ApiIssueAttachment; authorizationServer: operations.AuthorizationServer; backend: operations.Backend; certificate: operations.Certificate; diff --git a/lib/services/apimanagement/lib/apiManagementClient.js b/lib/services/apimanagement/lib/apiManagementClient.js index d7fd96798d..b764c25f9c 100644 --- a/lib/services/apimanagement/lib/apiManagementClient.js +++ b/lib/services/apimanagement/lib/apiManagementClient.js @@ -85,6 +85,14 @@ class ApiManagementClient extends ServiceClient { this.apiSchema = new operations.ApiSchema(this); this.apiDiagnostic = new operations.ApiDiagnostic(this); this.apiDiagnosticLogger = new operations.ApiDiagnosticLogger(this); + this.apiIssues = new operations.ApiIssues(this); + this.apiIssue = new operations.ApiIssue(this); + this.apiIssueComments = new operations.ApiIssueComments(this); + this.apiIssuComment = new operations.ApiIssuComment(this); + this.apiIssueComment = new operations.ApiIssueComment(this); + this.apiIssueAttachments = new operations.ApiIssueAttachments(this); + this.apiIssuAttachment = new operations.ApiIssuAttachment(this); + this.apiIssueAttachment = new operations.ApiIssueAttachment(this); this.authorizationServer = new operations.AuthorizationServer(this); this.backend = new operations.Backend(this); this.certificate = new operations.Certificate(this); diff --git a/lib/services/apimanagement/lib/models/apiCollection.js b/lib/services/apimanagement/lib/models/apiCollection.js index f1e0318825..e789516b70 100644 --- a/lib/services/apimanagement/lib/models/apiCollection.js +++ b/lib/services/apimanagement/lib/models/apiCollection.js @@ -38,6 +38,7 @@ class ApiCollection extends Array { modelProperties: { value: { required: false, + readOnly: true, serializedName: '', type: { name: 'Sequence', @@ -53,6 +54,7 @@ class ApiCollection extends Array { }, nextLink: { required: false, + readOnly: true, serializedName: 'nextLink', type: { name: 'String' diff --git a/lib/services/apimanagement/lib/models/apiReleaseCollection.js b/lib/services/apimanagement/lib/models/apiReleaseCollection.js index f77534cadd..9e6cbd257e 100644 --- a/lib/services/apimanagement/lib/models/apiReleaseCollection.js +++ b/lib/services/apimanagement/lib/models/apiReleaseCollection.js @@ -38,6 +38,7 @@ class ApiReleaseCollection extends Array { modelProperties: { value: { required: false, + readOnly: true, serializedName: '', type: { name: 'Sequence', @@ -53,6 +54,7 @@ class ApiReleaseCollection extends Array { }, nextLink: { required: false, + readOnly: true, serializedName: 'nextLink', type: { name: 'String' diff --git a/lib/services/apimanagement/lib/models/apiRevisionCollection.js b/lib/services/apimanagement/lib/models/apiRevisionCollection.js index 69e70b1378..f49de7b0c2 100644 --- a/lib/services/apimanagement/lib/models/apiRevisionCollection.js +++ b/lib/services/apimanagement/lib/models/apiRevisionCollection.js @@ -38,6 +38,7 @@ class ApiRevisionCollection extends Array { modelProperties: { value: { required: false, + readOnly: true, serializedName: '', type: { name: 'Sequence', @@ -53,6 +54,7 @@ class ApiRevisionCollection extends Array { }, nextLink: { required: false, + readOnly: true, serializedName: 'nextLink', type: { name: 'String' diff --git a/lib/services/apimanagement/lib/models/index.d.ts b/lib/services/apimanagement/lib/models/index.d.ts index 4d9a030f90..31a6ed6b68 100644 --- a/lib/services/apimanagement/lib/models/index.d.ts +++ b/lib/services/apimanagement/lib/models/index.d.ts @@ -834,6 +834,66 @@ export interface SchemaContract extends Resource { value?: string; } +/** + * @class + * Initializes a new instance of the IssueContract class. + * @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. + */ +export interface IssueContract extends Resource { + title: string; + description: string; + createdDate?: Date; + state?: string; + userId: string; + apiId?: string; +} + +/** + * @class + * Initializes a new instance of the IssueCommentContract class. + * @constructor + * Issue Comment Contract details. + * + * @member {string} text Comment text. + * @member {date} [createdDate] Date and time when the comment was created. + * @member {string} userId A resource identifier for the user who left the + * comment. + */ +export interface IssueCommentContract extends Resource { + text: string; + createdDate?: Date; + userId: string; +} + +/** + * @class + * Initializes a new instance of the IssueAttachmentContract class. + * @constructor + * Issue Attachment Contract details. + * + * @member {string} title Filename by which the binary data will be saved. + * @member {string} contentFormat Either 'link' if content is provided via an + * HTTP link or the MIME type of the Base64-encoded binary data provided in the + * 'content' property. + * @member {string} content An HTTP link or Base64-encoded binary data. + */ +export interface IssueAttachmentContract extends Resource { + title: string; + contentFormat: string; + content: string; +} + /** * @class * Initializes a new instance of the LoggerContract class. @@ -3820,7 +3880,7 @@ export interface RegionListResult extends Array { * @member {string} [nextLink] Next page link if any. */ export interface ApiCollection extends Array { - nextLink?: string; + readonly nextLink?: string; } /** @@ -3845,7 +3905,7 @@ export interface TagResourceCollection extends Array { * @member {string} [nextLink] Next page link if any. */ export interface ApiRevisionCollection extends Array { - nextLink?: string; + readonly nextLink?: string; } /** @@ -3857,7 +3917,7 @@ export interface ApiRevisionCollection extends Array { * @member {string} [nextLink] Next page link if any. */ export interface ApiReleaseCollection extends Array { - nextLink?: string; + readonly nextLink?: string; } /** @@ -3869,7 +3929,7 @@ export interface ApiReleaseCollection extends Array { * @member {string} [nextLink] Next page link if any. */ export interface OperationCollection extends Array { - nextLink?: string; + readonly nextLink?: string; } /** @@ -3893,7 +3953,7 @@ export interface ProductCollection extends Array { * @member {string} [nextLink] Next page link if any. */ export interface SchemaCollection extends Array { - nextLink?: string; + readonly nextLink?: string; } /** @@ -3921,6 +3981,42 @@ export interface LoggerCollection extends Array { nextLink?: string; } +/** + * @class + * Initializes a new instance of the IssueCollection class. + * @constructor + * Paged Issue list representation. + * + * @member {string} [nextLink] Next page link if any. + */ +export interface IssueCollection extends Array { + readonly nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the IssueCommentCollection class. + * @constructor + * Paged Issue Comment list representation. + * + * @member {string} [nextLink] Next page link if any. + */ +export interface IssueCommentCollection extends Array { + readonly nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the IssueAttachmentCollection class. + * @constructor + * Paged Issue Attachment list representation. + * + * @member {string} [nextLink] Next page link if any. + */ +export interface IssueAttachmentCollection extends Array { + readonly nextLink?: string; +} + /** * @class * Initializes a new instance of the AuthorizationServerCollection class. diff --git a/lib/services/apimanagement/lib/models/index.js b/lib/services/apimanagement/lib/models/index.js index 44f0b8313c..b9fcf111c0 100644 --- a/lib/services/apimanagement/lib/models/index.js +++ b/lib/services/apimanagement/lib/models/index.js @@ -48,6 +48,9 @@ exports.ResponseContract = require('./responseContract'); exports.OperationEntityBaseContract = require('./operationEntityBaseContract'); exports.OperationUpdateContract = require('./operationUpdateContract'); exports.SchemaContract = require('./schemaContract'); +exports.IssueContract = require('./issueContract'); +exports.IssueCommentContract = require('./issueCommentContract'); +exports.IssueAttachmentContract = require('./issueAttachmentContract'); exports.LoggerContract = require('./loggerContract'); exports.DiagnosticContract = require('./diagnosticContract'); exports.ProductEntityBaseParameters = require('./productEntityBaseParameters'); @@ -168,6 +171,9 @@ exports.ProductCollection = require('./productCollection'); exports.SchemaCollection = require('./schemaCollection'); exports.DiagnosticCollection = require('./diagnosticCollection'); exports.LoggerCollection = require('./loggerCollection'); +exports.IssueCollection = require('./issueCollection'); +exports.IssueCommentCollection = require('./issueCommentCollection'); +exports.IssueAttachmentCollection = require('./issueAttachmentCollection'); exports.AuthorizationServerCollection = require('./authorizationServerCollection'); exports.BackendCollection = require('./backendCollection'); exports.CertificateCollection = require('./certificateCollection'); diff --git a/lib/services/apimanagement/lib/models/issueAttachmentCollection.js b/lib/services/apimanagement/lib/models/issueAttachmentCollection.js new file mode 100644 index 0000000000..c8f40f0ca4 --- /dev/null +++ b/lib/services/apimanagement/lib/models/issueAttachmentCollection.js @@ -0,0 +1,69 @@ +/* + * 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'; + +/** + * Paged Issue Attachment list representation. + */ +class IssueAttachmentCollection extends Array { + /** + * Create a IssueAttachmentCollection. + * @member {string} [nextLink] Next page link if any. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of IssueAttachmentCollection + * + * @returns {object} metadata of IssueAttachmentCollection + * + */ + mapper() { + return { + required: false, + serializedName: 'IssueAttachmentCollection', + type: { + name: 'Composite', + className: 'IssueAttachmentCollection', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'IssueAttachmentContractElementType', + type: { + name: 'Composite', + className: 'IssueAttachmentContract' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = IssueAttachmentCollection; diff --git a/lib/services/apimanagement/lib/models/issueAttachmentContract.js b/lib/services/apimanagement/lib/models/issueAttachmentContract.js new file mode 100644 index 0000000000..6f40e9dac1 --- /dev/null +++ b/lib/services/apimanagement/lib/models/issueAttachmentContract.js @@ -0,0 +1,98 @@ +/* + * 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'); + +/** + * Issue Attachment Contract details. + * + * @extends models['Resource'] + */ +class IssueAttachmentContract extends models['Resource'] { + /** + * Create a IssueAttachmentContract. + * @member {string} title Filename by which the binary data will be saved. + * @member {string} contentFormat Either 'link' if content is provided via an + * HTTP link or the MIME type of the Base64-encoded binary data provided in + * the 'content' property. + * @member {string} content An HTTP link or Base64-encoded binary data. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of IssueAttachmentContract + * + * @returns {object} metadata of IssueAttachmentContract + * + */ + mapper() { + return { + required: false, + serializedName: 'IssueAttachmentContract', + type: { + name: 'Composite', + className: 'IssueAttachmentContract', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + title: { + required: true, + serializedName: 'properties.title', + type: { + name: 'String' + } + }, + contentFormat: { + required: true, + serializedName: 'properties.contentFormat', + type: { + name: 'String' + } + }, + content: { + required: true, + serializedName: 'properties.content', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = IssueAttachmentContract; diff --git a/lib/services/apimanagement/lib/models/issueCollection.js b/lib/services/apimanagement/lib/models/issueCollection.js new file mode 100644 index 0000000000..8d64da129c --- /dev/null +++ b/lib/services/apimanagement/lib/models/issueCollection.js @@ -0,0 +1,69 @@ +/* + * 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'; + +/** + * Paged Issue list representation. + */ +class IssueCollection extends Array { + /** + * Create a IssueCollection. + * @member {string} [nextLink] Next page link if any. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of IssueCollection + * + * @returns {object} metadata of IssueCollection + * + */ + mapper() { + return { + required: false, + serializedName: 'IssueCollection', + type: { + name: 'Composite', + className: 'IssueCollection', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'IssueContractElementType', + type: { + name: 'Composite', + className: 'IssueContract' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = IssueCollection; diff --git a/lib/services/apimanagement/lib/models/issueCommentCollection.js b/lib/services/apimanagement/lib/models/issueCommentCollection.js new file mode 100644 index 0000000000..1932382295 --- /dev/null +++ b/lib/services/apimanagement/lib/models/issueCommentCollection.js @@ -0,0 +1,69 @@ +/* + * 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'; + +/** + * Paged Issue Comment list representation. + */ +class IssueCommentCollection extends Array { + /** + * Create a IssueCommentCollection. + * @member {string} [nextLink] Next page link if any. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of IssueCommentCollection + * + * @returns {object} metadata of IssueCommentCollection + * + */ + mapper() { + return { + required: false, + serializedName: 'IssueCommentCollection', + type: { + name: 'Composite', + className: 'IssueCommentCollection', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'IssueCommentContractElementType', + type: { + name: 'Composite', + className: 'IssueCommentContract' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = IssueCommentCollection; diff --git a/lib/services/apimanagement/lib/models/issueCommentContract.js b/lib/services/apimanagement/lib/models/issueCommentContract.js new file mode 100644 index 0000000000..e232b81067 --- /dev/null +++ b/lib/services/apimanagement/lib/models/issueCommentContract.js @@ -0,0 +1,97 @@ +/* + * 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'); + +/** + * Issue Comment Contract details. + * + * @extends models['Resource'] + */ +class IssueCommentContract extends models['Resource'] { + /** + * Create a IssueCommentContract. + * @member {string} text Comment text. + * @member {date} [createdDate] Date and time when the comment was created. + * @member {string} userId A resource identifier for the user who left the + * comment. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of IssueCommentContract + * + * @returns {object} metadata of IssueCommentContract + * + */ + mapper() { + return { + required: false, + serializedName: 'IssueCommentContract', + type: { + name: 'Composite', + className: 'IssueCommentContract', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + text: { + required: true, + serializedName: 'properties.text', + type: { + name: 'String' + } + }, + createdDate: { + required: false, + serializedName: 'properties.createdDate', + type: { + name: 'DateTime' + } + }, + userId: { + required: true, + serializedName: 'properties.userId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = IssueCommentContract; diff --git a/lib/services/apimanagement/lib/models/issueContract.js b/lib/services/apimanagement/lib/models/issueContract.js new file mode 100644 index 0000000000..a6aed2c2c8 --- /dev/null +++ b/lib/services/apimanagement/lib/models/issueContract.js @@ -0,0 +1,123 @@ +/* + * 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'); + +/** + * Issue Contract details. + * + * @extends models['Resource'] + */ +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. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of IssueContract + * + * @returns {object} metadata of IssueContract + * + */ + mapper() { + return { + required: false, + serializedName: 'IssueContract', + type: { + name: 'Composite', + className: 'IssueContract', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + title: { + required: true, + serializedName: 'properties.title', + type: { + name: 'String' + } + }, + description: { + required: true, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + createdDate: { + required: false, + serializedName: 'properties.createdDate', + type: { + name: 'DateTime' + } + }, + state: { + required: false, + serializedName: 'properties.state', + type: { + name: 'String' + } + }, + userId: { + required: true, + serializedName: 'properties.userId', + type: { + name: 'String' + } + }, + apiId: { + required: false, + serializedName: 'properties.apiId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = IssueContract; diff --git a/lib/services/apimanagement/lib/models/operationCollection.js b/lib/services/apimanagement/lib/models/operationCollection.js index 3cebcb1817..da3db9b3ed 100644 --- a/lib/services/apimanagement/lib/models/operationCollection.js +++ b/lib/services/apimanagement/lib/models/operationCollection.js @@ -38,6 +38,7 @@ class OperationCollection extends Array { modelProperties: { value: { required: false, + readOnly: true, serializedName: '', type: { name: 'Sequence', @@ -53,6 +54,7 @@ class OperationCollection extends Array { }, nextLink: { required: false, + readOnly: true, serializedName: 'nextLink', type: { name: 'String' diff --git a/lib/services/apimanagement/lib/models/schemaCollection.js b/lib/services/apimanagement/lib/models/schemaCollection.js index b7252838a7..38fc819938 100644 --- a/lib/services/apimanagement/lib/models/schemaCollection.js +++ b/lib/services/apimanagement/lib/models/schemaCollection.js @@ -38,6 +38,7 @@ class SchemaCollection extends Array { modelProperties: { value: { required: false, + readOnly: true, serializedName: '', type: { name: 'Sequence', @@ -53,6 +54,7 @@ class SchemaCollection extends Array { }, nextLink: { required: false, + readOnly: true, serializedName: 'nextLink', type: { name: 'String' diff --git a/lib/services/apimanagement/lib/operations/apiIssuAttachment.js b/lib/services/apimanagement/lib/operations/apiIssuAttachment.js new file mode 100644 index 0000000000..799d4829c0 --- /dev/null +++ b/lib/services/apimanagement/lib/operations/apiIssuAttachment.js @@ -0,0 +1,341 @@ +/* + * 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; + +/** + * Gets the entity state (Etag) version of the issue Attachment for an API + * specified by its identifier. + * + * @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 {string} attachmentId Attachment identifier within an Issue. Must be + * unique in the current Issue. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _head(resourceGroupName, serviceName, apiId, issueId, attachmentId, 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.'); + } + // 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 (attachmentId === null || attachmentId === undefined || typeof attachmentId.valueOf() !== 'string') { + throw new Error('attachmentId cannot be null or undefined and it must be of type string.'); + } + if (attachmentId !== null && attachmentId !== undefined) { + if (attachmentId.length > 256) + { + throw new Error('"attachmentId" should satisfy the constraint - "MaxLength": 256'); + } + if (attachmentId.length < 1) + { + throw new Error('"attachmentId" should satisfy the constraint - "MinLength": 1'); + } + if (attachmentId.match(/^[^*#&+:<>?]+$/) === null) + { + throw new Error('"attachmentId" should satisfy the constraint - "Pattern": /^[^*#&+:<>?]+$/'); + } + } + 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}/attachments/{attachmentId}'; + 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('{attachmentId}', encodeURIComponent(attachmentId)); + 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 = 'HEAD'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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); + }); +} + +/** Class representing a ApiIssuAttachment. */ +class ApiIssuAttachment { + /** + * Create a ApiIssuAttachment. + * @param {ApiManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._head = _head; + } + + /** + * Gets the entity state (Etag) version of the issue Attachment for an API + * specified by its identifier. + * + * @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 {string} attachmentId Attachment identifier within an Issue. Must be + * unique in the current Issue. + * + * @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. + */ + headWithHttpOperationResponse(resourceGroupName, serviceName, apiId, issueId, attachmentId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._head(resourceGroupName, serviceName, apiId, issueId, attachmentId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the entity state (Etag) version of the issue Attachment for an API + * specified by its identifier. + * + * @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 {string} attachmentId Attachment identifier within an Issue. Must be + * unique in the current Issue. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + head(resourceGroupName, serviceName, apiId, issueId, attachmentId, 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._head(resourceGroupName, serviceName, apiId, issueId, attachmentId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._head(resourceGroupName, serviceName, apiId, issueId, attachmentId, options, optionalCallback); + } + } + +} + +module.exports = ApiIssuAttachment; diff --git a/lib/services/apimanagement/lib/operations/apiIssuComment.js b/lib/services/apimanagement/lib/operations/apiIssuComment.js new file mode 100644 index 0000000000..8d023ca3bd --- /dev/null +++ b/lib/services/apimanagement/lib/operations/apiIssuComment.js @@ -0,0 +1,341 @@ +/* + * 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; + +/** + * Gets the entity state (Etag) version of the issue Comment for an API + * specified by its identifier. + * + * @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 {string} commentId Comment identifier within an Issue. Must be unique + * in the current Issue. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _head(resourceGroupName, serviceName, apiId, issueId, commentId, 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.'); + } + // 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 (commentId === null || commentId === undefined || typeof commentId.valueOf() !== 'string') { + throw new Error('commentId cannot be null or undefined and it must be of type string.'); + } + if (commentId !== null && commentId !== undefined) { + if (commentId.length > 256) + { + throw new Error('"commentId" should satisfy the constraint - "MaxLength": 256'); + } + if (commentId.length < 1) + { + throw new Error('"commentId" should satisfy the constraint - "MinLength": 1'); + } + if (commentId.match(/^[^*#&+:<>?]+$/) === null) + { + throw new Error('"commentId" should satisfy the constraint - "Pattern": /^[^*#&+:<>?]+$/'); + } + } + 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}/comments/{commentId}'; + 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('{commentId}', encodeURIComponent(commentId)); + 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 = 'HEAD'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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); + }); +} + +/** Class representing a ApiIssuComment. */ +class ApiIssuComment { + /** + * Create a ApiIssuComment. + * @param {ApiManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._head = _head; + } + + /** + * Gets the entity state (Etag) version of the issue Comment for an API + * specified by its identifier. + * + * @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 {string} commentId Comment identifier within an Issue. Must be unique + * in the current Issue. + * + * @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. + */ + headWithHttpOperationResponse(resourceGroupName, serviceName, apiId, issueId, commentId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._head(resourceGroupName, serviceName, apiId, issueId, commentId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the entity state (Etag) version of the issue Comment for an API + * specified by its identifier. + * + * @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 {string} commentId Comment identifier within an Issue. Must be unique + * in the current Issue. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + head(resourceGroupName, serviceName, apiId, issueId, commentId, 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._head(resourceGroupName, serviceName, apiId, issueId, commentId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._head(resourceGroupName, serviceName, apiId, issueId, commentId, options, optionalCallback); + } + } + +} + +module.exports = ApiIssuComment; diff --git a/lib/services/apimanagement/lib/operations/apiIssue.js b/lib/services/apimanagement/lib/operations/apiIssue.js new file mode 100644 index 0000000000..4ac8c1d9b3 --- /dev/null +++ b/lib/services/apimanagement/lib/operations/apiIssue.js @@ -0,0 +1,1323 @@ +/* + * 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; + +/** + * Gets the entity state (Etag) version of the Issue for an API specified by + * its identifier. + * + * @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} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _head(resourceGroupName, serviceName, apiId, issueId, 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.'); + } + // 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 (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 = 'HEAD'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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); + }); +} + +/** + * Gets the details of the Issue for an API specified by its identifier. + * + * @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} [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 IssueContract} 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 _get(resourceGroupName, serviceName, apiId, issueId, 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.'); + } + // 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 (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 = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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['IssueContract']().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); + }); +} + +/** + * Creates a new Issue for an API or updates an existing one. + * + * @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 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 {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. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IssueContract} 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 _createOrUpdate(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 = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (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['IssueContract']().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 !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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['IssueContract']().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); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['IssueContract']().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); + }); +} + +/** + * Deletes the specified Issue from 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 {string} 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] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, serviceName, apiId, issueId, ifMatch, 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.'); + } + // 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 (ifMatch === null || ifMatch === undefined || typeof ifMatch.valueOf() !== 'string') { + throw new Error('ifMatch cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.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 = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (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]; + } + } + } + httpRequest.body = null; + // 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); + }); +} + +/** Class representing a ApiIssue. */ +class ApiIssue { + /** + * Create a ApiIssue. + * @param {ApiManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._head = _head; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + } + + /** + * Gets the entity state (Etag) version of the Issue for an API specified by + * its identifier. + * + * @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} [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. + */ + headWithHttpOperationResponse(resourceGroupName, serviceName, apiId, issueId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._head(resourceGroupName, serviceName, apiId, issueId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the entity state (Etag) version of the Issue for an API specified by + * its identifier. + * + * @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} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + head(resourceGroupName, serviceName, apiId, issueId, 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._head(resourceGroupName, serviceName, apiId, issueId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._head(resourceGroupName, serviceName, apiId, issueId, options, optionalCallback); + } + } + + /** + * Gets the details of the Issue for an API specified by its identifier. + * + * @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} [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. + */ + getWithHttpOperationResponse(resourceGroupName, serviceName, apiId, issueId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, serviceName, apiId, issueId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the details of the Issue for an API specified by its identifier. + * + * @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} [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 {IssueContract} - 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 IssueContract} 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. + */ + get(resourceGroupName, serviceName, apiId, issueId, 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._get(resourceGroupName, serviceName, apiId, issueId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, serviceName, apiId, issueId, options, optionalCallback); + } + } + + /** + * Creates a new Issue for an API or updates an existing one. + * + * @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 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 {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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, serviceName, apiId, issueId, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(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; + }); + }); + } + + /** + * Creates a new Issue for an API or updates an existing one. + * + * @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 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 {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 {IssueContract} - 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 IssueContract} 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. + */ + createOrUpdate(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._createOrUpdate(resourceGroupName, serviceName, apiId, issueId, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, serviceName, apiId, issueId, parameters, options, optionalCallback); + } + } + + /** + * Deletes the specified Issue from 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 {string} 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] 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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, serviceName, apiId, issueId, ifMatch, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, serviceName, apiId, issueId, ifMatch, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified Issue from 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 {string} 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] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, serviceName, apiId, issueId, ifMatch, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, serviceName, apiId, issueId, ifMatch, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, serviceName, apiId, issueId, ifMatch, options, optionalCallback); + } + } + +} + +module.exports = ApiIssue; diff --git a/lib/services/apimanagement/lib/operations/apiIssueAttachment.js b/lib/services/apimanagement/lib/operations/apiIssueAttachment.js new file mode 100644 index 0000000000..7f5c6560de --- /dev/null +++ b/lib/services/apimanagement/lib/operations/apiIssueAttachment.js @@ -0,0 +1,1108 @@ +/* + * 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; + +/** + * Gets the details of the issue Attachment for an API specified by its + * identifier. + * + * @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 {string} attachmentId Attachment identifier within an Issue. Must be + * unique in the current Issue. + * + * @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 IssueAttachmentContract} 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 _get(resourceGroupName, serviceName, apiId, issueId, attachmentId, 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.'); + } + // 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 (attachmentId === null || attachmentId === undefined || typeof attachmentId.valueOf() !== 'string') { + throw new Error('attachmentId cannot be null or undefined and it must be of type string.'); + } + if (attachmentId !== null && attachmentId !== undefined) { + if (attachmentId.length > 256) + { + throw new Error('"attachmentId" should satisfy the constraint - "MaxLength": 256'); + } + if (attachmentId.length < 1) + { + throw new Error('"attachmentId" should satisfy the constraint - "MinLength": 1'); + } + if (attachmentId.match(/^[^*#&+:<>?]+$/) === null) + { + throw new Error('"attachmentId" should satisfy the constraint - "Pattern": /^[^*#&+:<>?]+$/'); + } + } + 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}/attachments/{attachmentId}'; + 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('{attachmentId}', encodeURIComponent(attachmentId)); + 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 = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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['IssueAttachmentContract']().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); + }); +} + +/** + * Creates a new Attachment for the Issue in an API or updates an existing one. + * + * @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 {string} attachmentId Attachment identifier within an Issue. Must be + * unique in the current Issue. + * + * @param {object} parameters Create parameters. + * + * @param {string} parameters.title Filename by which the binary data will be + * saved. + * + * @param {string} parameters.contentFormat Either 'link' if content is + * provided via an HTTP link or the MIME type of the Base64-encoded binary data + * provided in the 'content' property. + * + * @param {string} parameters.content An HTTP link or Base64-encoded binary + * data. + * + * @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. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IssueAttachmentContract} 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 _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, attachmentId, 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 (attachmentId === null || attachmentId === undefined || typeof attachmentId.valueOf() !== 'string') { + throw new Error('attachmentId cannot be null or undefined and it must be of type string.'); + } + if (attachmentId !== null && attachmentId !== undefined) { + if (attachmentId.length > 256) + { + throw new Error('"attachmentId" should satisfy the constraint - "MaxLength": 256'); + } + if (attachmentId.length < 1) + { + throw new Error('"attachmentId" should satisfy the constraint - "MinLength": 1'); + } + if (attachmentId.match(/^[^*#&+:<>?]+$/) === null) + { + throw new Error('"attachmentId" 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}/attachments/{attachmentId}'; + 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('{attachmentId}', encodeURIComponent(attachmentId)); + 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 = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (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['IssueAttachmentContract']().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 !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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['IssueAttachmentContract']().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); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['IssueAttachmentContract']().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); + }); +} + +/** + * Deletes the specified comment from an Issue. + * + * @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 {string} attachmentId Attachment identifier within an Issue. Must be + * unique in the current Issue. + * + * @param {string} 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] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, serviceName, apiId, issueId, attachmentId, ifMatch, 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.'); + } + // 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 (attachmentId === null || attachmentId === undefined || typeof attachmentId.valueOf() !== 'string') { + throw new Error('attachmentId cannot be null or undefined and it must be of type string.'); + } + if (attachmentId !== null && attachmentId !== undefined) { + if (attachmentId.length > 256) + { + throw new Error('"attachmentId" should satisfy the constraint - "MaxLength": 256'); + } + if (attachmentId.length < 1) + { + throw new Error('"attachmentId" should satisfy the constraint - "MinLength": 1'); + } + if (attachmentId.match(/^[^*#&+:<>?]+$/) === null) + { + throw new Error('"attachmentId" should satisfy the constraint - "Pattern": /^[^*#&+:<>?]+$/'); + } + } + if (ifMatch === null || ifMatch === undefined || typeof ifMatch.valueOf() !== 'string') { + throw new Error('ifMatch cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.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}/attachments/{attachmentId}'; + 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('{attachmentId}', encodeURIComponent(attachmentId)); + 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 = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (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]; + } + } + } + httpRequest.body = null; + // 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); + }); +} + +/** Class representing a ApiIssueAttachment. */ +class ApiIssueAttachment { + /** + * Create a ApiIssueAttachment. + * @param {ApiManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + } + + /** + * Gets the details of the issue Attachment for an API specified by its + * identifier. + * + * @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 {string} attachmentId Attachment identifier within an Issue. Must be + * unique in the current Issue. + * + * @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. + */ + getWithHttpOperationResponse(resourceGroupName, serviceName, apiId, issueId, attachmentId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, serviceName, apiId, issueId, attachmentId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the details of the issue Attachment for an API specified by its + * identifier. + * + * @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 {string} attachmentId Attachment identifier within an Issue. Must be + * unique in the current Issue. + * + * @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 {IssueAttachmentContract} - 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 IssueAttachmentContract} 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. + */ + get(resourceGroupName, serviceName, apiId, issueId, attachmentId, 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._get(resourceGroupName, serviceName, apiId, issueId, attachmentId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, serviceName, apiId, issueId, attachmentId, options, optionalCallback); + } + } + + /** + * Creates a new Attachment for the Issue in an API or updates an existing one. + * + * @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 {string} attachmentId Attachment identifier within an Issue. Must be + * unique in the current Issue. + * + * @param {object} parameters Create parameters. + * + * @param {string} parameters.title Filename by which the binary data will be + * saved. + * + * @param {string} parameters.contentFormat Either 'link' if content is + * provided via an HTTP link or the MIME type of the Base64-encoded binary data + * provided in the 'content' property. + * + * @param {string} parameters.content An HTTP link or Base64-encoded binary + * data. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, serviceName, apiId, issueId, attachmentId, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, serviceName, apiId, issueId, attachmentId, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a new Attachment for the Issue in an API or updates an existing one. + * + * @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 {string} attachmentId Attachment identifier within an Issue. Must be + * unique in the current Issue. + * + * @param {object} parameters Create parameters. + * + * @param {string} parameters.title Filename by which the binary data will be + * saved. + * + * @param {string} parameters.contentFormat Either 'link' if content is + * provided via an HTTP link or the MIME type of the Base64-encoded binary data + * provided in the 'content' property. + * + * @param {string} parameters.content An HTTP link or Base64-encoded binary + * data. + * + * @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 {IssueAttachmentContract} - 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 IssueAttachmentContract} 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. + */ + createOrUpdate(resourceGroupName, serviceName, apiId, issueId, attachmentId, 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._createOrUpdate(resourceGroupName, serviceName, apiId, issueId, attachmentId, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, serviceName, apiId, issueId, attachmentId, parameters, options, optionalCallback); + } + } + + /** + * Deletes the specified comment from an Issue. + * + * @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 {string} attachmentId Attachment identifier within an Issue. Must be + * unique in the current Issue. + * + * @param {string} 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] 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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, serviceName, apiId, issueId, attachmentId, ifMatch, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, serviceName, apiId, issueId, attachmentId, ifMatch, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified comment from an Issue. + * + * @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 {string} attachmentId Attachment identifier within an Issue. Must be + * unique in the current Issue. + * + * @param {string} 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] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, serviceName, apiId, issueId, attachmentId, ifMatch, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, serviceName, apiId, issueId, attachmentId, ifMatch, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, serviceName, apiId, issueId, attachmentId, ifMatch, options, optionalCallback); + } + } + +} + +module.exports = ApiIssueAttachment; diff --git a/lib/services/apimanagement/lib/operations/apiIssueAttachments.js b/lib/services/apimanagement/lib/operations/apiIssueAttachments.js new file mode 100644 index 0000000000..6044fa5364 --- /dev/null +++ b/lib/services/apimanagement/lib/operations/apiIssueAttachments.js @@ -0,0 +1,613 @@ +/* + * 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; + +/** + * Lists all comments for the Issue assosiated with the specified 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} [options] Optional Parameters. + * + * @param {string} [options.filter] | Field | Supported operators | + * Supported functions | + * |-------------|------------------------|-----------------------------------| + * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | + * | userId | ge, le, eq, ne, gt, lt | substringof, startswith, + * endswith | + * + * @param {number} [options.top] Number of records to return. + * + * @param {number} [options.skip] Number of records to skip. + * + * @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 IssueAttachmentCollection} 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 _listByService(resourceGroupName, serviceName, apiId, issueId, 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 filter = (options && options.filter !== undefined) ? options.filter : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let skip = (options && options.skip !== undefined) ? options.skip : 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 (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 (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 (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 (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + if (top !== null && top !== undefined) { + if (top < 1) + { + throw new Error('"top" should satisfy the constraint - "InclusiveMinimum": 1'); + } + } + if (skip !== null && skip !== undefined && typeof skip !== 'number') { + throw new Error('skip must be of type number.'); + } + if (skip !== null && skip !== undefined) { + if (skip < 0) + { + throw new Error('"skip" should satisfy the constraint - "InclusiveMinimum": 0'); + } + } + 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}/attachments'; + 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 (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + if (skip !== null && skip !== undefined) { + queryParameters.push('$skip=' + encodeURIComponent(skip.toString())); + } + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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['IssueAttachmentCollection']().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); + }); +} + +/** + * Lists all comments for the Issue assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 IssueAttachmentCollection} 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 _listByServiceNext(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.'); + } + // 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 (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 = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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['IssueAttachmentCollection']().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 ApiIssueAttachments. */ +class ApiIssueAttachments { + /** + * Create a ApiIssueAttachments. + * @param {ApiManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listByService = _listByService; + this._listByServiceNext = _listByServiceNext; + } + + /** + * Lists all comments for the Issue assosiated with the specified 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} [options] Optional Parameters. + * + * @param {string} [options.filter] | Field | Supported operators | + * Supported functions | + * |-------------|------------------------|-----------------------------------| + * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | + * | userId | ge, le, eq, ne, gt, lt | substringof, startswith, + * endswith | + * + * @param {number} [options.top] Number of records to return. + * + * @param {number} [options.skip] Number of records to skip. + * + * @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. + */ + listByServiceWithHttpOperationResponse(resourceGroupName, serviceName, apiId, issueId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByService(resourceGroupName, serviceName, apiId, issueId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all comments for the Issue assosiated with the specified 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} [options] Optional Parameters. + * + * @param {string} [options.filter] | Field | Supported operators | + * Supported functions | + * |-------------|------------------------|-----------------------------------| + * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | + * | userId | ge, le, eq, ne, gt, lt | substringof, startswith, + * endswith | + * + * @param {number} [options.top] Number of records to return. + * + * @param {number} [options.skip] Number of records to skip. + * + * @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 {IssueAttachmentCollection} - 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 IssueAttachmentCollection} 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. + */ + listByService(resourceGroupName, serviceName, apiId, issueId, 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._listByService(resourceGroupName, serviceName, apiId, issueId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByService(resourceGroupName, serviceName, apiId, issueId, options, optionalCallback); + } + } + + /** + * Lists all comments for the Issue assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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. + */ + listByServiceNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByServiceNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all comments for the Issue assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 {IssueAttachmentCollection} - 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 IssueAttachmentCollection} 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. + */ + listByServiceNext(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._listByServiceNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByServiceNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = ApiIssueAttachments; diff --git a/lib/services/apimanagement/lib/operations/apiIssueComment.js b/lib/services/apimanagement/lib/operations/apiIssueComment.js new file mode 100644 index 0000000000..f6de9c5b41 --- /dev/null +++ b/lib/services/apimanagement/lib/operations/apiIssueComment.js @@ -0,0 +1,1098 @@ +/* + * 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; + +/** + * Gets the details of the issue Comment for an API specified by its + * identifier. + * + * @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 {string} commentId Comment identifier within an Issue. Must be unique + * in the current Issue. + * + * @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 IssueCommentContract} 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 _get(resourceGroupName, serviceName, apiId, issueId, commentId, 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.'); + } + // 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 (commentId === null || commentId === undefined || typeof commentId.valueOf() !== 'string') { + throw new Error('commentId cannot be null or undefined and it must be of type string.'); + } + if (commentId !== null && commentId !== undefined) { + if (commentId.length > 256) + { + throw new Error('"commentId" should satisfy the constraint - "MaxLength": 256'); + } + if (commentId.length < 1) + { + throw new Error('"commentId" should satisfy the constraint - "MinLength": 1'); + } + if (commentId.match(/^[^*#&+:<>?]+$/) === null) + { + throw new Error('"commentId" should satisfy the constraint - "Pattern": /^[^*#&+:<>?]+$/'); + } + } + 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}/comments/{commentId}'; + 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('{commentId}', encodeURIComponent(commentId)); + 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 = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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['IssueCommentContract']().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); + }); +} + +/** + * Creates a new Comment for the Issue in an API or updates an existing one. + * + * @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 {string} commentId Comment identifier within an Issue. Must be unique + * in the current Issue. + * + * @param {object} parameters Create parameters. + * + * @param {string} parameters.text Comment text. + * + * @param {date} [parameters.createdDate] Date and time when the comment was + * created. + * + * @param {string} parameters.userId A resource identifier for the user who + * left the comment. + * + * @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. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IssueCommentContract} 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 _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, commentId, 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 (commentId === null || commentId === undefined || typeof commentId.valueOf() !== 'string') { + throw new Error('commentId cannot be null or undefined and it must be of type string.'); + } + if (commentId !== null && commentId !== undefined) { + if (commentId.length > 256) + { + throw new Error('"commentId" should satisfy the constraint - "MaxLength": 256'); + } + if (commentId.length < 1) + { + throw new Error('"commentId" should satisfy the constraint - "MinLength": 1'); + } + if (commentId.match(/^[^*#&+:<>?]+$/) === null) + { + throw new Error('"commentId" 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}/comments/{commentId}'; + 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('{commentId}', encodeURIComponent(commentId)); + 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 = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (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['IssueCommentContract']().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 !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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['IssueCommentContract']().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); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['IssueCommentContract']().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); + }); +} + +/** + * Deletes the specified comment from an Issue. + * + * @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 {string} commentId Comment identifier within an Issue. Must be unique + * in the current Issue. + * + * @param {string} 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] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, serviceName, apiId, issueId, commentId, ifMatch, 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.'); + } + // 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 (commentId === null || commentId === undefined || typeof commentId.valueOf() !== 'string') { + throw new Error('commentId cannot be null or undefined and it must be of type string.'); + } + if (commentId !== null && commentId !== undefined) { + if (commentId.length > 256) + { + throw new Error('"commentId" should satisfy the constraint - "MaxLength": 256'); + } + if (commentId.length < 1) + { + throw new Error('"commentId" should satisfy the constraint - "MinLength": 1'); + } + if (commentId.match(/^[^*#&+:<>?]+$/) === null) + { + throw new Error('"commentId" should satisfy the constraint - "Pattern": /^[^*#&+:<>?]+$/'); + } + } + if (ifMatch === null || ifMatch === undefined || typeof ifMatch.valueOf() !== 'string') { + throw new Error('ifMatch cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.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}/comments/{commentId}'; + 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('{commentId}', encodeURIComponent(commentId)); + 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 = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (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]; + } + } + } + httpRequest.body = null; + // 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); + }); +} + +/** Class representing a ApiIssueComment. */ +class ApiIssueComment { + /** + * Create a ApiIssueComment. + * @param {ApiManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + } + + /** + * Gets the details of the issue Comment for an API specified by its + * identifier. + * + * @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 {string} commentId Comment identifier within an Issue. Must be unique + * in the current Issue. + * + * @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. + */ + getWithHttpOperationResponse(resourceGroupName, serviceName, apiId, issueId, commentId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, serviceName, apiId, issueId, commentId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the details of the issue Comment for an API specified by its + * identifier. + * + * @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 {string} commentId Comment identifier within an Issue. Must be unique + * in the current Issue. + * + * @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 {IssueCommentContract} - 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 IssueCommentContract} 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. + */ + get(resourceGroupName, serviceName, apiId, issueId, commentId, 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._get(resourceGroupName, serviceName, apiId, issueId, commentId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, serviceName, apiId, issueId, commentId, options, optionalCallback); + } + } + + /** + * Creates a new Comment for the Issue in an API or updates an existing one. + * + * @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 {string} commentId Comment identifier within an Issue. Must be unique + * in the current Issue. + * + * @param {object} parameters Create parameters. + * + * @param {string} parameters.text Comment text. + * + * @param {date} [parameters.createdDate] Date and time when the comment was + * created. + * + * @param {string} parameters.userId A resource identifier for the user who + * left the comment. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, serviceName, apiId, issueId, commentId, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, serviceName, apiId, issueId, commentId, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a new Comment for the Issue in an API or updates an existing one. + * + * @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 {string} commentId Comment identifier within an Issue. Must be unique + * in the current Issue. + * + * @param {object} parameters Create parameters. + * + * @param {string} parameters.text Comment text. + * + * @param {date} [parameters.createdDate] Date and time when the comment was + * created. + * + * @param {string} parameters.userId A resource identifier for the user who + * left the comment. + * + * @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 {IssueCommentContract} - 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 IssueCommentContract} 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. + */ + createOrUpdate(resourceGroupName, serviceName, apiId, issueId, commentId, 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._createOrUpdate(resourceGroupName, serviceName, apiId, issueId, commentId, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, serviceName, apiId, issueId, commentId, parameters, options, optionalCallback); + } + } + + /** + * Deletes the specified comment from an Issue. + * + * @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 {string} commentId Comment identifier within an Issue. Must be unique + * in the current Issue. + * + * @param {string} 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] 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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, serviceName, apiId, issueId, commentId, ifMatch, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, serviceName, apiId, issueId, commentId, ifMatch, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified comment from an Issue. + * + * @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 {string} commentId Comment identifier within an Issue. Must be unique + * in the current Issue. + * + * @param {string} 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] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, serviceName, apiId, issueId, commentId, ifMatch, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, serviceName, apiId, issueId, commentId, ifMatch, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, serviceName, apiId, issueId, commentId, ifMatch, options, optionalCallback); + } + } + +} + +module.exports = ApiIssueComment; diff --git a/lib/services/apimanagement/lib/operations/apiIssueComments.js b/lib/services/apimanagement/lib/operations/apiIssueComments.js new file mode 100644 index 0000000000..ff58ba92c8 --- /dev/null +++ b/lib/services/apimanagement/lib/operations/apiIssueComments.js @@ -0,0 +1,613 @@ +/* + * 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; + +/** + * Lists all comments for the Issue assosiated with the specified 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} [options] Optional Parameters. + * + * @param {string} [options.filter] | Field | Supported operators | + * Supported functions | + * |-------------|------------------------|-----------------------------------| + * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | + * | userId | ge, le, eq, ne, gt, lt | substringof, startswith, + * endswith | + * + * @param {number} [options.top] Number of records to return. + * + * @param {number} [options.skip] Number of records to skip. + * + * @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 IssueCommentCollection} 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 _listByService(resourceGroupName, serviceName, apiId, issueId, 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 filter = (options && options.filter !== undefined) ? options.filter : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let skip = (options && options.skip !== undefined) ? options.skip : 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 (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 (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 (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 (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + if (top !== null && top !== undefined) { + if (top < 1) + { + throw new Error('"top" should satisfy the constraint - "InclusiveMinimum": 1'); + } + } + if (skip !== null && skip !== undefined && typeof skip !== 'number') { + throw new Error('skip must be of type number.'); + } + if (skip !== null && skip !== undefined) { + if (skip < 0) + { + throw new Error('"skip" should satisfy the constraint - "InclusiveMinimum": 0'); + } + } + 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}/comments'; + 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 (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + if (skip !== null && skip !== undefined) { + queryParameters.push('$skip=' + encodeURIComponent(skip.toString())); + } + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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['IssueCommentCollection']().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); + }); +} + +/** + * Lists all comments for the Issue assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 IssueCommentCollection} 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 _listByServiceNext(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.'); + } + // 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 (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 = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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['IssueCommentCollection']().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 ApiIssueComments. */ +class ApiIssueComments { + /** + * Create a ApiIssueComments. + * @param {ApiManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listByService = _listByService; + this._listByServiceNext = _listByServiceNext; + } + + /** + * Lists all comments for the Issue assosiated with the specified 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} [options] Optional Parameters. + * + * @param {string} [options.filter] | Field | Supported operators | + * Supported functions | + * |-------------|------------------------|-----------------------------------| + * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | + * | userId | ge, le, eq, ne, gt, lt | substringof, startswith, + * endswith | + * + * @param {number} [options.top] Number of records to return. + * + * @param {number} [options.skip] Number of records to skip. + * + * @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. + */ + listByServiceWithHttpOperationResponse(resourceGroupName, serviceName, apiId, issueId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByService(resourceGroupName, serviceName, apiId, issueId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all comments for the Issue assosiated with the specified 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} [options] Optional Parameters. + * + * @param {string} [options.filter] | Field | Supported operators | + * Supported functions | + * |-------------|------------------------|-----------------------------------| + * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | + * | userId | ge, le, eq, ne, gt, lt | substringof, startswith, + * endswith | + * + * @param {number} [options.top] Number of records to return. + * + * @param {number} [options.skip] Number of records to skip. + * + * @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 {IssueCommentCollection} - 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 IssueCommentCollection} 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. + */ + listByService(resourceGroupName, serviceName, apiId, issueId, 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._listByService(resourceGroupName, serviceName, apiId, issueId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByService(resourceGroupName, serviceName, apiId, issueId, options, optionalCallback); + } + } + + /** + * Lists all comments for the Issue assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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. + */ + listByServiceNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByServiceNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all comments for the Issue assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 {IssueCommentCollection} - 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 IssueCommentCollection} 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. + */ + listByServiceNext(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._listByServiceNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByServiceNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = ApiIssueComments; diff --git a/lib/services/apimanagement/lib/operations/apiIssues.js b/lib/services/apimanagement/lib/operations/apiIssues.js new file mode 100644 index 0000000000..3a575cfd2a --- /dev/null +++ b/lib/services/apimanagement/lib/operations/apiIssues.js @@ -0,0 +1,588 @@ +/* + * 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; + +/** + * Lists all issues assosiated with the specified 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 {object} [options] Optional Parameters. + * + * @param {string} [options.filter] | Field | Supported operators | + * Supported functions | + * |-------------|------------------------|-----------------------------------| + * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | + * | state | eq | + * | + * | userId | ge, le, eq, ne, gt, lt | substringof, startswith, + * endswith | + * + * @param {number} [options.top] Number of records to return. + * + * @param {number} [options.skip] Number of records to skip. + * + * @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 IssueCollection} 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 _listByService(resourceGroupName, serviceName, apiId, 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 filter = (options && options.filter !== undefined) ? options.filter : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let skip = (options && options.skip !== undefined) ? options.skip : 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 (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 (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + if (top !== null && top !== undefined) { + if (top < 1) + { + throw new Error('"top" should satisfy the constraint - "InclusiveMinimum": 1'); + } + } + if (skip !== null && skip !== undefined && typeof skip !== 'number') { + throw new Error('skip must be of type number.'); + } + if (skip !== null && skip !== undefined) { + if (skip < 0) + { + throw new Error('"skip" should satisfy the constraint - "InclusiveMinimum": 0'); + } + } + 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'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serviceName}', encodeURIComponent(serviceName)); + requestUrl = requestUrl.replace('{apiId}', encodeURIComponent(apiId)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + if (skip !== null && skip !== undefined) { + queryParameters.push('$skip=' + encodeURIComponent(skip.toString())); + } + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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['IssueCollection']().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); + }); +} + +/** + * Lists all issues assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 IssueCollection} 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 _listByServiceNext(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.'); + } + // 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 (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 = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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['IssueCollection']().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 ApiIssues. */ +class ApiIssues { + /** + * Create a ApiIssues. + * @param {ApiManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listByService = _listByService; + this._listByServiceNext = _listByServiceNext; + } + + /** + * Lists all issues assosiated with the specified 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 {object} [options] Optional Parameters. + * + * @param {string} [options.filter] | Field | Supported operators | + * Supported functions | + * |-------------|------------------------|-----------------------------------| + * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | + * | state | eq | + * | + * | userId | ge, le, eq, ne, gt, lt | substringof, startswith, + * endswith | + * + * @param {number} [options.top] Number of records to return. + * + * @param {number} [options.skip] Number of records to skip. + * + * @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. + */ + listByServiceWithHttpOperationResponse(resourceGroupName, serviceName, apiId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByService(resourceGroupName, serviceName, apiId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all issues assosiated with the specified 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 {object} [options] Optional Parameters. + * + * @param {string} [options.filter] | Field | Supported operators | + * Supported functions | + * |-------------|------------------------|-----------------------------------| + * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | + * | state | eq | + * | + * | userId | ge, le, eq, ne, gt, lt | substringof, startswith, + * endswith | + * + * @param {number} [options.top] Number of records to return. + * + * @param {number} [options.skip] Number of records to skip. + * + * @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 {IssueCollection} - 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 IssueCollection} 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. + */ + listByService(resourceGroupName, serviceName, apiId, 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._listByService(resourceGroupName, serviceName, apiId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByService(resourceGroupName, serviceName, apiId, options, optionalCallback); + } + } + + /** + * Lists all issues assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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. + */ + listByServiceNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByServiceNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all issues assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 {IssueCollection} - 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 IssueCollection} 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. + */ + listByServiceNext(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._listByServiceNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByServiceNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = ApiIssues; diff --git a/lib/services/apimanagement/lib/operations/index.d.ts b/lib/services/apimanagement/lib/operations/index.d.ts index 0b13b0b4ed..7f11d49aae 100644 --- a/lib/services/apimanagement/lib/operations/index.d.ts +++ b/lib/services/apimanagement/lib/operations/index.d.ts @@ -5240,6 +5240,1564 @@ export interface ApiDiagnosticLogger { listByServiceNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } +/** + * @class + * ApiIssues + * __NOTE__: An instance of this class is automatically created for an + * instance of the ApiManagementClient. + */ +export interface ApiIssues { + + + /** + * Lists all issues assosiated with the specified 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 {object} [options] Optional Parameters. + * + * @param {string} [options.filter] | Field | Supported operators | + * Supported functions | + * |-------------|------------------------|-----------------------------------| + * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | + * | state | eq | + * | + * | userId | ge, le, eq, ne, gt, lt | substringof, startswith, + * endswith | + * + * @param {number} [options.top] Number of records to return. + * + * @param {number} [options.skip] Number of records to skip. + * + * @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. + */ + listByServiceWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, options?: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all issues assosiated with the specified 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 {object} [options] Optional Parameters. + * + * @param {string} [options.filter] | Field | Supported operators | + * Supported functions | + * |-------------|------------------------|-----------------------------------| + * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | + * | state | eq | + * | + * | userId | ge, le, eq, ne, gt, lt | substringof, startswith, + * endswith | + * + * @param {number} [options.top] Number of records to return. + * + * @param {number} [options.skip] Number of records to skip. + * + * @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 {IssueCollection} - 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. + * + * {IssueCollection} [result] - The deserialized result object if an error did not occur. + * See {@link IssueCollection} 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. + */ + listByService(resourceGroupName: string, serviceName: string, apiId: string, options?: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }): Promise; + listByService(resourceGroupName: string, serviceName: string, apiId: string, callback: ServiceCallback): void; + listByService(resourceGroupName: string, serviceName: string, apiId: string, options: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all issues assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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. + */ + listByServiceNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all issues assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 {IssueCollection} - 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. + * + * {IssueCollection} [result] - The deserialized result object if an error did not occur. + * See {@link IssueCollection} 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. + */ + listByServiceNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServiceNext(nextPageLink: string, callback: ServiceCallback): void; + listByServiceNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ApiIssue + * __NOTE__: An instance of this class is automatically created for an + * instance of the ApiManagementClient. + */ +export interface ApiIssue { + + + /** + * Gets the entity state (Etag) version of the Issue for an API specified by + * its identifier. + * + * @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} [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. + */ + headWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the entity state (Etag) version of the Issue for an API specified by + * its identifier. + * + * @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} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + head(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + head(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, callback: ServiceCallback): void; + head(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the details of the Issue for an API specified by its identifier. + * + * @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} [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. + */ + getWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the details of the Issue for an API specified by its identifier. + * + * @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} [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 {IssueContract} - 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. + * + * {IssueContract} [result] - The deserialized result object if an error did not occur. + * See {@link IssueContract} 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. + */ + get(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a new Issue for an API or updates an existing one. + * + * @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 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 {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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, parameters: models.IssueContract, options?: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a new Issue for an API or updates an existing one. + * + * @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 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 {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 {IssueContract} - 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. + * + * {IssueContract} [result] - The deserialized result object if an error did not occur. + * See {@link IssueContract} 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. + */ + createOrUpdate(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, parameters: models.IssueContract, options?: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, parameters: models.IssueContract, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, parameters: models.IssueContract, options: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified Issue from 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 {string} 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] 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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, ifMatch: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified Issue from 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 {string} 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] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, ifMatch: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, ifMatch: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, ifMatch: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ApiIssueComments + * __NOTE__: An instance of this class is automatically created for an + * instance of the ApiManagementClient. + */ +export interface ApiIssueComments { + + + /** + * Lists all comments for the Issue assosiated with the specified 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} [options] Optional Parameters. + * + * @param {string} [options.filter] | Field | Supported operators | + * Supported functions | + * |-------------|------------------------|-----------------------------------| + * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | + * | userId | ge, le, eq, ne, gt, lt | substringof, startswith, + * endswith | + * + * @param {number} [options.top] Number of records to return. + * + * @param {number} [options.skip] Number of records to skip. + * + * @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. + */ + listByServiceWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options?: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all comments for the Issue assosiated with the specified 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} [options] Optional Parameters. + * + * @param {string} [options.filter] | Field | Supported operators | + * Supported functions | + * |-------------|------------------------|-----------------------------------| + * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | + * | userId | ge, le, eq, ne, gt, lt | substringof, startswith, + * endswith | + * + * @param {number} [options.top] Number of records to return. + * + * @param {number} [options.skip] Number of records to skip. + * + * @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 {IssueCommentCollection} - 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. + * + * {IssueCommentCollection} [result] - The deserialized result object if an error did not occur. + * See {@link IssueCommentCollection} 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. + */ + listByService(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options?: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }): Promise; + listByService(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, callback: ServiceCallback): void; + listByService(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all comments for the Issue assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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. + */ + listByServiceNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all comments for the Issue assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 {IssueCommentCollection} - 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. + * + * {IssueCommentCollection} [result] - The deserialized result object if an error did not occur. + * See {@link IssueCommentCollection} 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. + */ + listByServiceNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServiceNext(nextPageLink: string, callback: ServiceCallback): void; + listByServiceNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ApiIssuComment + * __NOTE__: An instance of this class is automatically created for an + * instance of the ApiManagementClient. + */ +export interface ApiIssuComment { + + + /** + * Gets the entity state (Etag) version of the issue Comment for an API + * specified by its identifier. + * + * @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 {string} commentId Comment identifier within an Issue. Must be unique + * in the current Issue. + * + * @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. + */ + headWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the entity state (Etag) version of the issue Comment for an API + * specified by its identifier. + * + * @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 {string} commentId Comment identifier within an Issue. Must be unique + * in the current Issue. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + head(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + head(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, callback: ServiceCallback): void; + head(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ApiIssueComment + * __NOTE__: An instance of this class is automatically created for an + * instance of the ApiManagementClient. + */ +export interface ApiIssueComment { + + + /** + * Gets the details of the issue Comment for an API specified by its + * identifier. + * + * @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 {string} commentId Comment identifier within an Issue. Must be unique + * in the current Issue. + * + * @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. + */ + getWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the details of the issue Comment for an API specified by its + * identifier. + * + * @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 {string} commentId Comment identifier within an Issue. Must be unique + * in the current Issue. + * + * @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 {IssueCommentContract} - 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. + * + * {IssueCommentContract} [result] - The deserialized result object if an error did not occur. + * See {@link IssueCommentContract} 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. + */ + get(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a new Comment for the Issue in an API or updates an existing one. + * + * @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 {string} commentId Comment identifier within an Issue. Must be unique + * in the current Issue. + * + * @param {object} parameters Create parameters. + * + * @param {string} parameters.text Comment text. + * + * @param {date} [parameters.createdDate] Date and time when the comment was + * created. + * + * @param {string} parameters.userId A resource identifier for the user who + * left the comment. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, parameters: models.IssueCommentContract, options?: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a new Comment for the Issue in an API or updates an existing one. + * + * @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 {string} commentId Comment identifier within an Issue. Must be unique + * in the current Issue. + * + * @param {object} parameters Create parameters. + * + * @param {string} parameters.text Comment text. + * + * @param {date} [parameters.createdDate] Date and time when the comment was + * created. + * + * @param {string} parameters.userId A resource identifier for the user who + * left the comment. + * + * @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 {IssueCommentContract} - 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. + * + * {IssueCommentContract} [result] - The deserialized result object if an error did not occur. + * See {@link IssueCommentContract} 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. + */ + createOrUpdate(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, parameters: models.IssueCommentContract, options?: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, parameters: models.IssueCommentContract, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, parameters: models.IssueCommentContract, options: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified comment from an Issue. + * + * @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 {string} commentId Comment identifier within an Issue. Must be unique + * in the current Issue. + * + * @param {string} 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] 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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, ifMatch: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified comment from an Issue. + * + * @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 {string} commentId Comment identifier within an Issue. Must be unique + * in the current Issue. + * + * @param {string} 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] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, ifMatch: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, ifMatch: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, ifMatch: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ApiIssueAttachments + * __NOTE__: An instance of this class is automatically created for an + * instance of the ApiManagementClient. + */ +export interface ApiIssueAttachments { + + + /** + * Lists all comments for the Issue assosiated with the specified 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} [options] Optional Parameters. + * + * @param {string} [options.filter] | Field | Supported operators | + * Supported functions | + * |-------------|------------------------|-----------------------------------| + * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | + * | userId | ge, le, eq, ne, gt, lt | substringof, startswith, + * endswith | + * + * @param {number} [options.top] Number of records to return. + * + * @param {number} [options.skip] Number of records to skip. + * + * @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. + */ + listByServiceWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options?: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all comments for the Issue assosiated with the specified 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} [options] Optional Parameters. + * + * @param {string} [options.filter] | Field | Supported operators | + * Supported functions | + * |-------------|------------------------|-----------------------------------| + * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | + * | userId | ge, le, eq, ne, gt, lt | substringof, startswith, + * endswith | + * + * @param {number} [options.top] Number of records to return. + * + * @param {number} [options.skip] Number of records to skip. + * + * @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 {IssueAttachmentCollection} - 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. + * + * {IssueAttachmentCollection} [result] - The deserialized result object if an error did not occur. + * See {@link IssueAttachmentCollection} 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. + */ + listByService(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options?: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }): Promise; + listByService(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, callback: ServiceCallback): void; + listByService(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all comments for the Issue assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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. + */ + listByServiceNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all comments for the Issue assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 {IssueAttachmentCollection} - 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. + * + * {IssueAttachmentCollection} [result] - The deserialized result object if an error did not occur. + * See {@link IssueAttachmentCollection} 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. + */ + listByServiceNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServiceNext(nextPageLink: string, callback: ServiceCallback): void; + listByServiceNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ApiIssuAttachment + * __NOTE__: An instance of this class is automatically created for an + * instance of the ApiManagementClient. + */ +export interface ApiIssuAttachment { + + + /** + * Gets the entity state (Etag) version of the issue Attachment for an API + * specified by its identifier. + * + * @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 {string} attachmentId Attachment identifier within an Issue. Must be + * unique in the current Issue. + * + * @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. + */ + headWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the entity state (Etag) version of the issue Attachment for an API + * specified by its identifier. + * + * @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 {string} attachmentId Attachment identifier within an Issue. Must be + * unique in the current Issue. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + head(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + head(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, callback: ServiceCallback): void; + head(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ApiIssueAttachment + * __NOTE__: An instance of this class is automatically created for an + * instance of the ApiManagementClient. + */ +export interface ApiIssueAttachment { + + + /** + * Gets the details of the issue Attachment for an API specified by its + * identifier. + * + * @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 {string} attachmentId Attachment identifier within an Issue. Must be + * unique in the current Issue. + * + * @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. + */ + getWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the details of the issue Attachment for an API specified by its + * identifier. + * + * @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 {string} attachmentId Attachment identifier within an Issue. Must be + * unique in the current Issue. + * + * @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 {IssueAttachmentContract} - 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. + * + * {IssueAttachmentContract} [result] - The deserialized result object if an error did not occur. + * See {@link IssueAttachmentContract} 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. + */ + get(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a new Attachment for the Issue in an API or updates an existing one. + * + * @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 {string} attachmentId Attachment identifier within an Issue. Must be + * unique in the current Issue. + * + * @param {object} parameters Create parameters. + * + * @param {string} parameters.title Filename by which the binary data will be + * saved. + * + * @param {string} parameters.contentFormat Either 'link' if content is + * provided via an HTTP link or the MIME type of the Base64-encoded binary data + * provided in the 'content' property. + * + * @param {string} parameters.content An HTTP link or Base64-encoded binary + * data. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, parameters: models.IssueAttachmentContract, options?: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a new Attachment for the Issue in an API or updates an existing one. + * + * @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 {string} attachmentId Attachment identifier within an Issue. Must be + * unique in the current Issue. + * + * @param {object} parameters Create parameters. + * + * @param {string} parameters.title Filename by which the binary data will be + * saved. + * + * @param {string} parameters.contentFormat Either 'link' if content is + * provided via an HTTP link or the MIME type of the Base64-encoded binary data + * provided in the 'content' property. + * + * @param {string} parameters.content An HTTP link or Base64-encoded binary + * data. + * + * @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 {IssueAttachmentContract} - 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. + * + * {IssueAttachmentContract} [result] - The deserialized result object if an error did not occur. + * See {@link IssueAttachmentContract} 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. + */ + createOrUpdate(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, parameters: models.IssueAttachmentContract, options?: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, parameters: models.IssueAttachmentContract, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, parameters: models.IssueAttachmentContract, options: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified comment from an Issue. + * + * @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 {string} attachmentId Attachment identifier within an Issue. Must be + * unique in the current Issue. + * + * @param {string} 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] 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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, ifMatch: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified comment from an Issue. + * + * @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 {string} attachmentId Attachment identifier within an Issue. Must be + * unique in the current Issue. + * + * @param {string} 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] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, ifMatch: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, ifMatch: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, ifMatch: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + /** * @class * AuthorizationServer diff --git a/lib/services/apimanagement/lib/operations/index.js b/lib/services/apimanagement/lib/operations/index.js index a5d998d55a..98ca92a21b 100644 --- a/lib/services/apimanagement/lib/operations/index.js +++ b/lib/services/apimanagement/lib/operations/index.js @@ -27,6 +27,14 @@ exports.ApiPolicy = require('./apiPolicy'); exports.ApiSchema = require('./apiSchema'); exports.ApiDiagnostic = require('./apiDiagnostic'); exports.ApiDiagnosticLogger = require('./apiDiagnosticLogger'); +exports.ApiIssues = require('./apiIssues'); +exports.ApiIssue = require('./apiIssue'); +exports.ApiIssueComments = require('./apiIssueComments'); +exports.ApiIssuComment = require('./apiIssuComment'); +exports.ApiIssueComment = require('./apiIssueComment'); +exports.ApiIssueAttachments = require('./apiIssueAttachments'); +exports.ApiIssuAttachment = require('./apiIssuAttachment'); +exports.ApiIssueAttachment = require('./apiIssueAttachment'); exports.AuthorizationServer = require('./authorizationServer'); exports.Backend = require('./backend'); exports.Certificate = require('./certificate'); diff --git a/lib/services/apimanagement/package.json b/lib/services/apimanagement/package.json index 8a9e6b9dd5..73d1daed63 100644 --- a/lib/services/apimanagement/package.json +++ b/lib/services/apimanagement/package.json @@ -4,7 +4,7 @@ "description": "ApiManagementClient Library with typescript type definitions for node", "version": "2.1.0-preview", "dependencies": { - "ms-rest": "^2.3.3", + "ms-rest": "^2.3.2", "ms-rest-azure": "^2.5.5" }, "keywords": [ "node", "azure" ], From e1d2d54ee4a3fdbb0b4edce3dd39225535b0e92c Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 16 Apr 2018 10:02:46 -0700 Subject: [PATCH 3/8] Generated from 3d3bc8bf17e73b22f7f978605ca2f78823d28a74 (#2744) add private ip address in addtional location --- .../lib/models/additionalLocation.js | 24 +++++++++++- .../apiManagementServiceBaseProperties.js | 9 +++-- .../models/apiManagementServiceResource.js | 9 +++-- .../apiManagementServiceUpdateParameters.js | 9 +++-- .../apimanagement/lib/models/index.d.ts | 37 ++++++++++++------- 5 files changed, 60 insertions(+), 28 deletions(-) diff --git a/lib/services/apimanagement/lib/models/additionalLocation.js b/lib/services/apimanagement/lib/models/additionalLocation.js index ff5bacf71d..3c28f6a608 100644 --- a/lib/services/apimanagement/lib/models/additionalLocation.js +++ b/lib/services/apimanagement/lib/models/additionalLocation.js @@ -26,8 +26,13 @@ class AdditionalLocation { * 'Developer', 'Standard', 'Premium', 'Basic' * @member {number} [sku.capacity] Capacity of the SKU (number of deployed * units of the SKU). The default value is 1. - * @member {array} [publicIPAddresses] Static IP addresses of the location's - * virtual machines. + * @member {array} [publicIPAddresses] Public Static Load Balanced IP + * addresses of the API Management service in the additional location. + * Available only for Basic, Standard and Premium SKU. + * @member {array} [privateIPAddresses] Private Static Load Balanced IP + * addresses of the API Management service which is deployed in an Internal + * Virtual Network in a particular additional location. Available only for + * Basic, Standard and Premium SKU. * @member {object} [virtualNetworkConfiguration] Virtual network * configuration for the location. * @member {string} [virtualNetworkConfiguration.vnetid] The virtual network @@ -87,6 +92,21 @@ class AdditionalLocation { } } }, + privateIPAddresses: { + required: false, + readOnly: true, + serializedName: 'privateIPAddresses', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, virtualNetworkConfiguration: { required: false, serializedName: 'virtualNetworkConfiguration', diff --git a/lib/services/apimanagement/lib/models/apiManagementServiceBaseProperties.js b/lib/services/apimanagement/lib/models/apiManagementServiceBaseProperties.js index fc03d723c0..4f0e0eb5f8 100644 --- a/lib/services/apimanagement/lib/models/apiManagementServiceBaseProperties.js +++ b/lib/services/apimanagement/lib/models/apiManagementServiceBaseProperties.js @@ -41,11 +41,12 @@ class ApiManagementServiceBaseProperties { * @member {array} [hostnameConfigurations] Custom hostname configuration of * the API Management service. * @member {array} [publicIPAddresses] Public Static Load Balanced IP - * addresses of the API Management service. Available only for Basic, - * Standard and Premium SKU. + * addresses of the API Management service in Primary region. Available only + * for Basic, Standard and Premium SKU. * @member {array} [privateIPAddresses] Private Static Load Balanced IP - * addresses of the API Management service which is deployed in an Internal - * Virtual Network. Available only for Basic, Standard and Premium SKU. + * addresses of the API Management service in Primary region which is + * deployed in an Internal Virtual Network. Available only for Basic, + * Standard and Premium SKU. * @member {object} [virtualNetworkConfiguration] Virtual network * configuration of the API Management service. * @member {string} [virtualNetworkConfiguration.vnetid] The virtual network diff --git a/lib/services/apimanagement/lib/models/apiManagementServiceResource.js b/lib/services/apimanagement/lib/models/apiManagementServiceResource.js index 325ca82aba..e27f9c993d 100644 --- a/lib/services/apimanagement/lib/models/apiManagementServiceResource.js +++ b/lib/services/apimanagement/lib/models/apiManagementServiceResource.js @@ -42,11 +42,12 @@ class ApiManagementServiceResource extends models['ApimResource'] { * @member {array} [hostnameConfigurations] Custom hostname configuration of * the API Management service. * @member {array} [publicIPAddresses] Public Static Load Balanced IP - * addresses of the API Management service. Available only for Basic, - * Standard and Premium SKU. + * addresses of the API Management service in Primary region. Available only + * for Basic, Standard and Premium SKU. * @member {array} [privateIPAddresses] Private Static Load Balanced IP - * addresses of the API Management service which is deployed in an Internal - * Virtual Network. Available only for Basic, Standard and Premium SKU. + * addresses of the API Management service in Primary region which is + * deployed in an Internal Virtual Network. Available only for Basic, + * Standard and Premium SKU. * @member {object} [virtualNetworkConfiguration] Virtual network * configuration of the API Management service. * @member {string} [virtualNetworkConfiguration.vnetid] The virtual network diff --git a/lib/services/apimanagement/lib/models/apiManagementServiceUpdateParameters.js b/lib/services/apimanagement/lib/models/apiManagementServiceUpdateParameters.js index b22066d438..f098b0acc3 100644 --- a/lib/services/apimanagement/lib/models/apiManagementServiceUpdateParameters.js +++ b/lib/services/apimanagement/lib/models/apiManagementServiceUpdateParameters.js @@ -42,11 +42,12 @@ class ApiManagementServiceUpdateParameters extends models['ApimResource'] { * @member {array} [hostnameConfigurations] Custom hostname configuration of * the API Management service. * @member {array} [publicIPAddresses] Public Static Load Balanced IP - * addresses of the API Management service. Available only for Basic, - * Standard and Premium SKU. + * addresses of the API Management service in Primary region. Available only + * for Basic, Standard and Premium SKU. * @member {array} [privateIPAddresses] Private Static Load Balanced IP - * addresses of the API Management service which is deployed in an Internal - * Virtual Network. Available only for Basic, Standard and Premium SKU. + * addresses of the API Management service in Primary region which is + * deployed in an Internal Virtual Network. Available only for Basic, + * Standard and Premium SKU. * @member {object} [virtualNetworkConfiguration] Virtual network * configuration of the API Management service. * @member {string} [virtualNetworkConfiguration.vnetid] The virtual network diff --git a/lib/services/apimanagement/lib/models/index.d.ts b/lib/services/apimanagement/lib/models/index.d.ts index 31a6ed6b68..373f0ed690 100644 --- a/lib/services/apimanagement/lib/models/index.d.ts +++ b/lib/services/apimanagement/lib/models/index.d.ts @@ -1854,8 +1854,13 @@ export interface ApiManagementServiceSkuProperties { * 'Developer', 'Standard', 'Premium', 'Basic' * @member {number} [sku.capacity] Capacity of the SKU (number of deployed * units of the SKU). The default value is 1. - * @member {array} [publicIPAddresses] Static IP addresses of the location's - * virtual machines. + * @member {array} [publicIPAddresses] Public Static Load Balanced IP addresses + * of the API Management service in the additional location. Available only for + * Basic, Standard and Premium SKU. + * @member {array} [privateIPAddresses] Private Static Load Balanced IP + * addresses of the API Management service which is deployed in an Internal + * Virtual Network in a particular additional location. Available only for + * Basic, Standard and Premium SKU. * @member {object} [virtualNetworkConfiguration] Virtual network configuration * for the location. * @member {string} [virtualNetworkConfiguration.vnetid] The virtual network @@ -1872,6 +1877,7 @@ export interface AdditionalLocation { location: string; sku: ApiManagementServiceSkuProperties; readonly publicIPAddresses?: string[]; + readonly privateIPAddresses?: string[]; virtualNetworkConfiguration?: VirtualNetworkConfiguration; readonly gatewayRegionalUrl?: string; } @@ -1926,11 +1932,12 @@ export interface ApiManagementServiceBackupRestoreParameters { * @member {array} [hostnameConfigurations] Custom hostname configuration of * the API Management service. * @member {array} [publicIPAddresses] Public Static Load Balanced IP addresses - * of the API Management service. Available only for Basic, Standard and - * Premium SKU. + * of the API Management service in Primary region. Available only for Basic, + * Standard and Premium SKU. * @member {array} [privateIPAddresses] Private Static Load Balanced IP - * addresses of the API Management service which is deployed in an Internal - * Virtual Network. Available only for Basic, Standard and Premium SKU. + * addresses of the API Management service in Primary region which is deployed + * in an Internal Virtual Network. Available only for Basic, Standard and + * Premium SKU. * @member {object} [virtualNetworkConfiguration] Virtual network configuration * of the API Management service. * @member {string} [virtualNetworkConfiguration.vnetid] The virtual network @@ -2044,11 +2051,12 @@ export interface ApimResource extends BaseResource { * @member {array} [hostnameConfigurations] Custom hostname configuration of * the API Management service. * @member {array} [publicIPAddresses] Public Static Load Balanced IP addresses - * of the API Management service. Available only for Basic, Standard and - * Premium SKU. + * of the API Management service in Primary region. Available only for Basic, + * Standard and Premium SKU. * @member {array} [privateIPAddresses] Private Static Load Balanced IP - * addresses of the API Management service which is deployed in an Internal - * Virtual Network. Available only for Basic, Standard and Premium SKU. + * addresses of the API Management service in Primary region which is deployed + * in an Internal Virtual Network. Available only for Basic, Standard and + * Premium SKU. * @member {object} [virtualNetworkConfiguration] Virtual network configuration * of the API Management service. * @member {string} [virtualNetworkConfiguration.vnetid] The virtual network @@ -2148,11 +2156,12 @@ export interface ApiManagementServiceResource extends ApimResource { * @member {array} [hostnameConfigurations] Custom hostname configuration of * the API Management service. * @member {array} [publicIPAddresses] Public Static Load Balanced IP addresses - * of the API Management service. Available only for Basic, Standard and - * Premium SKU. + * of the API Management service in Primary region. Available only for Basic, + * Standard and Premium SKU. * @member {array} [privateIPAddresses] Private Static Load Balanced IP - * addresses of the API Management service which is deployed in an Internal - * Virtual Network. Available only for Basic, Standard and Premium SKU. + * addresses of the API Management service in Primary region which is deployed + * in an Internal Virtual Network. Available only for Basic, Standard and + * Premium SKU. * @member {object} [virtualNetworkConfiguration] Virtual network configuration * of the API Management service. * @member {string} [virtualNetworkConfiguration.vnetid] The virtual network From d722516f3952948c7ef528201cd1e82fea1d1a90 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 16 Apr 2018 11:00:15 -0700 Subject: [PATCH 4/8] Generated from 3252d4551fb2ddd26ae4814540c518b0f878fdd4 (#2745) Issues -> Issue --- .../lib/apiManagementClient.d.ts | 5 - .../apimanagement/lib/apiManagementClient.js | 5 - .../apimanagement/lib/operations/apiIssue.js | 559 ++++++++ .../lib/operations/apiIssueAttachment.js | 1208 +++++++++++++--- .../lib/operations/apiIssueComment.js | 1216 ++++++++++++++--- .../apimanagement/lib/operations/index.d.ts | 403 +++--- .../apimanagement/lib/operations/index.js | 5 - 7 files changed, 2846 insertions(+), 555 deletions(-) diff --git a/lib/services/apimanagement/lib/apiManagementClient.d.ts b/lib/services/apimanagement/lib/apiManagementClient.d.ts index 1bd5a82d4f..26d482185f 100644 --- a/lib/services/apimanagement/lib/apiManagementClient.d.ts +++ b/lib/services/apimanagement/lib/apiManagementClient.d.ts @@ -69,13 +69,8 @@ export default class ApiManagementClient extends AzureServiceClient { apiSchema: operations.ApiSchema; apiDiagnostic: operations.ApiDiagnostic; apiDiagnosticLogger: operations.ApiDiagnosticLogger; - apiIssues: operations.ApiIssues; apiIssue: operations.ApiIssue; - apiIssueComments: operations.ApiIssueComments; - apiIssuComment: operations.ApiIssuComment; apiIssueComment: operations.ApiIssueComment; - apiIssueAttachments: operations.ApiIssueAttachments; - apiIssuAttachment: operations.ApiIssuAttachment; apiIssueAttachment: operations.ApiIssueAttachment; authorizationServer: operations.AuthorizationServer; backend: operations.Backend; diff --git a/lib/services/apimanagement/lib/apiManagementClient.js b/lib/services/apimanagement/lib/apiManagementClient.js index b764c25f9c..c403e04db5 100644 --- a/lib/services/apimanagement/lib/apiManagementClient.js +++ b/lib/services/apimanagement/lib/apiManagementClient.js @@ -85,13 +85,8 @@ class ApiManagementClient extends ServiceClient { this.apiSchema = new operations.ApiSchema(this); this.apiDiagnostic = new operations.ApiDiagnostic(this); this.apiDiagnosticLogger = new operations.ApiDiagnosticLogger(this); - this.apiIssues = new operations.ApiIssues(this); this.apiIssue = new operations.ApiIssue(this); - this.apiIssueComments = new operations.ApiIssueComments(this); - this.apiIssuComment = new operations.ApiIssuComment(this); this.apiIssueComment = new operations.ApiIssueComment(this); - this.apiIssueAttachments = new operations.ApiIssueAttachments(this); - this.apiIssuAttachment = new operations.ApiIssuAttachment(this); this.apiIssueAttachment = new operations.ApiIssueAttachment(this); this.authorizationServer = new operations.AuthorizationServer(this); this.backend = new operations.Backend(this); diff --git a/lib/services/apimanagement/lib/operations/apiIssue.js b/lib/services/apimanagement/lib/operations/apiIssue.js index 4ac8c1d9b3..359db683c4 100644 --- a/lib/services/apimanagement/lib/operations/apiIssue.js +++ b/lib/services/apimanagement/lib/operations/apiIssue.js @@ -14,6 +14,233 @@ const msRest = require('ms-rest'); const msRestAzure = require('ms-rest-azure'); const WebResource = msRest.WebResource; +/** + * Lists all issues assosiated with the specified 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 {object} [options] Optional Parameters. + * + * @param {string} [options.filter] | Field | Supported operators | + * Supported functions | + * |-------------|------------------------|-----------------------------------| + * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | + * | state | eq | + * | + * | userId | ge, le, eq, ne, gt, lt | substringof, startswith, + * endswith | + * + * @param {number} [options.top] Number of records to return. + * + * @param {number} [options.skip] Number of records to skip. + * + * @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 IssueCollection} 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 _listByService(resourceGroupName, serviceName, apiId, 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 filter = (options && options.filter !== undefined) ? options.filter : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let skip = (options && options.skip !== undefined) ? options.skip : 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 (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 (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + if (top !== null && top !== undefined) { + if (top < 1) + { + throw new Error('"top" should satisfy the constraint - "InclusiveMinimum": 1'); + } + } + if (skip !== null && skip !== undefined && typeof skip !== 'number') { + throw new Error('skip must be of type number.'); + } + if (skip !== null && skip !== undefined) { + if (skip < 0) + { + throw new Error('"skip" should satisfy the constraint - "InclusiveMinimum": 0'); + } + } + 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'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serviceName}', encodeURIComponent(serviceName)); + requestUrl = requestUrl.replace('{apiId}', encodeURIComponent(apiId)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + if (skip !== null && skip !== undefined) { + queryParameters.push('$skip=' + encodeURIComponent(skip.toString())); + } + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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['IssueCollection']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + /** * Gets the entity state (Etag) version of the Issue for an API specified by * its identifier. @@ -860,6 +1087,134 @@ function _deleteMethod(resourceGroupName, serviceName, apiId, issueId, ifMatch, }); } +/** + * Lists all issues assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 IssueCollection} 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 _listByServiceNext(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.'); + } + // 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 (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 = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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['IssueCollection']().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 ApiIssue. */ class ApiIssue { /** @@ -868,10 +1223,130 @@ class ApiIssue { */ constructor(client) { this.client = client; + this._listByService = _listByService; this._head = _head; this._get = _get; this._createOrUpdate = _createOrUpdate; this._deleteMethod = _deleteMethod; + this._listByServiceNext = _listByServiceNext; + } + + /** + * Lists all issues assosiated with the specified 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 {object} [options] Optional Parameters. + * + * @param {string} [options.filter] | Field | Supported operators | + * Supported functions | + * |-------------|------------------------|-----------------------------------| + * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | + * | state | eq | + * | + * | userId | ge, le, eq, ne, gt, lt | substringof, startswith, + * endswith | + * + * @param {number} [options.top] Number of records to return. + * + * @param {number} [options.skip] Number of records to skip. + * + * @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. + */ + listByServiceWithHttpOperationResponse(resourceGroupName, serviceName, apiId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByService(resourceGroupName, serviceName, apiId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all issues assosiated with the specified 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 {object} [options] Optional Parameters. + * + * @param {string} [options.filter] | Field | Supported operators | + * Supported functions | + * |-------------|------------------------|-----------------------------------| + * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | + * | state | eq | + * | + * | userId | ge, le, eq, ne, gt, lt | substringof, startswith, + * endswith | + * + * @param {number} [options.top] Number of records to return. + * + * @param {number} [options.skip] Number of records to skip. + * + * @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 {IssueCollection} - 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 IssueCollection} 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. + */ + listByService(resourceGroupName, serviceName, apiId, 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._listByService(resourceGroupName, serviceName, apiId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByService(resourceGroupName, serviceName, apiId, options, optionalCallback); + } } /** @@ -1318,6 +1793,90 @@ class ApiIssue { } } + /** + * Lists all issues assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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. + */ + listByServiceNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByServiceNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all issues assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 {IssueCollection} - 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 IssueCollection} 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. + */ + listByServiceNext(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._listByServiceNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByServiceNext(nextPageLink, options, optionalCallback); + } + } + } module.exports = ApiIssue; diff --git a/lib/services/apimanagement/lib/operations/apiIssueAttachment.js b/lib/services/apimanagement/lib/operations/apiIssueAttachment.js index 7f5c6560de..f24510df3f 100644 --- a/lib/services/apimanagement/lib/operations/apiIssueAttachment.js +++ b/lib/services/apimanagement/lib/operations/apiIssueAttachment.js @@ -15,8 +15,7 @@ const msRestAzure = require('ms-rest-azure'); const WebResource = msRest.WebResource; /** - * Gets the details of the issue Attachment for an API specified by its - * identifier. + * Lists all comments for the Issue assosiated with the specified API. * * @param {string} resourceGroupName The name of the resource group. * @@ -28,11 +27,19 @@ const WebResource = msRest.WebResource; * @param {string} issueId Issue identifier. Must be unique in the current API * Management service instance. * - * @param {string} attachmentId Attachment identifier within an Issue. Must be - * unique in the current Issue. - * * @param {object} [options] Optional Parameters. * + * @param {string} [options.filter] | Field | Supported operators | + * Supported functions | + * |-------------|------------------------|-----------------------------------| + * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | + * | userId | ge, le, eq, ne, gt, lt | substringof, startswith, + * endswith | + * + * @param {number} [options.top] Number of records to return. + * + * @param {number} [options.skip] Number of records to skip. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -43,14 +50,14 @@ const WebResource = msRest.WebResource; * {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 IssueAttachmentContract} for more + * See {@link IssueAttachmentCollection} 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 _get(resourceGroupName, serviceName, apiId, issueId, attachmentId, options, callback) { +function _listByService(resourceGroupName, serviceName, apiId, issueId, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -60,6 +67,9 @@ function _get(resourceGroupName, serviceName, apiId, issueId, attachmentId, opti if (!callback) { throw new Error('callback cannot be null.'); } + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let skip = (options && options.skip !== undefined) ? options.skip : undefined; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -99,6 +109,9 @@ function _get(resourceGroupName, serviceName, apiId, issueId, attachmentId, opti throw new Error('"apiId" should satisfy the constraint - "Pattern": /(^[\w]+$)|(^[\w][\w\-]+[\w]$)/'); } } + 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 (issueId === null || issueId === undefined || typeof issueId.valueOf() !== 'string') { throw new Error('issueId cannot be null or undefined and it must be of type string.'); } @@ -116,28 +129,29 @@ function _get(resourceGroupName, serviceName, apiId, issueId, attachmentId, opti throw new Error('"issueId" should satisfy the constraint - "Pattern": /^[^*#&+:<>?]+$/'); } } - if (attachmentId === null || attachmentId === undefined || typeof attachmentId.valueOf() !== 'string') { - throw new Error('attachmentId 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 (attachmentId !== null && attachmentId !== undefined) { - if (attachmentId.length > 256) - { - throw new Error('"attachmentId" should satisfy the constraint - "MaxLength": 256'); - } - if (attachmentId.length < 1) - { - throw new Error('"attachmentId" should satisfy the constraint - "MinLength": 1'); - } - if (attachmentId.match(/^[^*#&+:<>?]+$/) === null) + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + if (top !== null && top !== undefined) { + if (top < 1) { - throw new Error('"attachmentId" should satisfy the constraint - "Pattern": /^[^*#&+:<>?]+$/'); + throw new Error('"top" should satisfy the constraint - "InclusiveMinimum": 1'); } } - 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 (skip !== null && skip !== undefined && typeof skip !== 'number') { + throw new Error('skip must be of type number.'); } - 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 (skip !== null && skip !== undefined) { + if (skip < 0) + { + throw new Error('"skip" should satisfy the constraint - "InclusiveMinimum": 0'); + } } 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.'); @@ -148,15 +162,23 @@ function _get(resourceGroupName, serviceName, apiId, issueId, attachmentId, opti // 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}/attachments/{attachmentId}'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/attachments'; 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('{attachmentId}', encodeURIComponent(attachmentId)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + if (skip !== null && skip !== undefined) { + queryParameters.push('$skip=' + encodeURIComponent(skip.toString())); + } if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -224,7 +246,7 @@ function _get(resourceGroupName, serviceName, apiId, issueId, attachmentId, opti parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['IssueAttachmentContract']().mapper(); + let resultMapper = new client.models['IssueAttachmentCollection']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -240,7 +262,8 @@ function _get(resourceGroupName, serviceName, apiId, issueId, attachmentId, opti } /** - * Creates a new Attachment for the Issue in an API or updates an existing one. + * Gets the entity state (Etag) version of the issue Attachment for an API + * specified by its identifier. * * @param {string} resourceGroupName The name of the resource group. * @@ -255,24 +278,8 @@ function _get(resourceGroupName, serviceName, apiId, issueId, attachmentId, opti * @param {string} attachmentId Attachment identifier within an Issue. Must be * unique in the current Issue. * - * @param {object} parameters Create parameters. - * - * @param {string} parameters.title Filename by which the binary data will be - * saved. - * - * @param {string} parameters.contentFormat Either 'link' if content is - * provided via an HTTP link or the MIME type of the Base64-encoded binary data - * provided in the 'content' property. - * - * @param {string} parameters.content An HTTP link or Base64-encoded binary - * data. - * * @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 * @@ -282,15 +289,13 @@ function _get(resourceGroupName, serviceName, apiId, issueId, attachmentId, opti * * {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 IssueAttachmentContract} for more - * information. + * {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 _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, attachmentId, parameters, options, callback) { +function _head(resourceGroupName, serviceName, apiId, issueId, attachmentId, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -300,7 +305,6 @@ function _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, attachm 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') { @@ -374,12 +378,6 @@ function _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, attachm throw new Error('"attachmentId" 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.'); } @@ -410,7 +408,7 @@ function _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, attachm // Create HTTP transport objects let httpRequest = new WebResource(); - httpRequest.method = 'PUT'; + httpRequest.method = 'HEAD'; httpRequest.url = requestUrl; httpRequest.headers = {}; // Set Headers @@ -418,9 +416,6 @@ function _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, attachm 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; } @@ -431,28 +426,14 @@ function _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, attachm } } } - // Serialize Request - let requestContent = null; - let requestModel = null; - try { - if (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['IssueAttachmentContract']().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; + httpRequest.body = null; // Send Request return client.pipeline(httpRequest, (err, response, responseBody) => { if (err) { return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 201) { + if (statusCode !== 200) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -481,47 +462,14 @@ function _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, attachm // 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['IssueAttachmentContract']().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); - } - } - // Deserialize Response - if (statusCode === 201) { - let parsedResponse = null; - try { - parsedResponse = JSON.parse(responseBody); - result = JSON.parse(responseBody); - if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['IssueAttachmentContract']().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); }); } /** - * Deletes the specified comment from an Issue. + * Gets the details of the issue Attachment for an API specified by its + * identifier. * * @param {string} resourceGroupName The name of the resource group. * @@ -536,10 +484,6 @@ function _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, attachm * @param {string} attachmentId Attachment identifier within an Issue. Must be * unique in the current Issue. * - * @param {string} 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] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -551,13 +495,15 @@ function _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, attachm * * {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 IssueAttachmentContract} 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(resourceGroupName, serviceName, apiId, issueId, attachmentId, ifMatch, options, callback) { +function _get(resourceGroupName, serviceName, apiId, issueId, attachmentId, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -640,9 +586,6 @@ function _deleteMethod(resourceGroupName, serviceName, apiId, issueId, attachmen throw new Error('"attachmentId" should satisfy the constraint - "Pattern": /^[^*#&+:<>?]+$/'); } } - if (ifMatch === null || ifMatch === undefined || typeof ifMatch.valueOf() !== 'string') { - throw new Error('ifMatch cannot be null or undefined and it must be of type string.'); - } if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); } @@ -673,7 +616,7 @@ function _deleteMethod(resourceGroupName, serviceName, apiId, issueId, attachmen // Create HTTP transport objects let httpRequest = new WebResource(); - httpRequest.method = 'DELETE'; + httpRequest.method = 'GET'; httpRequest.url = requestUrl; httpRequest.headers = {}; // Set Headers @@ -681,9 +624,6 @@ function _deleteMethod(resourceGroupName, serviceName, apiId, issueId, attachmen 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; } @@ -701,7 +641,7 @@ function _deleteMethod(resourceGroupName, serviceName, apiId, issueId, attachmen return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 204) { + if (statusCode !== 200) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -730,44 +670,915 @@ function _deleteMethod(resourceGroupName, serviceName, apiId, issueId, attachmen // 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['IssueAttachmentContract']().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 ApiIssueAttachment. */ -class ApiIssueAttachment { - /** - * Create a ApiIssueAttachment. - * @param {ApiManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._get = _get; - this._createOrUpdate = _createOrUpdate; - this._deleteMethod = _deleteMethod; +/** + * Creates a new Attachment for the Issue in an API or updates an existing one. + * + * @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 {string} attachmentId Attachment identifier within an Issue. Must be + * unique in the current Issue. + * + * @param {object} parameters Create parameters. + * + * @param {string} parameters.title Filename by which the binary data will be + * saved. + * + * @param {string} parameters.contentFormat Either 'link' if content is + * provided via an HTTP link or the MIME type of the Base64-encoded binary data + * provided in the 'content' property. + * + * @param {string} parameters.content An HTTP link or Base64-encoded binary + * data. + * + * @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. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IssueAttachmentContract} 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 _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, attachmentId, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; } - - /** - * Gets the details of the issue Attachment for an API specified by its - * identifier. - * - * @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 {string} attachmentId Attachment identifier within an Issue. Must be - * unique in the current Issue. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the + 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 (attachmentId === null || attachmentId === undefined || typeof attachmentId.valueOf() !== 'string') { + throw new Error('attachmentId cannot be null or undefined and it must be of type string.'); + } + if (attachmentId !== null && attachmentId !== undefined) { + if (attachmentId.length > 256) + { + throw new Error('"attachmentId" should satisfy the constraint - "MaxLength": 256'); + } + if (attachmentId.length < 1) + { + throw new Error('"attachmentId" should satisfy the constraint - "MinLength": 1'); + } + if (attachmentId.match(/^[^*#&+:<>?]+$/) === null) + { + throw new Error('"attachmentId" 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}/attachments/{attachmentId}'; + 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('{attachmentId}', encodeURIComponent(attachmentId)); + 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 = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (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['IssueAttachmentContract']().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 !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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['IssueAttachmentContract']().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); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['IssueAttachmentContract']().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); + }); +} + +/** + * Deletes the specified comment from an Issue. + * + * @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 {string} attachmentId Attachment identifier within an Issue. Must be + * unique in the current Issue. + * + * @param {string} 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] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, serviceName, apiId, issueId, attachmentId, ifMatch, 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.'); + } + // 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 (attachmentId === null || attachmentId === undefined || typeof attachmentId.valueOf() !== 'string') { + throw new Error('attachmentId cannot be null or undefined and it must be of type string.'); + } + if (attachmentId !== null && attachmentId !== undefined) { + if (attachmentId.length > 256) + { + throw new Error('"attachmentId" should satisfy the constraint - "MaxLength": 256'); + } + if (attachmentId.length < 1) + { + throw new Error('"attachmentId" should satisfy the constraint - "MinLength": 1'); + } + if (attachmentId.match(/^[^*#&+:<>?]+$/) === null) + { + throw new Error('"attachmentId" should satisfy the constraint - "Pattern": /^[^*#&+:<>?]+$/'); + } + } + if (ifMatch === null || ifMatch === undefined || typeof ifMatch.valueOf() !== 'string') { + throw new Error('ifMatch cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.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}/attachments/{attachmentId}'; + 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('{attachmentId}', encodeURIComponent(attachmentId)); + 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 = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (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]; + } + } + } + httpRequest.body = null; + // 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); + }); +} + +/** + * Lists all comments for the Issue assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 IssueAttachmentCollection} 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 _listByServiceNext(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.'); + } + // 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 (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 = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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['IssueAttachmentCollection']().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 ApiIssueAttachment. */ +class ApiIssueAttachment { + /** + * Create a ApiIssueAttachment. + * @param {ApiManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listByService = _listByService; + this._head = _head; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._listByServiceNext = _listByServiceNext; + } + + /** + * Lists all comments for the Issue assosiated with the specified 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} [options] Optional Parameters. + * + * @param {string} [options.filter] | Field | Supported operators | + * Supported functions | + * |-------------|------------------------|-----------------------------------| + * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | + * | userId | ge, le, eq, ne, gt, lt | substringof, startswith, + * endswith | + * + * @param {number} [options.top] Number of records to return. + * + * @param {number} [options.skip] Number of records to skip. + * + * @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. + */ + listByServiceWithHttpOperationResponse(resourceGroupName, serviceName, apiId, issueId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByService(resourceGroupName, serviceName, apiId, issueId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all comments for the Issue assosiated with the specified 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} [options] Optional Parameters. + * + * @param {string} [options.filter] | Field | Supported operators | + * Supported functions | + * |-------------|------------------------|-----------------------------------| + * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | + * | userId | ge, le, eq, ne, gt, lt | substringof, startswith, + * endswith | + * + * @param {number} [options.top] Number of records to return. + * + * @param {number} [options.skip] Number of records to skip. + * + * @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 {IssueAttachmentCollection} - 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 IssueAttachmentCollection} 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. + */ + listByService(resourceGroupName, serviceName, apiId, issueId, 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._listByService(resourceGroupName, serviceName, apiId, issueId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByService(resourceGroupName, serviceName, apiId, issueId, options, optionalCallback); + } + } + + /** + * Gets the entity state (Etag) version of the issue Attachment for an API + * specified by its identifier. + * + * @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 {string} attachmentId Attachment identifier within an Issue. Must be + * unique in the current Issue. + * + * @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. + */ + headWithHttpOperationResponse(resourceGroupName, serviceName, apiId, issueId, attachmentId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._head(resourceGroupName, serviceName, apiId, issueId, attachmentId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the entity state (Etag) version of the issue Attachment for an API + * specified by its identifier. + * + * @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 {string} attachmentId Attachment identifier within an Issue. Must be + * unique in the current Issue. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + head(resourceGroupName, serviceName, apiId, issueId, attachmentId, 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._head(resourceGroupName, serviceName, apiId, issueId, attachmentId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._head(resourceGroupName, serviceName, apiId, issueId, attachmentId, options, optionalCallback); + } + } + + /** + * Gets the details of the issue Attachment for an API specified by its + * identifier. + * + * @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 {string} attachmentId Attachment identifier within an Issue. Must be + * unique in the current Issue. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned @@ -1103,6 +1914,91 @@ class ApiIssueAttachment { } } + /** + * Lists all comments for the Issue assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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. + */ + listByServiceNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByServiceNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all comments for the Issue assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 {IssueAttachmentCollection} - 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 IssueAttachmentCollection} 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. + */ + listByServiceNext(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._listByServiceNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByServiceNext(nextPageLink, options, optionalCallback); + } + } + } module.exports = ApiIssueAttachment; diff --git a/lib/services/apimanagement/lib/operations/apiIssueComment.js b/lib/services/apimanagement/lib/operations/apiIssueComment.js index f6de9c5b41..4029236dbf 100644 --- a/lib/services/apimanagement/lib/operations/apiIssueComment.js +++ b/lib/services/apimanagement/lib/operations/apiIssueComment.js @@ -15,8 +15,7 @@ const msRestAzure = require('ms-rest-azure'); const WebResource = msRest.WebResource; /** - * Gets the details of the issue Comment for an API specified by its - * identifier. + * Lists all comments for the Issue assosiated with the specified API. * * @param {string} resourceGroupName The name of the resource group. * @@ -28,11 +27,19 @@ const WebResource = msRest.WebResource; * @param {string} issueId Issue identifier. Must be unique in the current API * Management service instance. * - * @param {string} commentId Comment identifier within an Issue. Must be unique - * in the current Issue. - * * @param {object} [options] Optional Parameters. * + * @param {string} [options.filter] | Field | Supported operators | + * Supported functions | + * |-------------|------------------------|-----------------------------------| + * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | + * | userId | ge, le, eq, ne, gt, lt | substringof, startswith, + * endswith | + * + * @param {number} [options.top] Number of records to return. + * + * @param {number} [options.skip] Number of records to skip. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -43,13 +50,14 @@ const WebResource = msRest.WebResource; * {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 IssueCommentContract} for more information. + * See {@link IssueCommentCollection} 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 _get(resourceGroupName, serviceName, apiId, issueId, commentId, options, callback) { +function _listByService(resourceGroupName, serviceName, apiId, issueId, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -59,6 +67,9 @@ function _get(resourceGroupName, serviceName, apiId, issueId, commentId, options if (!callback) { throw new Error('callback cannot be null.'); } + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let skip = (options && options.skip !== undefined) ? options.skip : undefined; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -98,6 +109,9 @@ function _get(resourceGroupName, serviceName, apiId, issueId, commentId, options throw new Error('"apiId" should satisfy the constraint - "Pattern": /(^[\w]+$)|(^[\w][\w\-]+[\w]$)/'); } } + 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 (issueId === null || issueId === undefined || typeof issueId.valueOf() !== 'string') { throw new Error('issueId cannot be null or undefined and it must be of type string.'); } @@ -115,28 +129,29 @@ function _get(resourceGroupName, serviceName, apiId, issueId, commentId, options throw new Error('"issueId" should satisfy the constraint - "Pattern": /^[^*#&+:<>?]+$/'); } } - if (commentId === null || commentId === undefined || typeof commentId.valueOf() !== 'string') { - throw new Error('commentId 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 (commentId !== null && commentId !== undefined) { - if (commentId.length > 256) - { - throw new Error('"commentId" should satisfy the constraint - "MaxLength": 256'); - } - if (commentId.length < 1) - { - throw new Error('"commentId" should satisfy the constraint - "MinLength": 1'); - } - if (commentId.match(/^[^*#&+:<>?]+$/) === null) + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (top !== null && top !== undefined && typeof top !== 'number') { + throw new Error('top must be of type number.'); + } + if (top !== null && top !== undefined) { + if (top < 1) { - throw new Error('"commentId" should satisfy the constraint - "Pattern": /^[^*#&+:<>?]+$/'); + throw new Error('"top" should satisfy the constraint - "InclusiveMinimum": 1'); } } - 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 (skip !== null && skip !== undefined && typeof skip !== 'number') { + throw new Error('skip must be of type number.'); } - 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 (skip !== null && skip !== undefined) { + if (skip < 0) + { + throw new Error('"skip" should satisfy the constraint - "InclusiveMinimum": 0'); + } } 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.'); @@ -147,15 +162,23 @@ function _get(resourceGroupName, serviceName, apiId, issueId, commentId, options // 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}/comments/{commentId}'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/issues/{issueId}/comments'; 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('{commentId}', encodeURIComponent(commentId)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top.toString())); + } + if (skip !== null && skip !== undefined) { + queryParameters.push('$skip=' + encodeURIComponent(skip.toString())); + } if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -223,7 +246,7 @@ function _get(resourceGroupName, serviceName, apiId, issueId, commentId, options parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['IssueCommentContract']().mapper(); + let resultMapper = new client.models['IssueCommentCollection']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -239,7 +262,8 @@ function _get(resourceGroupName, serviceName, apiId, issueId, commentId, options } /** - * Creates a new Comment for the Issue in an API or updates an existing one. + * Gets the entity state (Etag) version of the issue Comment for an API + * specified by its identifier. * * @param {string} resourceGroupName The name of the resource group. * @@ -254,22 +278,8 @@ function _get(resourceGroupName, serviceName, apiId, issueId, commentId, options * @param {string} commentId Comment identifier within an Issue. Must be unique * in the current Issue. * - * @param {object} parameters Create parameters. - * - * @param {string} parameters.text Comment text. - * - * @param {date} [parameters.createdDate] Date and time when the comment was - * created. - * - * @param {string} parameters.userId A resource identifier for the user who - * left the comment. - * * @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 * @@ -279,14 +289,13 @@ function _get(resourceGroupName, serviceName, apiId, issueId, commentId, options * * {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 IssueCommentContract} for more information. + * {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 _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, commentId, parameters, options, callback) { +function _head(resourceGroupName, serviceName, apiId, issueId, commentId, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -296,7 +305,6 @@ function _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, comment 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') { @@ -370,12 +378,6 @@ function _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, comment throw new Error('"commentId" 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.'); } @@ -406,7 +408,7 @@ function _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, comment // Create HTTP transport objects let httpRequest = new WebResource(); - httpRequest.method = 'PUT'; + httpRequest.method = 'HEAD'; httpRequest.url = requestUrl; httpRequest.headers = {}; // Set Headers @@ -414,9 +416,6 @@ function _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, comment 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; } @@ -427,28 +426,14 @@ function _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, comment } } } - // Serialize Request - let requestContent = null; - let requestModel = null; - try { - if (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['IssueCommentContract']().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; + httpRequest.body = null; // Send Request return client.pipeline(httpRequest, (err, response, responseBody) => { if (err) { return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 201) { + if (statusCode !== 200) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -477,47 +462,14 @@ function _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, comment // 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['IssueCommentContract']().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); - } - } - // Deserialize Response - if (statusCode === 201) { - let parsedResponse = null; - try { - parsedResponse = JSON.parse(responseBody); - result = JSON.parse(responseBody); - if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['IssueCommentContract']().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); }); } /** - * Deletes the specified comment from an Issue. + * Gets the details of the issue Comment for an API specified by its + * identifier. * * @param {string} resourceGroupName The name of the resource group. * @@ -532,10 +484,6 @@ function _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, comment * @param {string} commentId Comment identifier within an Issue. Must be unique * in the current Issue. * - * @param {string} 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] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -547,13 +495,14 @@ function _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, comment * * {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 IssueCommentContract} 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(resourceGroupName, serviceName, apiId, issueId, commentId, ifMatch, options, callback) { +function _get(resourceGroupName, serviceName, apiId, issueId, commentId, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -636,9 +585,6 @@ function _deleteMethod(resourceGroupName, serviceName, apiId, issueId, commentId throw new Error('"commentId" should satisfy the constraint - "Pattern": /^[^*#&+:<>?]+$/'); } } - if (ifMatch === null || ifMatch === undefined || typeof ifMatch.valueOf() !== 'string') { - throw new Error('ifMatch cannot be null or undefined and it must be of type string.'); - } if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); } @@ -669,7 +615,7 @@ function _deleteMethod(resourceGroupName, serviceName, apiId, issueId, commentId // Create HTTP transport objects let httpRequest = new WebResource(); - httpRequest.method = 'DELETE'; + httpRequest.method = 'GET'; httpRequest.url = requestUrl; httpRequest.headers = {}; // Set Headers @@ -677,9 +623,6 @@ function _deleteMethod(resourceGroupName, serviceName, apiId, issueId, commentId 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; } @@ -697,7 +640,7 @@ function _deleteMethod(resourceGroupName, serviceName, apiId, issueId, commentId return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 204) { + if (statusCode !== 200) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -726,51 +669,919 @@ function _deleteMethod(resourceGroupName, serviceName, apiId, issueId, commentId // 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['IssueCommentContract']().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 ApiIssueComment. */ -class ApiIssueComment { - /** - * Create a ApiIssueComment. - * @param {ApiManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._get = _get; - this._createOrUpdate = _createOrUpdate; - this._deleteMethod = _deleteMethod; +/** + * Creates a new Comment for the Issue in an API or updates an existing one. + * + * @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 {string} commentId Comment identifier within an Issue. Must be unique + * in the current Issue. + * + * @param {object} parameters Create parameters. + * + * @param {string} parameters.text Comment text. + * + * @param {date} [parameters.createdDate] Date and time when the comment was + * created. + * + * @param {string} parameters.userId A resource identifier for the user who + * left the comment. + * + * @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. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link IssueCommentContract} 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 _createOrUpdate(resourceGroupName, serviceName, apiId, issueId, commentId, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; } - - /** - * Gets the details of the issue Comment for an API specified by its - * identifier. - * - * @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 {string} commentId Comment identifier within an Issue. Must be unique - * in the current Issue. - * - * @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. + 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 (commentId === null || commentId === undefined || typeof commentId.valueOf() !== 'string') { + throw new Error('commentId cannot be null or undefined and it must be of type string.'); + } + if (commentId !== null && commentId !== undefined) { + if (commentId.length > 256) + { + throw new Error('"commentId" should satisfy the constraint - "MaxLength": 256'); + } + if (commentId.length < 1) + { + throw new Error('"commentId" should satisfy the constraint - "MinLength": 1'); + } + if (commentId.match(/^[^*#&+:<>?]+$/) === null) + { + throw new Error('"commentId" 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}/comments/{commentId}'; + 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('{commentId}', encodeURIComponent(commentId)); + 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 = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (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['IssueCommentContract']().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 !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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['IssueCommentContract']().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); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['IssueCommentContract']().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); + }); +} + +/** + * Deletes the specified comment from an Issue. + * + * @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 {string} commentId Comment identifier within an Issue. Must be unique + * in the current Issue. + * + * @param {string} 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] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, serviceName, apiId, issueId, commentId, ifMatch, 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.'); + } + // 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 (commentId === null || commentId === undefined || typeof commentId.valueOf() !== 'string') { + throw new Error('commentId cannot be null or undefined and it must be of type string.'); + } + if (commentId !== null && commentId !== undefined) { + if (commentId.length > 256) + { + throw new Error('"commentId" should satisfy the constraint - "MaxLength": 256'); + } + if (commentId.length < 1) + { + throw new Error('"commentId" should satisfy the constraint - "MinLength": 1'); + } + if (commentId.match(/^[^*#&+:<>?]+$/) === null) + { + throw new Error('"commentId" should satisfy the constraint - "Pattern": /^[^*#&+:<>?]+$/'); + } + } + if (ifMatch === null || ifMatch === undefined || typeof ifMatch.valueOf() !== 'string') { + throw new Error('ifMatch cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.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}/comments/{commentId}'; + 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('{commentId}', encodeURIComponent(commentId)); + 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 = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (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]; + } + } + } + httpRequest.body = null; + // 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); + }); +} + +/** + * Lists all comments for the Issue assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 IssueCommentCollection} 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 _listByServiceNext(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.'); + } + // 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 (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 = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['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['IssueCommentCollection']().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 ApiIssueComment. */ +class ApiIssueComment { + /** + * Create a ApiIssueComment. + * @param {ApiManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listByService = _listByService; + this._head = _head; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._listByServiceNext = _listByServiceNext; + } + + /** + * Lists all comments for the Issue assosiated with the specified 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} [options] Optional Parameters. + * + * @param {string} [options.filter] | Field | Supported operators | + * Supported functions | + * |-------------|------------------------|-----------------------------------| + * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | + * | userId | ge, le, eq, ne, gt, lt | substringof, startswith, + * endswith | + * + * @param {number} [options.top] Number of records to return. + * + * @param {number} [options.skip] Number of records to skip. + * + * @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. + */ + listByServiceWithHttpOperationResponse(resourceGroupName, serviceName, apiId, issueId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByService(resourceGroupName, serviceName, apiId, issueId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all comments for the Issue assosiated with the specified 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} [options] Optional Parameters. + * + * @param {string} [options.filter] | Field | Supported operators | + * Supported functions | + * |-------------|------------------------|-----------------------------------| + * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | + * | userId | ge, le, eq, ne, gt, lt | substringof, startswith, + * endswith | + * + * @param {number} [options.top] Number of records to return. + * + * @param {number} [options.skip] Number of records to skip. + * + * @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 {IssueCommentCollection} - 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 IssueCommentCollection} 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. + */ + listByService(resourceGroupName, serviceName, apiId, issueId, 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._listByService(resourceGroupName, serviceName, apiId, issueId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByService(resourceGroupName, serviceName, apiId, issueId, options, optionalCallback); + } + } + + /** + * Gets the entity state (Etag) version of the issue Comment for an API + * specified by its identifier. + * + * @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 {string} commentId Comment identifier within an Issue. Must be unique + * in the current Issue. + * + * @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. + */ + headWithHttpOperationResponse(resourceGroupName, serviceName, apiId, issueId, commentId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._head(resourceGroupName, serviceName, apiId, issueId, commentId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the entity state (Etag) version of the issue Comment for an API + * specified by its identifier. + * + * @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 {string} commentId Comment identifier within an Issue. Must be unique + * in the current Issue. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + head(resourceGroupName, serviceName, apiId, issueId, commentId, 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._head(resourceGroupName, serviceName, apiId, issueId, commentId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._head(resourceGroupName, serviceName, apiId, issueId, commentId, options, optionalCallback); + } + } + + /** + * Gets the details of the issue Comment for an API specified by its + * identifier. + * + * @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 {string} commentId Comment identifier within an Issue. Must be unique + * in the current Issue. + * + * @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. */ getWithHttpOperationResponse(resourceGroupName, serviceName, apiId, issueId, commentId, options) { let client = this.client; @@ -1093,6 +1904,91 @@ class ApiIssueComment { } } + /** + * Lists all comments for the Issue assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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. + */ + listByServiceNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByServiceNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all comments for the Issue assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 {IssueCommentCollection} - 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 IssueCommentCollection} 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. + */ + listByServiceNext(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._listByServiceNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByServiceNext(nextPageLink, options, optionalCallback); + } + } + } module.exports = ApiIssueComment; diff --git a/lib/services/apimanagement/lib/operations/index.d.ts b/lib/services/apimanagement/lib/operations/index.d.ts index 7f11d49aae..bdfecfea76 100644 --- a/lib/services/apimanagement/lib/operations/index.d.ts +++ b/lib/services/apimanagement/lib/operations/index.d.ts @@ -5242,11 +5242,11 @@ export interface ApiDiagnosticLogger { /** * @class - * ApiIssues + * ApiIssue * __NOTE__: An instance of this class is automatically created for an * instance of the ApiManagementClient. */ -export interface ApiIssues { +export interface ApiIssue { /** @@ -5340,72 +5340,6 @@ export interface ApiIssues { listByService(resourceGroupName: string, serviceName: string, apiId: string, options: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - /** - * Lists all issues assosiated with the specified API. - * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. - * - * @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. - */ - listByServiceNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Lists all issues assosiated with the specified API. - * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. - * - * @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 {IssueCollection} - 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. - * - * {IssueCollection} [result] - The deserialized result object if an error did not occur. - * See {@link IssueCollection} 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. - */ - listByServiceNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByServiceNext(nextPageLink: string, callback: ServiceCallback): void; - listByServiceNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * ApiIssue - * __NOTE__: An instance of this class is automatically created for an - * instance of the ApiManagementClient. - */ -export interface ApiIssue { - - /** * Gets the entity state (Etag) version of the Issue for an API specified by * its identifier. @@ -5740,15 +5674,72 @@ export interface ApiIssue { deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, ifMatch: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, ifMatch: string, callback: ServiceCallback): void; deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, ifMatch: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all issues assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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. + */ + listByServiceNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all issues assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 {IssueCollection} - 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. + * + * {IssueCollection} [result] - The deserialized result object if an error did not occur. + * See {@link IssueCollection} 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. + */ + listByServiceNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServiceNext(nextPageLink: string, callback: ServiceCallback): void; + listByServiceNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** * @class - * ApiIssueComments + * ApiIssueComment * __NOTE__: An instance of this class is automatically created for an * instance of the ApiManagementClient. */ -export interface ApiIssueComments { +export interface ApiIssueComment { /** @@ -5845,73 +5836,6 @@ export interface ApiIssueComments { listByService(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - /** - * Lists all comments for the Issue assosiated with the specified API. - * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. - * - * @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. - */ - listByServiceNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Lists all comments for the Issue assosiated with the specified API. - * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. - * - * @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 {IssueCommentCollection} - 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. - * - * {IssueCommentCollection} [result] - The deserialized result object if an error did not occur. - * See {@link IssueCommentCollection} 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. - */ - listByServiceNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByServiceNext(nextPageLink: string, callback: ServiceCallback): void; - listByServiceNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * ApiIssuComment - * __NOTE__: An instance of this class is automatically created for an - * instance of the ApiManagementClient. - */ -export interface ApiIssuComment { - - /** * Gets the entity state (Etag) version of the issue Comment for an API * specified by its identifier. @@ -5988,15 +5912,6 @@ export interface ApiIssuComment { head(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; head(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, callback: ServiceCallback): void; head(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * ApiIssueComment - * __NOTE__: An instance of this class is automatically created for an - * instance of the ApiManagementClient. - */ -export interface ApiIssueComment { /** @@ -6265,15 +6180,73 @@ export interface ApiIssueComment { deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, ifMatch: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, ifMatch: string, callback: ServiceCallback): void; deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, ifMatch: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all comments for the Issue assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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. + */ + listByServiceNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all comments for the Issue assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 {IssueCommentCollection} - 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. + * + * {IssueCommentCollection} [result] - The deserialized result object if an error did not occur. + * See {@link IssueCommentCollection} 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. + */ + listByServiceNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServiceNext(nextPageLink: string, callback: ServiceCallback): void; + listByServiceNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** * @class - * ApiIssueAttachments + * ApiIssueAttachment * __NOTE__: An instance of this class is automatically created for an * instance of the ApiManagementClient. */ -export interface ApiIssueAttachments { +export interface ApiIssueAttachment { /** @@ -6370,73 +6343,6 @@ export interface ApiIssueAttachments { listByService(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - /** - * Lists all comments for the Issue assosiated with the specified API. - * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. - * - * @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. - */ - listByServiceNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Lists all comments for the Issue assosiated with the specified API. - * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. - * - * @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 {IssueAttachmentCollection} - 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. - * - * {IssueAttachmentCollection} [result] - The deserialized result object if an error did not occur. - * See {@link IssueAttachmentCollection} 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. - */ - listByServiceNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByServiceNext(nextPageLink: string, callback: ServiceCallback): void; - listByServiceNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * ApiIssuAttachment - * __NOTE__: An instance of this class is automatically created for an - * instance of the ApiManagementClient. - */ -export interface ApiIssuAttachment { - - /** * Gets the entity state (Etag) version of the issue Attachment for an API * specified by its identifier. @@ -6513,15 +6419,6 @@ export interface ApiIssuAttachment { head(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; head(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, callback: ServiceCallback): void; head(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * ApiIssueAttachment - * __NOTE__: An instance of this class is automatically created for an - * instance of the ApiManagementClient. - */ -export interface ApiIssueAttachment { /** @@ -6796,6 +6693,64 @@ export interface ApiIssueAttachment { deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, ifMatch: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, ifMatch: string, callback: ServiceCallback): void; deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, ifMatch: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all comments for the Issue assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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. + */ + listByServiceNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all comments for the Issue assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 {IssueAttachmentCollection} - 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. + * + * {IssueAttachmentCollection} [result] - The deserialized result object if an error did not occur. + * See {@link IssueAttachmentCollection} 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. + */ + listByServiceNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServiceNext(nextPageLink: string, callback: ServiceCallback): void; + listByServiceNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** diff --git a/lib/services/apimanagement/lib/operations/index.js b/lib/services/apimanagement/lib/operations/index.js index 98ca92a21b..e5955aa5a7 100644 --- a/lib/services/apimanagement/lib/operations/index.js +++ b/lib/services/apimanagement/lib/operations/index.js @@ -27,13 +27,8 @@ exports.ApiPolicy = require('./apiPolicy'); exports.ApiSchema = require('./apiSchema'); exports.ApiDiagnostic = require('./apiDiagnostic'); exports.ApiDiagnosticLogger = require('./apiDiagnosticLogger'); -exports.ApiIssues = require('./apiIssues'); exports.ApiIssue = require('./apiIssue'); -exports.ApiIssueComments = require('./apiIssueComments'); -exports.ApiIssuComment = require('./apiIssuComment'); exports.ApiIssueComment = require('./apiIssueComment'); -exports.ApiIssueAttachments = require('./apiIssueAttachments'); -exports.ApiIssuAttachment = require('./apiIssuAttachment'); exports.ApiIssueAttachment = require('./apiIssueAttachment'); exports.AuthorizationServer = require('./authorizationServer'); exports.Backend = require('./backend'); From 918599e148d6947535f8c5e09f86d067fabc26f9 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 19 Apr 2018 09:42:55 -0700 Subject: [PATCH 5/8] [AutoPR apimanagement/resource-manager] ApiIssue HEAD operation name consistent across the spec (#2751) * Generated from 3a649f27e5368d86880dc0f4c3b8b2c76676763e normalize head names * Generated from 58adb27c9fd292a5f3c01faa388a3183c075b632 delete supports 200 --- .../apimanagement/lib/operations/apiIssue.js | 16 ++++++------- .../lib/operations/apiIssueAttachment.js | 16 ++++++------- .../lib/operations/apiIssueComment.js | 16 ++++++------- .../apimanagement/lib/operations/index.d.ts | 24 +++++++++---------- 4 files changed, 36 insertions(+), 36 deletions(-) diff --git a/lib/services/apimanagement/lib/operations/apiIssue.js b/lib/services/apimanagement/lib/operations/apiIssue.js index 359db683c4..e0690110da 100644 --- a/lib/services/apimanagement/lib/operations/apiIssue.js +++ b/lib/services/apimanagement/lib/operations/apiIssue.js @@ -272,7 +272,7 @@ function _listByService(resourceGroupName, serviceName, apiId, options, callback * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _head(resourceGroupName, serviceName, apiId, issueId, options, callback) { +function _getEntityTag(resourceGroupName, serviceName, apiId, issueId, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -1053,7 +1053,7 @@ function _deleteMethod(resourceGroupName, serviceName, apiId, issueId, ifMatch, return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 204) { + if (statusCode !== 200 && statusCode !== 204) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -1224,7 +1224,7 @@ class ApiIssue { constructor(client) { this.client = client; this._listByService = _listByService; - this._head = _head; + this._getEntityTag = _getEntityTag; this._get = _get; this._createOrUpdate = _createOrUpdate; this._deleteMethod = _deleteMethod; @@ -1374,11 +1374,11 @@ class ApiIssue { * * @reject {Error} - The error object. */ - headWithHttpOperationResponse(resourceGroupName, serviceName, apiId, issueId, options) { + getEntityTagWithHttpOperationResponse(resourceGroupName, serviceName, apiId, issueId, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._head(resourceGroupName, serviceName, apiId, issueId, options, (err, result, request, response) => { + self._getEntityTag(resourceGroupName, serviceName, apiId, issueId, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -1428,7 +1428,7 @@ class ApiIssue { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - head(resourceGroupName, serviceName, apiId, issueId, options, optionalCallback) { + getEntityTag(resourceGroupName, serviceName, apiId, issueId, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -1437,14 +1437,14 @@ class ApiIssue { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._head(resourceGroupName, serviceName, apiId, issueId, options, (err, result, request, response) => { + self._getEntityTag(resourceGroupName, serviceName, apiId, issueId, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._head(resourceGroupName, serviceName, apiId, issueId, options, optionalCallback); + return self._getEntityTag(resourceGroupName, serviceName, apiId, issueId, options, optionalCallback); } } diff --git a/lib/services/apimanagement/lib/operations/apiIssueAttachment.js b/lib/services/apimanagement/lib/operations/apiIssueAttachment.js index f24510df3f..227dac18a5 100644 --- a/lib/services/apimanagement/lib/operations/apiIssueAttachment.js +++ b/lib/services/apimanagement/lib/operations/apiIssueAttachment.js @@ -295,7 +295,7 @@ function _listByService(resourceGroupName, serviceName, apiId, issueId, options, * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _head(resourceGroupName, serviceName, apiId, issueId, attachmentId, options, callback) { +function _getEntityTag(resourceGroupName, serviceName, apiId, issueId, attachmentId, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -1154,7 +1154,7 @@ function _deleteMethod(resourceGroupName, serviceName, apiId, issueId, attachmen return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 204) { + if (statusCode !== 200 && statusCode !== 204) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -1326,7 +1326,7 @@ class ApiIssueAttachment { constructor(client) { this.client = client; this._listByService = _listByService; - this._head = _head; + this._getEntityTag = _getEntityTag; this._get = _get; this._createOrUpdate = _createOrUpdate; this._deleteMethod = _deleteMethod; @@ -1482,11 +1482,11 @@ class ApiIssueAttachment { * * @reject {Error} - The error object. */ - headWithHttpOperationResponse(resourceGroupName, serviceName, apiId, issueId, attachmentId, options) { + getEntityTagWithHttpOperationResponse(resourceGroupName, serviceName, apiId, issueId, attachmentId, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._head(resourceGroupName, serviceName, apiId, issueId, attachmentId, options, (err, result, request, response) => { + self._getEntityTag(resourceGroupName, serviceName, apiId, issueId, attachmentId, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -1539,7 +1539,7 @@ class ApiIssueAttachment { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - head(resourceGroupName, serviceName, apiId, issueId, attachmentId, options, optionalCallback) { + getEntityTag(resourceGroupName, serviceName, apiId, issueId, attachmentId, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -1548,14 +1548,14 @@ class ApiIssueAttachment { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._head(resourceGroupName, serviceName, apiId, issueId, attachmentId, options, (err, result, request, response) => { + self._getEntityTag(resourceGroupName, serviceName, apiId, issueId, attachmentId, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._head(resourceGroupName, serviceName, apiId, issueId, attachmentId, options, optionalCallback); + return self._getEntityTag(resourceGroupName, serviceName, apiId, issueId, attachmentId, options, optionalCallback); } } diff --git a/lib/services/apimanagement/lib/operations/apiIssueComment.js b/lib/services/apimanagement/lib/operations/apiIssueComment.js index 4029236dbf..91997c41ee 100644 --- a/lib/services/apimanagement/lib/operations/apiIssueComment.js +++ b/lib/services/apimanagement/lib/operations/apiIssueComment.js @@ -295,7 +295,7 @@ function _listByService(resourceGroupName, serviceName, apiId, issueId, options, * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _head(resourceGroupName, serviceName, apiId, issueId, commentId, options, callback) { +function _getEntityTag(resourceGroupName, serviceName, apiId, issueId, commentId, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -1150,7 +1150,7 @@ function _deleteMethod(resourceGroupName, serviceName, apiId, issueId, commentId return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 204) { + if (statusCode !== 200 && statusCode !== 204) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -1322,7 +1322,7 @@ class ApiIssueComment { constructor(client) { this.client = client; this._listByService = _listByService; - this._head = _head; + this._getEntityTag = _getEntityTag; this._get = _get; this._createOrUpdate = _createOrUpdate; this._deleteMethod = _deleteMethod; @@ -1478,11 +1478,11 @@ class ApiIssueComment { * * @reject {Error} - The error object. */ - headWithHttpOperationResponse(resourceGroupName, serviceName, apiId, issueId, commentId, options) { + getEntityTagWithHttpOperationResponse(resourceGroupName, serviceName, apiId, issueId, commentId, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._head(resourceGroupName, serviceName, apiId, issueId, commentId, options, (err, result, request, response) => { + self._getEntityTag(resourceGroupName, serviceName, apiId, issueId, commentId, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -1535,7 +1535,7 @@ class ApiIssueComment { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - head(resourceGroupName, serviceName, apiId, issueId, commentId, options, optionalCallback) { + getEntityTag(resourceGroupName, serviceName, apiId, issueId, commentId, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -1544,14 +1544,14 @@ class ApiIssueComment { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._head(resourceGroupName, serviceName, apiId, issueId, commentId, options, (err, result, request, response) => { + self._getEntityTag(resourceGroupName, serviceName, apiId, issueId, commentId, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._head(resourceGroupName, serviceName, apiId, issueId, commentId, options, optionalCallback); + return self._getEntityTag(resourceGroupName, serviceName, apiId, issueId, commentId, options, optionalCallback); } } diff --git a/lib/services/apimanagement/lib/operations/index.d.ts b/lib/services/apimanagement/lib/operations/index.d.ts index bdfecfea76..91cfb380a4 100644 --- a/lib/services/apimanagement/lib/operations/index.d.ts +++ b/lib/services/apimanagement/lib/operations/index.d.ts @@ -5365,7 +5365,7 @@ export interface ApiIssue { * * @reject {Error|ServiceError} - The error object. */ - headWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getEntityTagWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Gets the entity state (Etag) version of the Issue for an API specified by @@ -5407,9 +5407,9 @@ export interface ApiIssue { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - head(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - head(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, callback: ServiceCallback): void; - head(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + getEntityTag(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getEntityTag(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, callback: ServiceCallback): void; + getEntityTag(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -5864,7 +5864,7 @@ export interface ApiIssueComment { * * @reject {Error|ServiceError} - The error object. */ - headWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getEntityTagWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Gets the entity state (Etag) version of the issue Comment for an API @@ -5909,9 +5909,9 @@ export interface ApiIssueComment { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - head(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - head(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, callback: ServiceCallback): void; - head(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + getEntityTag(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getEntityTag(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, callback: ServiceCallback): void; + getEntityTag(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -6371,7 +6371,7 @@ export interface ApiIssueAttachment { * * @reject {Error|ServiceError} - The error object. */ - headWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getEntityTagWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Gets the entity state (Etag) version of the issue Attachment for an API @@ -6416,9 +6416,9 @@ export interface ApiIssueAttachment { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - head(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - head(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, callback: ServiceCallback): void; - head(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + getEntityTag(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getEntityTag(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, callback: ServiceCallback): void; + getEntityTag(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** From 7bd148dc528c795e7c7161634273ce169108be56 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 19 Jun 2018 11:42:14 -0700 Subject: [PATCH 6/8] Generated from 40858f2b62c42577e6d834ceac599d41fdcc08d3 (#3022) Fix the validation Check for apiId parameter in the productapis --- .../apimanagement/lib/models/errorResponse.js | 8 +-- .../apimanagement/lib/models/index.d.ts | 2 +- .../apimanagement/lib/operations/index.d.ts | 30 ++++---- .../lib/operations/productApi.js | 69 +++++++++++-------- lib/services/apimanagement/package.json | 7 +- 5 files changed, 67 insertions(+), 49 deletions(-) diff --git a/lib/services/apimanagement/lib/models/errorResponse.js b/lib/services/apimanagement/lib/models/errorResponse.js index d3cf803b2c..2e1010e017 100644 --- a/lib/services/apimanagement/lib/models/errorResponse.js +++ b/lib/services/apimanagement/lib/models/errorResponse.js @@ -13,7 +13,7 @@ const models = require('./index'); /** - * Error Body contract. + * Error Response. * */ class ErrorResponse { @@ -44,21 +44,21 @@ class ErrorResponse { modelProperties: { code: { required: false, - serializedName: 'code', + serializedName: 'error.code', type: { name: 'String' } }, message: { required: false, - serializedName: 'message', + serializedName: 'error.message', type: { name: 'String' } }, details: { required: false, - serializedName: 'details', + serializedName: 'error.details', type: { name: 'Sequence', element: { diff --git a/lib/services/apimanagement/lib/models/index.d.ts b/lib/services/apimanagement/lib/models/index.d.ts index 373f0ed690..6e87acd473 100644 --- a/lib/services/apimanagement/lib/models/index.d.ts +++ b/lib/services/apimanagement/lib/models/index.d.ts @@ -37,7 +37,7 @@ export interface ErrorFieldContract { * @class * Initializes a new instance of the ErrorResponse class. * @constructor - * Error Body contract. + * Error Response. * * @member {string} [code] Service-defined error code. This code serves as a * sub-status for the HTTP error code specified in the response. diff --git a/lib/services/apimanagement/lib/operations/index.d.ts b/lib/services/apimanagement/lib/operations/index.d.ts index 91cfb380a4..ce7958e0f4 100644 --- a/lib/services/apimanagement/lib/operations/index.d.ts +++ b/lib/services/apimanagement/lib/operations/index.d.ts @@ -17813,8 +17813,9 @@ export interface ProductApi { * @param {string} productId Product identifier. Must be unique in the current * API Management service instance. * - * @param {string} apiId API identifier. Must be unique in the current API - * Management service instance. + * @param {string} apiId API revision identifier. Must be unique in the current + * API Management service instance. Non-current revision has ;rev=n as a suffix + * where n is the revision number. * * @param {object} [options] Optional Parameters. * @@ -17840,8 +17841,9 @@ export interface ProductApi { * @param {string} productId Product identifier. Must be unique in the current * API Management service instance. * - * @param {string} apiId API identifier. Must be unique in the current API - * Management service instance. + * @param {string} apiId API revision identifier. Must be unique in the current + * API Management service instance. Non-current revision has ;rev=n as a suffix + * where n is the revision number. * * @param {object} [options] Optional Parameters. * @@ -17884,8 +17886,9 @@ export interface ProductApi { * @param {string} productId Product identifier. Must be unique in the current * API Management service instance. * - * @param {string} apiId API identifier. Must be unique in the current API - * Management service instance. + * @param {string} apiId API revision identifier. Must be unique in the current + * API Management service instance. Non-current revision has ;rev=n as a suffix + * where n is the revision number. * * @param {object} [options] Optional Parameters. * @@ -17910,8 +17913,9 @@ export interface ProductApi { * @param {string} productId Product identifier. Must be unique in the current * API Management service instance. * - * @param {string} apiId API identifier. Must be unique in the current API - * Management service instance. + * @param {string} apiId API revision identifier. Must be unique in the current + * API Management service instance. Non-current revision has ;rev=n as a suffix + * where n is the revision number. * * @param {object} [options] Optional Parameters. * @@ -17955,8 +17959,9 @@ export interface ProductApi { * @param {string} productId Product identifier. Must be unique in the current * API Management service instance. * - * @param {string} apiId API identifier. Must be unique in the current API - * Management service instance. + * @param {string} apiId API revision identifier. Must be unique in the current + * API Management service instance. Non-current revision has ;rev=n as a suffix + * where n is the revision number. * * @param {object} [options] Optional Parameters. * @@ -17981,8 +17986,9 @@ export interface ProductApi { * @param {string} productId Product identifier. Must be unique in the current * API Management service instance. * - * @param {string} apiId API identifier. Must be unique in the current API - * Management service instance. + * @param {string} apiId API revision identifier. Must be unique in the current + * API Management service instance. Non-current revision has ;rev=n as a suffix + * where n is the revision number. * * @param {object} [options] Optional Parameters. * diff --git a/lib/services/apimanagement/lib/operations/productApi.js b/lib/services/apimanagement/lib/operations/productApi.js index 703eaee0bf..4499b5e506 100644 --- a/lib/services/apimanagement/lib/operations/productApi.js +++ b/lib/services/apimanagement/lib/operations/productApi.js @@ -258,8 +258,9 @@ function _listByProduct(resourceGroupName, serviceName, productId, options, call * @param {string} productId Product identifier. Must be unique in the current * API Management service instance. * - * @param {string} apiId API identifier. Must be unique in the current API - * Management service instance. + * @param {string} apiId API revision identifier. Must be unique in the current + * API Management service instance. Non-current revision has ;rev=n as a suffix + * where n is the revision number. * * @param {object} [options] Optional Parameters. * @@ -331,17 +332,17 @@ function _checkEntityExists(resourceGroupName, serviceName, productId, apiId, op 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) + if (apiId.length > 256) { - throw new Error('"apiId" should satisfy the constraint - "MaxLength": 80'); + throw new Error('"apiId" should satisfy the constraint - "MaxLength": 256'); } if (apiId.length < 1) { throw new Error('"apiId" should satisfy the constraint - "MinLength": 1'); } - if (apiId.match(/(^[\w]+$)|(^[\w][\w\-]+[\w]$)/) === null) + if (apiId.match(/^[^*#&+:<>?]+$/) === null) { - throw new Error('"apiId" should satisfy the constraint - "Pattern": /(^[\w]+$)|(^[\w][\w\-]+[\w]$)/'); + throw new Error('"apiId" should satisfy the constraint - "Pattern": /^[^*#&+:<>?]+$/'); } } if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { @@ -443,8 +444,9 @@ function _checkEntityExists(resourceGroupName, serviceName, productId, apiId, op * @param {string} productId Product identifier. Must be unique in the current * API Management service instance. * - * @param {string} apiId API identifier. Must be unique in the current API - * Management service instance. + * @param {string} apiId API revision identifier. Must be unique in the current + * API Management service instance. Non-current revision has ;rev=n as a suffix + * where n is the revision number. * * @param {object} [options] Optional Parameters. * @@ -517,17 +519,17 @@ function _createOrUpdate(resourceGroupName, serviceName, productId, apiId, optio 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) + if (apiId.length > 256) { - throw new Error('"apiId" should satisfy the constraint - "MaxLength": 80'); + throw new Error('"apiId" should satisfy the constraint - "MaxLength": 256'); } if (apiId.length < 1) { throw new Error('"apiId" should satisfy the constraint - "MinLength": 1'); } - if (apiId.match(/(^[\w]+$)|(^[\w][\w\-]+[\w]$)/) === null) + if (apiId.match(/^[^*#&+:<>?]+$/) === null) { - throw new Error('"apiId" should satisfy the constraint - "Pattern": /(^[\w]+$)|(^[\w][\w\-]+[\w]$)/'); + throw new Error('"apiId" should satisfy the constraint - "Pattern": /^[^*#&+:<>?]+$/'); } } if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { @@ -662,8 +664,9 @@ function _createOrUpdate(resourceGroupName, serviceName, productId, apiId, optio * @param {string} productId Product identifier. Must be unique in the current * API Management service instance. * - * @param {string} apiId API identifier. Must be unique in the current API - * Management service instance. + * @param {string} apiId API revision identifier. Must be unique in the current + * API Management service instance. Non-current revision has ;rev=n as a suffix + * where n is the revision number. * * @param {object} [options] Optional Parameters. * @@ -735,17 +738,17 @@ function _deleteMethod(resourceGroupName, serviceName, productId, apiId, options 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) + if (apiId.length > 256) { - throw new Error('"apiId" should satisfy the constraint - "MaxLength": 80'); + throw new Error('"apiId" should satisfy the constraint - "MaxLength": 256'); } if (apiId.length < 1) { throw new Error('"apiId" should satisfy the constraint - "MinLength": 1'); } - if (apiId.match(/(^[\w]+$)|(^[\w][\w\-]+[\w]$)/) === null) + if (apiId.match(/^[^*#&+:<>?]+$/) === null) { - throw new Error('"apiId" should satisfy the constraint - "Pattern": /(^[\w]+$)|(^[\w][\w\-]+[\w]$)/'); + throw new Error('"apiId" should satisfy the constraint - "Pattern": /^[^*#&+:<>?]+$/'); } } if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { @@ -1120,8 +1123,9 @@ class ProductApi { * @param {string} productId Product identifier. Must be unique in the current * API Management service instance. * - * @param {string} apiId API identifier. Must be unique in the current API - * Management service instance. + * @param {string} apiId API revision identifier. Must be unique in the current + * API Management service instance. Non-current revision has ;rev=n as a suffix + * where n is the revision number. * * @param {object} [options] Optional Parameters. * @@ -1159,8 +1163,9 @@ class ProductApi { * @param {string} productId Product identifier. Must be unique in the current * API Management service instance. * - * @param {string} apiId API identifier. Must be unique in the current API - * Management service instance. + * @param {string} apiId API revision identifier. Must be unique in the current + * API Management service instance. Non-current revision has ;rev=n as a suffix + * where n is the revision number. * * @param {object} [options] Optional Parameters. * @@ -1218,8 +1223,9 @@ class ProductApi { * @param {string} productId Product identifier. Must be unique in the current * API Management service instance. * - * @param {string} apiId API identifier. Must be unique in the current API - * Management service instance. + * @param {string} apiId API revision identifier. Must be unique in the current + * API Management service instance. Non-current revision has ;rev=n as a suffix + * where n is the revision number. * * @param {object} [options] Optional Parameters. * @@ -1256,8 +1262,9 @@ class ProductApi { * @param {string} productId Product identifier. Must be unique in the current * API Management service instance. * - * @param {string} apiId API identifier. Must be unique in the current API - * Management service instance. + * @param {string} apiId API revision identifier. Must be unique in the current + * API Management service instance. Non-current revision has ;rev=n as a suffix + * where n is the revision number. * * @param {object} [options] Optional Parameters. * @@ -1316,8 +1323,9 @@ class ProductApi { * @param {string} productId Product identifier. Must be unique in the current * API Management service instance. * - * @param {string} apiId API identifier. Must be unique in the current API - * Management service instance. + * @param {string} apiId API revision identifier. Must be unique in the current + * API Management service instance. Non-current revision has ;rev=n as a suffix + * where n is the revision number. * * @param {object} [options] Optional Parameters. * @@ -1354,8 +1362,9 @@ class ProductApi { * @param {string} productId Product identifier. Must be unique in the current * API Management service instance. * - * @param {string} apiId API identifier. Must be unique in the current API - * Management service instance. + * @param {string} apiId API revision identifier. Must be unique in the current + * API Management service instance. Non-current revision has ;rev=n as a suffix + * where n is the revision number. * * @param {object} [options] Optional Parameters. * diff --git a/lib/services/apimanagement/package.json b/lib/services/apimanagement/package.json index 73d1daed63..ffc18487c6 100644 --- a/lib/services/apimanagement/package.json +++ b/lib/services/apimanagement/package.json @@ -4,10 +4,13 @@ "description": "ApiManagementClient Library with typescript type definitions for node", "version": "2.1.0-preview", "dependencies": { - "ms-rest": "^2.3.2", + "ms-rest": "^2.3.3", "ms-rest-azure": "^2.5.5" }, - "keywords": [ "node", "azure" ], + "keywords": [ + "node", + "azure" + ], "license": "MIT", "main": "./lib/apiManagementClient.js", "types": "./lib/apiManagementClient.d.ts", From 030ee2686700e5e4e2db7d14f4bdaf53120fdaa7 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 20 Jun 2018 14:35:20 -0700 Subject: [PATCH 7/8] Generated from 098c87d37f661c1aa51916e5dd2026aa1902c806 (#3033) Fix contract for Error in OperationResultContract --- .../lib/models/errorResponseBody.js | 80 +++++++++++++++++++ .../apimanagement/lib/models/index.d.ts | 20 ++++- .../apimanagement/lib/models/index.js | 1 + .../lib/models/operationResultContract.js | 2 +- 4 files changed, 101 insertions(+), 2 deletions(-) create mode 100644 lib/services/apimanagement/lib/models/errorResponseBody.js diff --git a/lib/services/apimanagement/lib/models/errorResponseBody.js b/lib/services/apimanagement/lib/models/errorResponseBody.js new file mode 100644 index 0000000000..f9a0d6a597 --- /dev/null +++ b/lib/services/apimanagement/lib/models/errorResponseBody.js @@ -0,0 +1,80 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Error Body contract. + * + */ +class ErrorResponseBody { + /** + * Create a ErrorResponseBody. + * @member {string} [code] Service-defined error code. This code serves as a + * sub-status for the HTTP error code specified in the response. + * @member {string} [message] Human-readable representation of the error. + * @member {array} [details] The list of invalid fields send in request, in + * case of validation error. + */ + constructor() { + } + + /** + * Defines the metadata of ErrorResponseBody + * + * @returns {object} metadata of ErrorResponseBody + * + */ + mapper() { + return { + required: false, + serializedName: 'ErrorResponseBody', + type: { + name: 'Composite', + className: 'ErrorResponseBody', + modelProperties: { + code: { + required: false, + serializedName: 'code', + type: { + name: 'String' + } + }, + message: { + required: false, + serializedName: 'message', + type: { + name: 'String' + } + }, + details: { + required: false, + serializedName: 'details', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ErrorFieldContractElementType', + type: { + name: 'Composite', + className: 'ErrorFieldContract' + } + } + } + } + } + } + }; + } +} + +module.exports = ErrorResponseBody; diff --git a/lib/services/apimanagement/lib/models/index.d.ts b/lib/services/apimanagement/lib/models/index.d.ts index 6e87acd473..47e251908e 100644 --- a/lib/services/apimanagement/lib/models/index.d.ts +++ b/lib/services/apimanagement/lib/models/index.d.ts @@ -33,6 +33,24 @@ export interface ErrorFieldContract { target?: string; } +/** + * @class + * Initializes a new instance of the ErrorResponseBody class. + * @constructor + * Error Body contract. + * + * @member {string} [code] Service-defined error code. This code serves as a + * sub-status for the HTTP error code specified in the response. + * @member {string} [message] Human-readable representation of the error. + * @member {array} [details] The list of invalid fields send in request, in + * case of validation error. + */ +export interface ErrorResponseBody { + code?: string; + message?: string; + details?: ErrorFieldContract[]; +} + /** * @class * Initializes a new instance of the ErrorResponse class. @@ -3644,7 +3662,7 @@ export interface OperationResultContract { started?: Date; updated?: Date; resultInfo?: string; - error?: ErrorResponse; + error?: ErrorResponseBody; readonly actionLog?: OperationResultLogItemContract[]; } diff --git a/lib/services/apimanagement/lib/models/index.js b/lib/services/apimanagement/lib/models/index.js index b9fcf111c0..4ff350f27d 100644 --- a/lib/services/apimanagement/lib/models/index.js +++ b/lib/services/apimanagement/lib/models/index.js @@ -19,6 +19,7 @@ var msRestAzure = require('ms-rest-azure'); exports.BaseResource = msRestAzure.BaseResource; exports.CloudError = msRestAzure.CloudError; exports.ErrorFieldContract = require('./errorFieldContract'); +exports.ErrorResponseBody = require('./errorResponseBody'); exports.ErrorResponse = require('./errorResponse'); exports.Resource = require('./resource'); exports.PolicyContract = require('./policyContract'); diff --git a/lib/services/apimanagement/lib/models/operationResultContract.js b/lib/services/apimanagement/lib/models/operationResultContract.js index 180a5244e3..75fbe9f977 100644 --- a/lib/services/apimanagement/lib/models/operationResultContract.js +++ b/lib/services/apimanagement/lib/models/operationResultContract.js @@ -99,7 +99,7 @@ class OperationResultContract { serializedName: 'error', type: { name: 'Composite', - className: 'ErrorResponse' + className: 'ErrorResponseBody' } }, actionLog: { From d3d7ff935f95fbacbc575c1a04200932ce579552 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 26 Jun 2018 16:40:58 -0700 Subject: [PATCH 8/8] [AutoPR apimanagement/resource-manager] [API Management] New Api version introduced along with new contracts for the Diagnostics resource (#2919) * Generated from 5961b92ee6004e4b0874ecd18b2a71b8d91efcf6 New contracts for the Diagnostic resource * Generated from 7050094d3c52c0d5945f4ec3bb7c876965571840 retrigger downstream CI jobs * Generated from ce0aafdbf5af1e3a55c8a79eac903bf7a1503631 Sync up changes with 2018-01-01 * Generated from 401662d988ac8f2d301517bc87aab34b443946e2 Fixing the linter error --- .../lib/apiManagementClient.d.ts | 2 - .../apimanagement/lib/apiManagementClient.js | 4 +- .../lib/models/bodyDiagnosticSettings.js | 55 + .../lib/models/diagnosticContract.js | 71 +- .../lib/models/httpMessageDiagnostic.js | 71 + .../apimanagement/lib/models/index.d.ts | 179 +- .../apimanagement/lib/models/index.js | 8 +- .../lib/models/loggerContract.js | 9 + .../lib/models/pipelineDiagnosticSettings.js | 71 + .../lib/models/productContract.js | 6 +- .../lib/models/productEntityBaseParameters.js | 6 +- .../lib/models/productUpdateParameters.js | 6 +- .../lib/models/samplingSettings.js | 65 + .../lib/operations/apiDiagnostic.js | 204 +- .../lib/operations/diagnostic.js | 204 +- .../apimanagement/lib/operations/index.d.ts | 4116 ++++++++--------- .../apimanagement/lib/operations/index.js | 2 - .../apimanagement/lib/operations/logger.js | 9 + .../apimanagement/lib/operations/product.js | 36 +- 19 files changed, 2706 insertions(+), 2418 deletions(-) create mode 100644 lib/services/apimanagement/lib/models/bodyDiagnosticSettings.js create mode 100644 lib/services/apimanagement/lib/models/httpMessageDiagnostic.js create mode 100644 lib/services/apimanagement/lib/models/pipelineDiagnosticSettings.js create mode 100644 lib/services/apimanagement/lib/models/samplingSettings.js diff --git a/lib/services/apimanagement/lib/apiManagementClient.d.ts b/lib/services/apimanagement/lib/apiManagementClient.d.ts index 26d482185f..73b1e13821 100644 --- a/lib/services/apimanagement/lib/apiManagementClient.d.ts +++ b/lib/services/apimanagement/lib/apiManagementClient.d.ts @@ -68,7 +68,6 @@ export default class ApiManagementClient extends AzureServiceClient { apiPolicy: operations.ApiPolicy; apiSchema: operations.ApiSchema; apiDiagnostic: operations.ApiDiagnostic; - apiDiagnosticLogger: operations.ApiDiagnosticLogger; apiIssue: operations.ApiIssue; apiIssueComment: operations.ApiIssueComment; apiIssueAttachment: operations.ApiIssueAttachment; @@ -78,7 +77,6 @@ export default class ApiManagementClient extends AzureServiceClient { apiManagementOperations: operations.ApiManagementOperations; apiManagementService: operations.ApiManagementService; diagnostic: operations.Diagnostic; - diagnosticLogger: operations.DiagnosticLogger; emailTemplate: operations.EmailTemplate; group: operations.Group; groupUser: operations.GroupUser; diff --git a/lib/services/apimanagement/lib/apiManagementClient.js b/lib/services/apimanagement/lib/apiManagementClient.js index c403e04db5..a0a89663bb 100644 --- a/lib/services/apimanagement/lib/apiManagementClient.js +++ b/lib/services/apimanagement/lib/apiManagementClient.js @@ -50,7 +50,7 @@ class ApiManagementClient extends ServiceClient { super(credentials, options); - this.apiVersion = '2018-01-01'; + this.apiVersion = '2018-06-01-preview'; this.acceptLanguage = 'en-US'; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; @@ -84,7 +84,6 @@ class ApiManagementClient extends ServiceClient { this.apiPolicy = new operations.ApiPolicy(this); this.apiSchema = new operations.ApiSchema(this); this.apiDiagnostic = new operations.ApiDiagnostic(this); - this.apiDiagnosticLogger = new operations.ApiDiagnosticLogger(this); this.apiIssue = new operations.ApiIssue(this); this.apiIssueComment = new operations.ApiIssueComment(this); this.apiIssueAttachment = new operations.ApiIssueAttachment(this); @@ -94,7 +93,6 @@ class ApiManagementClient extends ServiceClient { this.apiManagementOperations = new operations.ApiManagementOperations(this); this.apiManagementService = new operations.ApiManagementService(this); this.diagnostic = new operations.Diagnostic(this); - this.diagnosticLogger = new operations.DiagnosticLogger(this); this.emailTemplate = new operations.EmailTemplate(this); this.group = new operations.Group(this); this.groupUser = new operations.GroupUser(this); diff --git a/lib/services/apimanagement/lib/models/bodyDiagnosticSettings.js b/lib/services/apimanagement/lib/models/bodyDiagnosticSettings.js new file mode 100644 index 0000000000..9dc1602417 --- /dev/null +++ b/lib/services/apimanagement/lib/models/bodyDiagnosticSettings.js @@ -0,0 +1,55 @@ +/* + * 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'; + +/** + * Body logging settings. + * + */ +class BodyDiagnosticSettings { + /** + * Create a BodyDiagnosticSettings. + * @member {number} [bytes] Number of request body bytes to log. + */ + constructor() { + } + + /** + * Defines the metadata of BodyDiagnosticSettings + * + * @returns {object} metadata of BodyDiagnosticSettings + * + */ + mapper() { + return { + required: false, + serializedName: 'BodyDiagnosticSettings', + type: { + name: 'Composite', + className: 'BodyDiagnosticSettings', + modelProperties: { + bytes: { + required: false, + serializedName: 'bytes', + constraints: { + InclusiveMaximum: 8192 + }, + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = BodyDiagnosticSettings; diff --git a/lib/services/apimanagement/lib/models/diagnosticContract.js b/lib/services/apimanagement/lib/models/diagnosticContract.js index 5b579c4b44..ea4ed43341 100644 --- a/lib/services/apimanagement/lib/models/diagnosticContract.js +++ b/lib/services/apimanagement/lib/models/diagnosticContract.js @@ -20,8 +20,38 @@ const models = require('./index'); class DiagnosticContract extends models['Resource'] { /** * Create a DiagnosticContract. - * @member {boolean} enabled Indicates whether a diagnostic should receive - * data or not. + * @member {string} [alwaysLog] Specifies for what type of messages sampling + * settings should not apply. Possible values include: 'allErrors' + * @member {string} loggerId Resource Id of a target logger. + * @member {object} [sampling] Sampling settings for Diagnostic. + * @member {string} [sampling.samplingType] Sampling type. Possible values + * include: 'fixed' + * @member {number} [sampling.percentage] Rate of sampling for fixed-rate + * sampling. + * @member {object} [frontend] Diagnostic settings for incoming/outcoming + * HTTP messages to the Gateway. + * @member {object} [frontend.request] Diagnostic settings for request. + * @member {array} [frontend.request.headers] Array of HTTP Headers to log. + * @member {object} [frontend.request.body] Body logging settings. + * @member {number} [frontend.request.body.bytes] Number of request body + * bytes to log. + * @member {object} [frontend.response] Diagnostic settings for response. + * @member {array} [frontend.response.headers] Array of HTTP Headers to log. + * @member {object} [frontend.response.body] Body logging settings. + * @member {number} [frontend.response.body.bytes] Number of request body + * bytes to log. + * @member {object} [backend] Diagnostic settings for incoming/outcoming HTTP + * messages to the Backend + * @member {object} [backend.request] Diagnostic settings for request. + * @member {array} [backend.request.headers] Array of HTTP Headers to log. + * @member {object} [backend.request.body] Body logging settings. + * @member {number} [backend.request.body.bytes] Number of request body bytes + * to log. + * @member {object} [backend.response] Diagnostic settings for response. + * @member {array} [backend.response.headers] Array of HTTP Headers to log. + * @member {object} [backend.response.body] Body logging settings. + * @member {number} [backend.response.body.bytes] Number of request body + * bytes to log. */ constructor() { super(); @@ -65,11 +95,42 @@ class DiagnosticContract extends models['Resource'] { name: 'String' } }, - enabled: { + alwaysLog: { + required: false, + serializedName: 'properties.alwaysLog', + type: { + name: 'String' + } + }, + loggerId: { required: true, - serializedName: 'properties.enabled', + serializedName: 'properties.loggerId', + type: { + name: 'String' + } + }, + sampling: { + required: false, + serializedName: 'properties.sampling', + type: { + name: 'Composite', + className: 'SamplingSettings' + } + }, + frontend: { + required: false, + serializedName: 'properties.frontend', + type: { + name: 'Composite', + className: 'PipelineDiagnosticSettings' + } + }, + backend: { + required: false, + serializedName: 'properties.backend', type: { - name: 'Boolean' + name: 'Composite', + className: 'PipelineDiagnosticSettings' } } } diff --git a/lib/services/apimanagement/lib/models/httpMessageDiagnostic.js b/lib/services/apimanagement/lib/models/httpMessageDiagnostic.js new file mode 100644 index 0000000000..83fa2c3e9e --- /dev/null +++ b/lib/services/apimanagement/lib/models/httpMessageDiagnostic.js @@ -0,0 +1,71 @@ +/* + * 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'); + +/** + * Http message diagnostic settings. + * + */ +class HttpMessageDiagnostic { + /** + * Create a HttpMessageDiagnostic. + * @member {array} [headers] Array of HTTP Headers to log. + * @member {object} [body] Body logging settings. + * @member {number} [body.bytes] Number of request body bytes to log. + */ + constructor() { + } + + /** + * Defines the metadata of HttpMessageDiagnostic + * + * @returns {object} metadata of HttpMessageDiagnostic + * + */ + mapper() { + return { + required: false, + serializedName: 'HttpMessageDiagnostic', + type: { + name: 'Composite', + className: 'HttpMessageDiagnostic', + modelProperties: { + headers: { + required: false, + serializedName: 'headers', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + body: { + required: false, + serializedName: 'body', + type: { + name: 'Composite', + className: 'BodyDiagnosticSettings' + } + } + } + } + }; + } +} + +module.exports = HttpMessageDiagnostic; diff --git a/lib/services/apimanagement/lib/models/index.d.ts b/lib/services/apimanagement/lib/models/index.d.ts index 47e251908e..fa17e54689 100644 --- a/lib/services/apimanagement/lib/models/index.d.ts +++ b/lib/services/apimanagement/lib/models/index.d.ts @@ -914,24 +914,64 @@ export interface IssueAttachmentContract extends Resource { /** * @class - * Initializes a new instance of the LoggerContract class. + * Initializes a new instance of the BodyDiagnosticSettings class. * @constructor - * Logger details. + * Body logging settings. * - * @member {string} loggerType Logger type. Possible values include: - * 'azureEventHub', 'applicationInsights' - * @member {string} [description] Logger description. - * @member {object} credentials The name and SendRule connection string of the - * event hub for azureEventHub logger. - * Instrumentation key for applicationInsights logger. - * @member {boolean} [isBuffered] Whether records are buffered in the logger - * before publishing. Default is assumed to be true. + * @member {number} [bytes] Number of request body bytes to log. */ -export interface LoggerContract extends Resource { - loggerType: string; - description?: string; - credentials: { [propertyName: string]: string }; - isBuffered?: boolean; +export interface BodyDiagnosticSettings { + bytes?: number; +} + +/** + * @class + * Initializes a new instance of the HttpMessageDiagnostic class. + * @constructor + * Http message diagnostic settings. + * + * @member {array} [headers] Array of HTTP Headers to log. + * @member {object} [body] Body logging settings. + * @member {number} [body.bytes] Number of request body bytes to log. + */ +export interface HttpMessageDiagnostic { + headers?: string[]; + body?: BodyDiagnosticSettings; +} + +/** + * @class + * Initializes a new instance of the PipelineDiagnosticSettings class. + * @constructor + * Diagnostic settings for incoming/outcoming HTTP messages to the Gateway. + * + * @member {object} [request] Diagnostic settings for request. + * @member {array} [request.headers] Array of HTTP Headers to log. + * @member {object} [request.body] Body logging settings. + * @member {number} [request.body.bytes] Number of request body bytes to log. + * @member {object} [response] Diagnostic settings for response. + * @member {array} [response.headers] Array of HTTP Headers to log. + * @member {object} [response.body] Body logging settings. + * @member {number} [response.body.bytes] Number of request body bytes to log. + */ +export interface PipelineDiagnosticSettings { + request?: HttpMessageDiagnostic; + response?: HttpMessageDiagnostic; +} + +/** + * @class + * Initializes a new instance of the SamplingSettings class. + * @constructor + * Sampling settings for Diagnostic. + * + * @member {string} [samplingType] Sampling type. Possible values include: + * 'fixed' + * @member {number} [percentage] Rate of sampling for fixed-rate sampling. + */ +export interface SamplingSettings { + samplingType?: string; + percentage?: number; } /** @@ -940,11 +980,45 @@ export interface LoggerContract extends Resource { * @constructor * Diagnostic details. * - * @member {boolean} enabled Indicates whether a diagnostic should receive data - * or not. + * @member {string} [alwaysLog] Specifies for what type of messages sampling + * settings should not apply. Possible values include: 'allErrors' + * @member {string} loggerId Resource Id of a target logger. + * @member {object} [sampling] Sampling settings for Diagnostic. + * @member {string} [sampling.samplingType] Sampling type. Possible values + * include: 'fixed' + * @member {number} [sampling.percentage] Rate of sampling for fixed-rate + * sampling. + * @member {object} [frontend] Diagnostic settings for incoming/outcoming HTTP + * messages to the Gateway. + * @member {object} [frontend.request] Diagnostic settings for request. + * @member {array} [frontend.request.headers] Array of HTTP Headers to log. + * @member {object} [frontend.request.body] Body logging settings. + * @member {number} [frontend.request.body.bytes] Number of request body bytes + * to log. + * @member {object} [frontend.response] Diagnostic settings for response. + * @member {array} [frontend.response.headers] Array of HTTP Headers to log. + * @member {object} [frontend.response.body] Body logging settings. + * @member {number} [frontend.response.body.bytes] Number of request body bytes + * to log. + * @member {object} [backend] Diagnostic settings for incoming/outcoming HTTP + * messages to the Backend + * @member {object} [backend.request] Diagnostic settings for request. + * @member {array} [backend.request.headers] Array of HTTP Headers to log. + * @member {object} [backend.request.body] Body logging settings. + * @member {number} [backend.request.body.bytes] Number of request body bytes + * to log. + * @member {object} [backend.response] Diagnostic settings for response. + * @member {array} [backend.response.headers] Array of HTTP Headers to log. + * @member {object} [backend.response.body] Body logging settings. + * @member {number} [backend.response.body.bytes] Number of request body bytes + * to log. */ export interface DiagnosticContract extends Resource { - enabled: boolean; + alwaysLog?: string; + loggerId: string; + sampling?: SamplingSettings; + frontend?: PipelineDiagnosticSettings; + backend?: PipelineDiagnosticSettings; } /** @@ -966,13 +1040,13 @@ export interface DiagnosticContract extends Resource { * be made without a subscription key. If property is omitted when creating a * new product it's value is assumed to be true. * @member {boolean} [approvalRequired] whether subscription approval is - * required. If false, new subscriptions will be approved automatically + * required. If false, new subscriptions will be approved automatically * enabling developers to call the product’s APIs immediately after - * subscribing. If true, administrators must manually approve the subscription + * subscribing. If true, administrators must manually approve the subscription * before the developer can any of the product’s APIs. Can be present only if * subscriptionRequired property is present and has a value of false. * @member {number} [subscriptionsLimit] Whether the number of subscriptions a - * user can have to this product at the same time. Set to null or omit to allow + * user can have to this product at the same time. Set to null or omit to allow * unlimited per user subscriptions. Can be present only if * subscriptionRequired property is present and has a value of false. * @member {string} [state] whether product is published or not. Published @@ -1137,13 +1211,13 @@ export interface TagResourceContract { * be made without a subscription key. If property is omitted when creating a * new product it's value is assumed to be true. * @member {boolean} [approvalRequired] whether subscription approval is - * required. If false, new subscriptions will be approved automatically + * required. If false, new subscriptions will be approved automatically * enabling developers to call the product’s APIs immediately after - * subscribing. If true, administrators must manually approve the subscription + * subscribing. If true, administrators must manually approve the subscription * before the developer can any of the product’s APIs. Can be present only if * subscriptionRequired property is present and has a value of false. * @member {number} [subscriptionsLimit] Whether the number of subscriptions a - * user can have to this product at the same time. Set to null or omit to allow + * user can have to this product at the same time. Set to null or omit to allow * unlimited per user subscriptions. Can be present only if * subscriptionRequired property is present and has a value of false. * @member {string} [state] whether product is published or not. Published @@ -2736,6 +2810,31 @@ export interface IdentityProviderBaseParameters { passwordResetPolicyName?: string; } +/** + * @class + * Initializes a new instance of the LoggerContract class. + * @constructor + * Logger details. + * + * @member {string} loggerType Logger type. Possible values include: + * 'azureEventHub', 'applicationInsights' + * @member {string} [description] Logger description. + * @member {object} credentials The name and SendRule connection string of the + * event hub for azureEventHub logger. + * Instrumentation key for applicationInsights logger. + * @member {boolean} [isBuffered] Whether records are buffered in the logger + * before publishing. Default is assumed to be true. + * @member {string} [resourceId] Azure Resource Id of a log target (either + * Azure Event Hub resource or Azure Application Insights resource). + */ +export interface LoggerContract extends Resource { + loggerType: string; + description?: string; + credentials: { [propertyName: string]: string }; + isBuffered?: boolean; + resourceId?: string; +} + /** * @class * Initializes a new instance of the LoggerUpdateContract class. @@ -3068,13 +3167,13 @@ export interface PortalDelegationSettings extends Resource { * be made without a subscription key. If property is omitted when creating a * new product it's value is assumed to be true. * @member {boolean} [approvalRequired] whether subscription approval is - * required. If false, new subscriptions will be approved automatically + * required. If false, new subscriptions will be approved automatically * enabling developers to call the product’s APIs immediately after - * subscribing. If true, administrators must manually approve the subscription + * subscribing. If true, administrators must manually approve the subscription * before the developer can any of the product’s APIs. Can be present only if * subscriptionRequired property is present and has a value of false. * @member {number} [subscriptionsLimit] Whether the number of subscriptions a - * user can have to this product at the same time. Set to null or omit to allow + * user can have to this product at the same time. Set to null or omit to allow * unlimited per user subscriptions. Can be present only if * subscriptionRequired property is present and has a value of false. * @member {string} [state] whether product is published or not. Published @@ -3995,19 +4094,6 @@ export interface DiagnosticCollection extends Array { nextLink?: string; } -/** - * @class - * Initializes a new instance of the LoggerCollection class. - * @constructor - * Paged Logger list representation. - * - * @member {number} [count] Total record count number across all pages. - * @member {string} [nextLink] Next page link if any. - */ -export interface LoggerCollection extends Array { - nextLink?: string; -} - /** * @class * Initializes a new instance of the IssueCollection class. @@ -4156,6 +4242,19 @@ export interface IdentityProviderList extends Array { nextLink?: string; } +/** + * @class + * Initializes a new instance of the LoggerCollection class. + * @constructor + * Paged Logger list representation. + * + * @member {number} [count] Total record count number across all pages. + * @member {string} [nextLink] Next page link if any. + */ +export interface LoggerCollection extends Array { + nextLink?: string; +} + /** * @class * Initializes a new instance of the NotificationCollection class. diff --git a/lib/services/apimanagement/lib/models/index.js b/lib/services/apimanagement/lib/models/index.js index 4ff350f27d..373a0de75a 100644 --- a/lib/services/apimanagement/lib/models/index.js +++ b/lib/services/apimanagement/lib/models/index.js @@ -52,7 +52,10 @@ exports.SchemaContract = require('./schemaContract'); exports.IssueContract = require('./issueContract'); exports.IssueCommentContract = require('./issueCommentContract'); exports.IssueAttachmentContract = require('./issueAttachmentContract'); -exports.LoggerContract = require('./loggerContract'); +exports.BodyDiagnosticSettings = require('./bodyDiagnosticSettings'); +exports.HttpMessageDiagnostic = require('./httpMessageDiagnostic'); +exports.PipelineDiagnosticSettings = require('./pipelineDiagnosticSettings'); +exports.SamplingSettings = require('./samplingSettings'); exports.DiagnosticContract = require('./diagnosticContract'); exports.ProductEntityBaseParameters = require('./productEntityBaseParameters'); exports.ProductTagResourceContractProperties = require('./productTagResourceContractProperties'); @@ -112,6 +115,7 @@ exports.UserContract = require('./userContract'); exports.IdentityProviderContract = require('./identityProviderContract'); exports.IdentityProviderUpdateParameters = require('./identityProviderUpdateParameters'); exports.IdentityProviderBaseParameters = require('./identityProviderBaseParameters'); +exports.LoggerContract = require('./loggerContract'); exports.LoggerUpdateContract = require('./loggerUpdateContract'); exports.RecipientsContractProperties = require('./recipientsContractProperties'); exports.NotificationContract = require('./notificationContract'); @@ -171,7 +175,6 @@ exports.OperationCollection = require('./operationCollection'); exports.ProductCollection = require('./productCollection'); exports.SchemaCollection = require('./schemaCollection'); exports.DiagnosticCollection = require('./diagnosticCollection'); -exports.LoggerCollection = require('./loggerCollection'); exports.IssueCollection = require('./issueCollection'); exports.IssueCommentCollection = require('./issueCommentCollection'); exports.IssueAttachmentCollection = require('./issueAttachmentCollection'); @@ -184,6 +187,7 @@ exports.EmailTemplateCollection = require('./emailTemplateCollection'); exports.GroupCollection = require('./groupCollection'); exports.UserCollection = require('./userCollection'); exports.IdentityProviderList = require('./identityProviderList'); +exports.LoggerCollection = require('./loggerCollection'); exports.NotificationCollection = require('./notificationCollection'); exports.OpenIdConnectProviderCollection = require('./openIdConnectProviderCollection'); exports.SubscriptionCollection = require('./subscriptionCollection'); diff --git a/lib/services/apimanagement/lib/models/loggerContract.js b/lib/services/apimanagement/lib/models/loggerContract.js index ee0757f126..a042b7e48c 100644 --- a/lib/services/apimanagement/lib/models/loggerContract.js +++ b/lib/services/apimanagement/lib/models/loggerContract.js @@ -28,6 +28,8 @@ class LoggerContract extends models['Resource'] { * Instrumentation key for applicationInsights logger. * @member {boolean} [isBuffered] Whether records are buffered in the logger * before publishing. Default is assumed to be true. + * @member {string} [resourceId] Azure Resource Id of a log target (either + * Azure Event Hub resource or Azure Application Insights resource). */ constructor() { super(); @@ -108,6 +110,13 @@ class LoggerContract extends models['Resource'] { type: { name: 'Boolean' } + }, + resourceId: { + required: false, + serializedName: 'properties.resourceId', + type: { + name: 'String' + } } } } diff --git a/lib/services/apimanagement/lib/models/pipelineDiagnosticSettings.js b/lib/services/apimanagement/lib/models/pipelineDiagnosticSettings.js new file mode 100644 index 0000000000..7d9af6ef19 --- /dev/null +++ b/lib/services/apimanagement/lib/models/pipelineDiagnosticSettings.js @@ -0,0 +1,71 @@ +/* + * 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'); + +/** + * Diagnostic settings for incoming/outcoming HTTP messages to the Gateway. + * + */ +class PipelineDiagnosticSettings { + /** + * Create a PipelineDiagnosticSettings. + * @member {object} [request] Diagnostic settings for request. + * @member {array} [request.headers] Array of HTTP Headers to log. + * @member {object} [request.body] Body logging settings. + * @member {number} [request.body.bytes] Number of request body bytes to log. + * @member {object} [response] Diagnostic settings for response. + * @member {array} [response.headers] Array of HTTP Headers to log. + * @member {object} [response.body] Body logging settings. + * @member {number} [response.body.bytes] Number of request body bytes to + * log. + */ + constructor() { + } + + /** + * Defines the metadata of PipelineDiagnosticSettings + * + * @returns {object} metadata of PipelineDiagnosticSettings + * + */ + mapper() { + return { + required: false, + serializedName: 'PipelineDiagnosticSettings', + type: { + name: 'Composite', + className: 'PipelineDiagnosticSettings', + modelProperties: { + request: { + required: false, + serializedName: 'request', + type: { + name: 'Composite', + className: 'HttpMessageDiagnostic' + } + }, + response: { + required: false, + serializedName: 'response', + type: { + name: 'Composite', + className: 'HttpMessageDiagnostic' + } + } + } + } + }; + } +} + +module.exports = PipelineDiagnosticSettings; diff --git a/lib/services/apimanagement/lib/models/productContract.js b/lib/services/apimanagement/lib/models/productContract.js index dc7f6ed98a..fca049135d 100644 --- a/lib/services/apimanagement/lib/models/productContract.js +++ b/lib/services/apimanagement/lib/models/productContract.js @@ -33,14 +33,14 @@ class ProductContract extends models['Resource'] { * product can be made without a subscription key. If property is omitted * when creating a new product it's value is assumed to be true. * @member {boolean} [approvalRequired] whether subscription approval is - * required. If false, new subscriptions will be approved automatically + * required. If false, new subscriptions will be approved automatically * enabling developers to call the product’s APIs immediately after - * subscribing. If true, administrators must manually approve the + * subscribing. If true, administrators must manually approve the * subscription before the developer can any of the product’s APIs. Can be * present only if subscriptionRequired property is present and has a value * of false. * @member {number} [subscriptionsLimit] Whether the number of subscriptions - * a user can have to this product at the same time. Set to null or omit to + * a user can have to this product at the same time. Set to null or omit to * allow unlimited per user subscriptions. Can be present only if * subscriptionRequired property is present and has a value of false. * @member {string} [state] whether product is published or not. Published diff --git a/lib/services/apimanagement/lib/models/productEntityBaseParameters.js b/lib/services/apimanagement/lib/models/productEntityBaseParameters.js index 08db01346d..4b56443231 100644 --- a/lib/services/apimanagement/lib/models/productEntityBaseParameters.js +++ b/lib/services/apimanagement/lib/models/productEntityBaseParameters.js @@ -30,14 +30,14 @@ class ProductEntityBaseParameters { * product can be made without a subscription key. If property is omitted * when creating a new product it's value is assumed to be true. * @member {boolean} [approvalRequired] whether subscription approval is - * required. If false, new subscriptions will be approved automatically + * required. If false, new subscriptions will be approved automatically * enabling developers to call the product’s APIs immediately after - * subscribing. If true, administrators must manually approve the + * subscribing. If true, administrators must manually approve the * subscription before the developer can any of the product’s APIs. Can be * present only if subscriptionRequired property is present and has a value * of false. * @member {number} [subscriptionsLimit] Whether the number of subscriptions - * a user can have to this product at the same time. Set to null or omit to + * a user can have to this product at the same time. Set to null or omit to * allow unlimited per user subscriptions. Can be present only if * subscriptionRequired property is present and has a value of false. * @member {string} [state] whether product is published or not. Published diff --git a/lib/services/apimanagement/lib/models/productUpdateParameters.js b/lib/services/apimanagement/lib/models/productUpdateParameters.js index cfb98e6826..b28338ad9a 100644 --- a/lib/services/apimanagement/lib/models/productUpdateParameters.js +++ b/lib/services/apimanagement/lib/models/productUpdateParameters.js @@ -30,14 +30,14 @@ class ProductUpdateParameters { * product can be made without a subscription key. If property is omitted * when creating a new product it's value is assumed to be true. * @member {boolean} [approvalRequired] whether subscription approval is - * required. If false, new subscriptions will be approved automatically + * required. If false, new subscriptions will be approved automatically * enabling developers to call the product’s APIs immediately after - * subscribing. If true, administrators must manually approve the + * subscribing. If true, administrators must manually approve the * subscription before the developer can any of the product’s APIs. Can be * present only if subscriptionRequired property is present and has a value * of false. * @member {number} [subscriptionsLimit] Whether the number of subscriptions - * a user can have to this product at the same time. Set to null or omit to + * a user can have to this product at the same time. Set to null or omit to * allow unlimited per user subscriptions. Can be present only if * subscriptionRequired property is present and has a value of false. * @member {string} [state] whether product is published or not. Published diff --git a/lib/services/apimanagement/lib/models/samplingSettings.js b/lib/services/apimanagement/lib/models/samplingSettings.js new file mode 100644 index 0000000000..7d2959fdf4 --- /dev/null +++ b/lib/services/apimanagement/lib/models/samplingSettings.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'; + +/** + * Sampling settings for Diagnostic. + * + */ +class SamplingSettings { + /** + * Create a SamplingSettings. + * @member {string} [samplingType] Sampling type. Possible values include: + * 'fixed' + * @member {number} [percentage] Rate of sampling for fixed-rate sampling. + */ + constructor() { + } + + /** + * Defines the metadata of SamplingSettings + * + * @returns {object} metadata of SamplingSettings + * + */ + mapper() { + return { + required: false, + serializedName: 'SamplingSettings', + type: { + name: 'Composite', + className: 'SamplingSettings', + modelProperties: { + samplingType: { + required: false, + serializedName: 'samplingType', + type: { + name: 'String' + } + }, + percentage: { + required: false, + serializedName: 'percentage', + constraints: { + InclusiveMaximum: 100, + InclusiveMinimum: 0 + }, + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = SamplingSettings; diff --git a/lib/services/apimanagement/lib/operations/apiDiagnostic.js b/lib/services/apimanagement/lib/operations/apiDiagnostic.js index d2ab86b442..a1df89c1f4 100644 --- a/lib/services/apimanagement/lib/operations/apiDiagnostic.js +++ b/lib/services/apimanagement/lib/operations/apiDiagnostic.js @@ -639,8 +639,38 @@ function _get(resourceGroupName, serviceName, apiId, diagnosticId, options, call * * @param {object} parameters Create parameters. * - * @param {boolean} parameters.enabled Indicates whether a diagnostic should - * receive data or not. + * @param {string} [parameters.alwaysLog] Specifies for what type of messages + * sampling settings should not apply. Possible values include: 'allErrors' + * + * @param {string} parameters.loggerId Resource Id of a target logger. + * + * @param {object} [parameters.sampling] Sampling settings for Diagnostic. + * + * @param {string} [parameters.sampling.samplingType] Sampling type. Possible + * values include: 'fixed' + * + * @param {number} [parameters.sampling.percentage] Rate of sampling for + * fixed-rate sampling. + * + * @param {object} [parameters.frontend] Diagnostic settings for + * incoming/outcoming HTTP messages to the Gateway. + * + * @param {object} [parameters.backend] Diagnostic settings for + * incoming/outcoming HTTP messages to the Backend + * + * @param {object} [parameters.backend.request] Diagnostic settings for + * request. + * + * @param {object} [parameters.backend.response] Diagnostic settings for + * response. + * + * @param {array} [parameters.backend.response.headers] Array of HTTP Headers + * to log. + * + * @param {object} [parameters.backend.response.body] Body logging settings. + * + * @param {number} [parameters.backend.response.body.bytes] Number of request + * body bytes to log. * * @param {object} [options] Optional Parameters. * @@ -891,8 +921,38 @@ function _createOrUpdate(resourceGroupName, serviceName, apiId, diagnosticId, pa * * @param {object} parameters Diagnostic Update parameters. * - * @param {boolean} parameters.enabled Indicates whether a diagnostic should - * receive data or not. + * @param {string} [parameters.alwaysLog] Specifies for what type of messages + * sampling settings should not apply. Possible values include: 'allErrors' + * + * @param {string} parameters.loggerId Resource Id of a target logger. + * + * @param {object} [parameters.sampling] Sampling settings for Diagnostic. + * + * @param {string} [parameters.sampling.samplingType] Sampling type. Possible + * values include: 'fixed' + * + * @param {number} [parameters.sampling.percentage] Rate of sampling for + * fixed-rate sampling. + * + * @param {object} [parameters.frontend] Diagnostic settings for + * incoming/outcoming HTTP messages to the Gateway. + * + * @param {object} [parameters.backend] Diagnostic settings for + * incoming/outcoming HTTP messages to the Backend + * + * @param {object} [parameters.backend.request] Diagnostic settings for + * request. + * + * @param {object} [parameters.backend.response] Diagnostic settings for + * response. + * + * @param {array} [parameters.backend.response.headers] Array of HTTP Headers + * to log. + * + * @param {object} [parameters.backend.response.body] Body logging settings. + * + * @param {number} [parameters.backend.response.body.bytes] Number of request + * body bytes to log. * * @param {string} ifMatch ETag of the Entity. ETag should match the current * entity state from the header response of the GET request or it should be * @@ -1753,8 +1813,38 @@ class ApiDiagnostic { * * @param {object} parameters Create parameters. * - * @param {boolean} parameters.enabled Indicates whether a diagnostic should - * receive data or not. + * @param {string} [parameters.alwaysLog] Specifies for what type of messages + * sampling settings should not apply. Possible values include: 'allErrors' + * + * @param {string} parameters.loggerId Resource Id of a target logger. + * + * @param {object} [parameters.sampling] Sampling settings for Diagnostic. + * + * @param {string} [parameters.sampling.samplingType] Sampling type. Possible + * values include: 'fixed' + * + * @param {number} [parameters.sampling.percentage] Rate of sampling for + * fixed-rate sampling. + * + * @param {object} [parameters.frontend] Diagnostic settings for + * incoming/outcoming HTTP messages to the Gateway. + * + * @param {object} [parameters.backend] Diagnostic settings for + * incoming/outcoming HTTP messages to the Backend + * + * @param {object} [parameters.backend.request] Diagnostic settings for + * request. + * + * @param {object} [parameters.backend.response] Diagnostic settings for + * response. + * + * @param {array} [parameters.backend.response.headers] Array of HTTP Headers + * to log. + * + * @param {object} [parameters.backend.response.body] Body logging settings. + * + * @param {number} [parameters.backend.response.body.bytes] Number of request + * body bytes to log. * * @param {object} [options] Optional Parameters. * @@ -1799,8 +1889,38 @@ class ApiDiagnostic { * * @param {object} parameters Create parameters. * - * @param {boolean} parameters.enabled Indicates whether a diagnostic should - * receive data or not. + * @param {string} [parameters.alwaysLog] Specifies for what type of messages + * sampling settings should not apply. Possible values include: 'allErrors' + * + * @param {string} parameters.loggerId Resource Id of a target logger. + * + * @param {object} [parameters.sampling] Sampling settings for Diagnostic. + * + * @param {string} [parameters.sampling.samplingType] Sampling type. Possible + * values include: 'fixed' + * + * @param {number} [parameters.sampling.percentage] Rate of sampling for + * fixed-rate sampling. + * + * @param {object} [parameters.frontend] Diagnostic settings for + * incoming/outcoming HTTP messages to the Gateway. + * + * @param {object} [parameters.backend] Diagnostic settings for + * incoming/outcoming HTTP messages to the Backend + * + * @param {object} [parameters.backend.request] Diagnostic settings for + * request. + * + * @param {object} [parameters.backend.response] Diagnostic settings for + * response. + * + * @param {array} [parameters.backend.response.headers] Array of HTTP Headers + * to log. + * + * @param {object} [parameters.backend.response.body] Body logging settings. + * + * @param {number} [parameters.backend.response.body.bytes] Number of request + * body bytes to log. * * @param {object} [options] Optional Parameters. * @@ -1868,8 +1988,38 @@ class ApiDiagnostic { * * @param {object} parameters Diagnostic Update parameters. * - * @param {boolean} parameters.enabled Indicates whether a diagnostic should - * receive data or not. + * @param {string} [parameters.alwaysLog] Specifies for what type of messages + * sampling settings should not apply. Possible values include: 'allErrors' + * + * @param {string} parameters.loggerId Resource Id of a target logger. + * + * @param {object} [parameters.sampling] Sampling settings for Diagnostic. + * + * @param {string} [parameters.sampling.samplingType] Sampling type. Possible + * values include: 'fixed' + * + * @param {number} [parameters.sampling.percentage] Rate of sampling for + * fixed-rate sampling. + * + * @param {object} [parameters.frontend] Diagnostic settings for + * incoming/outcoming HTTP messages to the Gateway. + * + * @param {object} [parameters.backend] Diagnostic settings for + * incoming/outcoming HTTP messages to the Backend + * + * @param {object} [parameters.backend.request] Diagnostic settings for + * request. + * + * @param {object} [parameters.backend.response] Diagnostic settings for + * response. + * + * @param {array} [parameters.backend.response.headers] Array of HTTP Headers + * to log. + * + * @param {object} [parameters.backend.response.body] Body logging settings. + * + * @param {number} [parameters.backend.response.body.bytes] Number of request + * body bytes to log. * * @param {string} ifMatch ETag of the Entity. ETag should match the current * entity state from the header response of the GET request or it should be * @@ -1916,8 +2066,38 @@ class ApiDiagnostic { * * @param {object} parameters Diagnostic Update parameters. * - * @param {boolean} parameters.enabled Indicates whether a diagnostic should - * receive data or not. + * @param {string} [parameters.alwaysLog] Specifies for what type of messages + * sampling settings should not apply. Possible values include: 'allErrors' + * + * @param {string} parameters.loggerId Resource Id of a target logger. + * + * @param {object} [parameters.sampling] Sampling settings for Diagnostic. + * + * @param {string} [parameters.sampling.samplingType] Sampling type. Possible + * values include: 'fixed' + * + * @param {number} [parameters.sampling.percentage] Rate of sampling for + * fixed-rate sampling. + * + * @param {object} [parameters.frontend] Diagnostic settings for + * incoming/outcoming HTTP messages to the Gateway. + * + * @param {object} [parameters.backend] Diagnostic settings for + * incoming/outcoming HTTP messages to the Backend + * + * @param {object} [parameters.backend.request] Diagnostic settings for + * request. + * + * @param {object} [parameters.backend.response] Diagnostic settings for + * response. + * + * @param {array} [parameters.backend.response.headers] Array of HTTP Headers + * to log. + * + * @param {object} [parameters.backend.response.body] Body logging settings. + * + * @param {number} [parameters.backend.response.body.bytes] Number of request + * body bytes to log. * * @param {string} ifMatch ETag of the Entity. ETag should match the current * entity state from the header response of the GET request or it should be * diff --git a/lib/services/apimanagement/lib/operations/diagnostic.js b/lib/services/apimanagement/lib/operations/diagnostic.js index 36ca9c25fb..e49cc5615f 100644 --- a/lib/services/apimanagement/lib/operations/diagnostic.js +++ b/lib/services/apimanagement/lib/operations/diagnostic.js @@ -573,8 +573,38 @@ function _get(resourceGroupName, serviceName, diagnosticId, options, callback) { * * @param {object} parameters Create parameters. * - * @param {boolean} parameters.enabled Indicates whether a diagnostic should - * receive data or not. + * @param {string} [parameters.alwaysLog] Specifies for what type of messages + * sampling settings should not apply. Possible values include: 'allErrors' + * + * @param {string} parameters.loggerId Resource Id of a target logger. + * + * @param {object} [parameters.sampling] Sampling settings for Diagnostic. + * + * @param {string} [parameters.sampling.samplingType] Sampling type. Possible + * values include: 'fixed' + * + * @param {number} [parameters.sampling.percentage] Rate of sampling for + * fixed-rate sampling. + * + * @param {object} [parameters.frontend] Diagnostic settings for + * incoming/outcoming HTTP messages to the Gateway. + * + * @param {object} [parameters.backend] Diagnostic settings for + * incoming/outcoming HTTP messages to the Backend + * + * @param {object} [parameters.backend.request] Diagnostic settings for + * request. + * + * @param {object} [parameters.backend.response] Diagnostic settings for + * response. + * + * @param {array} [parameters.backend.response.headers] Array of HTTP Headers + * to log. + * + * @param {object} [parameters.backend.response.body] Body logging settings. + * + * @param {number} [parameters.backend.response.body.bytes] Number of request + * body bytes to log. * * @param {object} [options] Optional Parameters. * @@ -803,8 +833,38 @@ function _createOrUpdate(resourceGroupName, serviceName, diagnosticId, parameter * * @param {object} parameters Diagnostic Update parameters. * - * @param {boolean} parameters.enabled Indicates whether a diagnostic should - * receive data or not. + * @param {string} [parameters.alwaysLog] Specifies for what type of messages + * sampling settings should not apply. Possible values include: 'allErrors' + * + * @param {string} parameters.loggerId Resource Id of a target logger. + * + * @param {object} [parameters.sampling] Sampling settings for Diagnostic. + * + * @param {string} [parameters.sampling.samplingType] Sampling type. Possible + * values include: 'fixed' + * + * @param {number} [parameters.sampling.percentage] Rate of sampling for + * fixed-rate sampling. + * + * @param {object} [parameters.frontend] Diagnostic settings for + * incoming/outcoming HTTP messages to the Gateway. + * + * @param {object} [parameters.backend] Diagnostic settings for + * incoming/outcoming HTTP messages to the Backend + * + * @param {object} [parameters.backend.request] Diagnostic settings for + * request. + * + * @param {object} [parameters.backend.response] Diagnostic settings for + * response. + * + * @param {array} [parameters.backend.response.headers] Array of HTTP Headers + * to log. + * + * @param {object} [parameters.backend.response.body] Body logging settings. + * + * @param {number} [parameters.backend.response.body.bytes] Number of request + * body bytes to log. * * @param {string} ifMatch ETag of the Entity. ETag should match the current * entity state from the header response of the GET request or it should be * @@ -1605,8 +1665,38 @@ class Diagnostic { * * @param {object} parameters Create parameters. * - * @param {boolean} parameters.enabled Indicates whether a diagnostic should - * receive data or not. + * @param {string} [parameters.alwaysLog] Specifies for what type of messages + * sampling settings should not apply. Possible values include: 'allErrors' + * + * @param {string} parameters.loggerId Resource Id of a target logger. + * + * @param {object} [parameters.sampling] Sampling settings for Diagnostic. + * + * @param {string} [parameters.sampling.samplingType] Sampling type. Possible + * values include: 'fixed' + * + * @param {number} [parameters.sampling.percentage] Rate of sampling for + * fixed-rate sampling. + * + * @param {object} [parameters.frontend] Diagnostic settings for + * incoming/outcoming HTTP messages to the Gateway. + * + * @param {object} [parameters.backend] Diagnostic settings for + * incoming/outcoming HTTP messages to the Backend + * + * @param {object} [parameters.backend.request] Diagnostic settings for + * request. + * + * @param {object} [parameters.backend.response] Diagnostic settings for + * response. + * + * @param {array} [parameters.backend.response.headers] Array of HTTP Headers + * to log. + * + * @param {object} [parameters.backend.response.body] Body logging settings. + * + * @param {number} [parameters.backend.response.body.bytes] Number of request + * body bytes to log. * * @param {object} [options] Optional Parameters. * @@ -1648,8 +1738,38 @@ class Diagnostic { * * @param {object} parameters Create parameters. * - * @param {boolean} parameters.enabled Indicates whether a diagnostic should - * receive data or not. + * @param {string} [parameters.alwaysLog] Specifies for what type of messages + * sampling settings should not apply. Possible values include: 'allErrors' + * + * @param {string} parameters.loggerId Resource Id of a target logger. + * + * @param {object} [parameters.sampling] Sampling settings for Diagnostic. + * + * @param {string} [parameters.sampling.samplingType] Sampling type. Possible + * values include: 'fixed' + * + * @param {number} [parameters.sampling.percentage] Rate of sampling for + * fixed-rate sampling. + * + * @param {object} [parameters.frontend] Diagnostic settings for + * incoming/outcoming HTTP messages to the Gateway. + * + * @param {object} [parameters.backend] Diagnostic settings for + * incoming/outcoming HTTP messages to the Backend + * + * @param {object} [parameters.backend.request] Diagnostic settings for + * request. + * + * @param {object} [parameters.backend.response] Diagnostic settings for + * response. + * + * @param {array} [parameters.backend.response.headers] Array of HTTP Headers + * to log. + * + * @param {object} [parameters.backend.response.body] Body logging settings. + * + * @param {number} [parameters.backend.response.body.bytes] Number of request + * body bytes to log. * * @param {object} [options] Optional Parameters. * @@ -1713,8 +1833,38 @@ class Diagnostic { * * @param {object} parameters Diagnostic Update parameters. * - * @param {boolean} parameters.enabled Indicates whether a diagnostic should - * receive data or not. + * @param {string} [parameters.alwaysLog] Specifies for what type of messages + * sampling settings should not apply. Possible values include: 'allErrors' + * + * @param {string} parameters.loggerId Resource Id of a target logger. + * + * @param {object} [parameters.sampling] Sampling settings for Diagnostic. + * + * @param {string} [parameters.sampling.samplingType] Sampling type. Possible + * values include: 'fixed' + * + * @param {number} [parameters.sampling.percentage] Rate of sampling for + * fixed-rate sampling. + * + * @param {object} [parameters.frontend] Diagnostic settings for + * incoming/outcoming HTTP messages to the Gateway. + * + * @param {object} [parameters.backend] Diagnostic settings for + * incoming/outcoming HTTP messages to the Backend + * + * @param {object} [parameters.backend.request] Diagnostic settings for + * request. + * + * @param {object} [parameters.backend.response] Diagnostic settings for + * response. + * + * @param {array} [parameters.backend.response.headers] Array of HTTP Headers + * to log. + * + * @param {object} [parameters.backend.response.body] Body logging settings. + * + * @param {number} [parameters.backend.response.body.bytes] Number of request + * body bytes to log. * * @param {string} ifMatch ETag of the Entity. ETag should match the current * entity state from the header response of the GET request or it should be * @@ -1757,8 +1907,38 @@ class Diagnostic { * * @param {object} parameters Diagnostic Update parameters. * - * @param {boolean} parameters.enabled Indicates whether a diagnostic should - * receive data or not. + * @param {string} [parameters.alwaysLog] Specifies for what type of messages + * sampling settings should not apply. Possible values include: 'allErrors' + * + * @param {string} parameters.loggerId Resource Id of a target logger. + * + * @param {object} [parameters.sampling] Sampling settings for Diagnostic. + * + * @param {string} [parameters.sampling.samplingType] Sampling type. Possible + * values include: 'fixed' + * + * @param {number} [parameters.sampling.percentage] Rate of sampling for + * fixed-rate sampling. + * + * @param {object} [parameters.frontend] Diagnostic settings for + * incoming/outcoming HTTP messages to the Gateway. + * + * @param {object} [parameters.backend] Diagnostic settings for + * incoming/outcoming HTTP messages to the Backend + * + * @param {object} [parameters.backend.request] Diagnostic settings for + * request. + * + * @param {object} [parameters.backend.response] Diagnostic settings for + * response. + * + * @param {array} [parameters.backend.response.headers] Array of HTTP Headers + * to log. + * + * @param {object} [parameters.backend.response.body] Body logging settings. + * + * @param {number} [parameters.backend.response.body.bytes] Number of request + * body bytes to log. * * @param {string} ifMatch ETag of the Entity. ETag should match the current * entity state from the header response of the GET request or it should be * diff --git a/lib/services/apimanagement/lib/operations/index.d.ts b/lib/services/apimanagement/lib/operations/index.d.ts index ce7958e0f4..c2b6f2733f 100644 --- a/lib/services/apimanagement/lib/operations/index.d.ts +++ b/lib/services/apimanagement/lib/operations/index.d.ts @@ -4555,8 +4555,38 @@ export interface ApiDiagnostic { * * @param {object} parameters Create parameters. * - * @param {boolean} parameters.enabled Indicates whether a diagnostic should - * receive data or not. + * @param {string} [parameters.alwaysLog] Specifies for what type of messages + * sampling settings should not apply. Possible values include: 'allErrors' + * + * @param {string} parameters.loggerId Resource Id of a target logger. + * + * @param {object} [parameters.sampling] Sampling settings for Diagnostic. + * + * @param {string} [parameters.sampling.samplingType] Sampling type. Possible + * values include: 'fixed' + * + * @param {number} [parameters.sampling.percentage] Rate of sampling for + * fixed-rate sampling. + * + * @param {object} [parameters.frontend] Diagnostic settings for + * incoming/outcoming HTTP messages to the Gateway. + * + * @param {object} [parameters.backend] Diagnostic settings for + * incoming/outcoming HTTP messages to the Backend + * + * @param {object} [parameters.backend.request] Diagnostic settings for + * request. + * + * @param {object} [parameters.backend.response] Diagnostic settings for + * response. + * + * @param {array} [parameters.backend.response.headers] Array of HTTP Headers + * to log. + * + * @param {object} [parameters.backend.response.body] Body logging settings. + * + * @param {number} [parameters.backend.response.body.bytes] Number of request + * body bytes to log. * * @param {object} [options] Optional Parameters. * @@ -4589,8 +4619,38 @@ export interface ApiDiagnostic { * * @param {object} parameters Create parameters. * - * @param {boolean} parameters.enabled Indicates whether a diagnostic should - * receive data or not. + * @param {string} [parameters.alwaysLog] Specifies for what type of messages + * sampling settings should not apply. Possible values include: 'allErrors' + * + * @param {string} parameters.loggerId Resource Id of a target logger. + * + * @param {object} [parameters.sampling] Sampling settings for Diagnostic. + * + * @param {string} [parameters.sampling.samplingType] Sampling type. Possible + * values include: 'fixed' + * + * @param {number} [parameters.sampling.percentage] Rate of sampling for + * fixed-rate sampling. + * + * @param {object} [parameters.frontend] Diagnostic settings for + * incoming/outcoming HTTP messages to the Gateway. + * + * @param {object} [parameters.backend] Diagnostic settings for + * incoming/outcoming HTTP messages to the Backend + * + * @param {object} [parameters.backend.request] Diagnostic settings for + * request. + * + * @param {object} [parameters.backend.response] Diagnostic settings for + * response. + * + * @param {array} [parameters.backend.response.headers] Array of HTTP Headers + * to log. + * + * @param {object} [parameters.backend.response.body] Body logging settings. + * + * @param {number} [parameters.backend.response.body.bytes] Number of request + * body bytes to log. * * @param {object} [options] Optional Parameters. * @@ -4643,8 +4703,38 @@ export interface ApiDiagnostic { * * @param {object} parameters Diagnostic Update parameters. * - * @param {boolean} parameters.enabled Indicates whether a diagnostic should - * receive data or not. + * @param {string} [parameters.alwaysLog] Specifies for what type of messages + * sampling settings should not apply. Possible values include: 'allErrors' + * + * @param {string} parameters.loggerId Resource Id of a target logger. + * + * @param {object} [parameters.sampling] Sampling settings for Diagnostic. + * + * @param {string} [parameters.sampling.samplingType] Sampling type. Possible + * values include: 'fixed' + * + * @param {number} [parameters.sampling.percentage] Rate of sampling for + * fixed-rate sampling. + * + * @param {object} [parameters.frontend] Diagnostic settings for + * incoming/outcoming HTTP messages to the Gateway. + * + * @param {object} [parameters.backend] Diagnostic settings for + * incoming/outcoming HTTP messages to the Backend + * + * @param {object} [parameters.backend.request] Diagnostic settings for + * request. + * + * @param {object} [parameters.backend.response] Diagnostic settings for + * response. + * + * @param {array} [parameters.backend.response.headers] Array of HTTP Headers + * to log. + * + * @param {object} [parameters.backend.response.body] Body logging settings. + * + * @param {number} [parameters.backend.response.body.bytes] Number of request + * body bytes to log. * * @param {string} ifMatch ETag of the Entity. ETag should match the current * entity state from the header response of the GET request or it should be * @@ -4679,8 +4769,38 @@ export interface ApiDiagnostic { * * @param {object} parameters Diagnostic Update parameters. * - * @param {boolean} parameters.enabled Indicates whether a diagnostic should - * receive data or not. + * @param {string} [parameters.alwaysLog] Specifies for what type of messages + * sampling settings should not apply. Possible values include: 'allErrors' + * + * @param {string} parameters.loggerId Resource Id of a target logger. + * + * @param {object} [parameters.sampling] Sampling settings for Diagnostic. + * + * @param {string} [parameters.sampling.samplingType] Sampling type. Possible + * values include: 'fixed' + * + * @param {number} [parameters.sampling.percentage] Rate of sampling for + * fixed-rate sampling. + * + * @param {object} [parameters.frontend] Diagnostic settings for + * incoming/outcoming HTTP messages to the Gateway. + * + * @param {object} [parameters.backend] Diagnostic settings for + * incoming/outcoming HTTP messages to the Backend + * + * @param {object} [parameters.backend.request] Diagnostic settings for + * request. + * + * @param {object} [parameters.backend.response] Diagnostic settings for + * response. + * + * @param {array} [parameters.backend.response.headers] Array of HTTP Headers + * to log. + * + * @param {object} [parameters.backend.response.body] Body logging settings. + * + * @param {number} [parameters.backend.response.body.bytes] Number of request + * body bytes to log. * * @param {string} ifMatch ETag of the Entity. ETag should match the current * entity state from the header response of the GET request or it should be * @@ -4854,15 +4974,15 @@ export interface ApiDiagnostic { /** * @class - * ApiDiagnosticLogger + * ApiIssue * __NOTE__: An instance of this class is automatically created for an * instance of the ApiManagementClient. */ -export interface ApiDiagnosticLogger { +export interface ApiIssue { /** - * Lists all loggers assosiated with the specified Diagnostic of an API. + * Lists all issues assosiated with the specified API. * * @param {string} resourceGroupName The name of the resource group. * @@ -4871,16 +4991,16 @@ export interface ApiDiagnosticLogger { * @param {string} apiId API identifier. Must be unique in the current API * Management service instance. * - * @param {string} diagnosticId Diagnostic identifier. Must be unique in the - * current API Management service instance. - * * @param {object} [options] Optional Parameters. * * @param {string} [options.filter] | Field | Supported operators | * Supported functions | * |-------------|------------------------|-----------------------------------| * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | - * | type | eq | | + * | state | eq | + * | + * | userId | ge, le, eq, ne, gt, lt | substringof, startswith, + * endswith | * * @param {number} [options.top] Number of records to return. * @@ -4891,14 +5011,14 @@ export interface ApiDiagnosticLogger { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByServiceWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, diagnosticId: string, options?: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; + listByServiceWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, options?: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Lists all loggers assosiated with the specified Diagnostic of an API. + * Lists all issues assosiated with the specified API. * * @param {string} resourceGroupName The name of the resource group. * @@ -4907,16 +5027,16 @@ export interface ApiDiagnosticLogger { * @param {string} apiId API identifier. Must be unique in the current API * Management service instance. * - * @param {string} diagnosticId Diagnostic identifier. Must be unique in the - * current API Management service instance. - * * @param {object} [options] Optional Parameters. * * @param {string} [options.filter] | Field | Supported operators | * Supported functions | * |-------------|------------------------|-----------------------------------| * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | - * | type | eq | | + * | state | eq | + * | + * | userId | ge, le, eq, ne, gt, lt | substringof, startswith, + * endswith | * * @param {number} [options.top] Number of records to return. * @@ -4932,7 +5052,7 @@ export interface ApiDiagnosticLogger { * * {Promise} A promise is returned. * - * @resolve {LoggerCollection} - The deserialized result object. + * @resolve {IssueCollection} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -4940,21 +5060,21 @@ export interface ApiDiagnosticLogger { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {LoggerCollection} [result] - The deserialized result object if an error did not occur. - * See {@link LoggerCollection} for more information. + * {IssueCollection} [result] - The deserialized result object if an error did not occur. + * See {@link IssueCollection} 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. */ - listByService(resourceGroupName: string, serviceName: string, apiId: string, diagnosticId: string, options?: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }): Promise; - listByService(resourceGroupName: string, serviceName: string, apiId: string, diagnosticId: string, callback: ServiceCallback): void; - listByService(resourceGroupName: string, serviceName: string, apiId: string, diagnosticId: string, options: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByService(resourceGroupName: string, serviceName: string, apiId: string, options?: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }): Promise; + listByService(resourceGroupName: string, serviceName: string, apiId: string, callback: ServiceCallback): void; + listByService(resourceGroupName: string, serviceName: string, apiId: string, options: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Checks that logger entity specified by identifier is associated with the - * diagnostics entity. + * Gets the entity state (Etag) version of the Issue for an API specified by + * its identifier. * * @param {string} resourceGroupName The name of the resource group. * @@ -4963,10 +5083,7 @@ export interface ApiDiagnosticLogger { * @param {string} apiId API identifier. Must be unique in the current API * Management service instance. * - * @param {string} diagnosticId Diagnostic identifier. Must be unique in the - * current API Management service instance. - * - * @param {string} loggerid Logger identifier. Must be unique in the API + * @param {string} issueId Issue identifier. Must be unique in the current API * Management service instance. * * @param {object} [options] Optional Parameters. @@ -4976,15 +5093,15 @@ export interface ApiDiagnosticLogger { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - checkEntityExistsWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, diagnosticId: string, loggerid: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getEntityTagWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Checks that logger entity specified by identifier is associated with the - * diagnostics entity. + * Gets the entity state (Etag) version of the Issue for an API specified by + * its identifier. * * @param {string} resourceGroupName The name of the resource group. * @@ -4993,10 +5110,7 @@ export interface ApiDiagnosticLogger { * @param {string} apiId API identifier. Must be unique in the current API * Management service instance. * - * @param {string} diagnosticId Diagnostic identifier. Must be unique in the - * current API Management service instance. - * - * @param {string} loggerid Logger identifier. Must be unique in the API + * @param {string} issueId Issue identifier. Must be unique in the current API * Management service instance. * * @param {object} [options] Optional Parameters. @@ -5011,7 +5125,7 @@ export interface ApiDiagnosticLogger { * * {Promise} A promise is returned. * - * @resolve {Boolean} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -5019,19 +5133,19 @@ export interface ApiDiagnosticLogger { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Boolean} [result] - The deserialized result object if an error did not occur. + * {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. */ - checkEntityExists(resourceGroupName: string, serviceName: string, apiId: string, diagnosticId: string, loggerid: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - checkEntityExists(resourceGroupName: string, serviceName: string, apiId: string, diagnosticId: string, loggerid: string, callback: ServiceCallback): void; - checkEntityExists(resourceGroupName: string, serviceName: string, apiId: string, diagnosticId: string, loggerid: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + getEntityTag(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getEntityTag(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, callback: ServiceCallback): void; + getEntityTag(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Attaches a logger to a dignostic for an API. + * Gets the details of the Issue for an API specified by its identifier. * * @param {string} resourceGroupName The name of the resource group. * @@ -5040,10 +5154,7 @@ export interface ApiDiagnosticLogger { * @param {string} apiId API identifier. Must be unique in the current API * Management service instance. * - * @param {string} diagnosticId Diagnostic identifier. Must be unique in the - * current API Management service instance. - * - * @param {string} loggerid Logger identifier. Must be unique in the API + * @param {string} issueId Issue identifier. Must be unique in the current API * Management service instance. * * @param {object} [options] Optional Parameters. @@ -5053,14 +5164,14 @@ export interface ApiDiagnosticLogger { * * @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(resourceGroupName: string, serviceName: string, apiId: string, diagnosticId: string, loggerid: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Attaches a logger to a dignostic for an API. + * Gets the details of the Issue for an API specified by its identifier. * * @param {string} resourceGroupName The name of the resource group. * @@ -5069,10 +5180,7 @@ export interface ApiDiagnosticLogger { * @param {string} apiId API identifier. Must be unique in the current API * Management service instance. * - * @param {string} diagnosticId Diagnostic identifier. Must be unique in the - * current API Management service instance. - * - * @param {string} loggerid Logger identifier. Must be unique in the API + * @param {string} issueId Issue identifier. Must be unique in the current API * Management service instance. * * @param {object} [options] Optional Parameters. @@ -5087,7 +5195,7 @@ export interface ApiDiagnosticLogger { * * {Promise} A promise is returned. * - * @resolve {LoggerContract} - The deserialized result object. + * @resolve {IssueContract} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -5095,20 +5203,20 @@ export interface ApiDiagnosticLogger { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {LoggerContract} [result] - The deserialized result object if an error did not occur. - * See {@link LoggerContract} for more information. + * {IssueContract} [result] - The deserialized result object if an error did not occur. + * See {@link IssueContract} 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. */ - createOrUpdate(resourceGroupName: string, serviceName: string, apiId: string, diagnosticId: string, loggerid: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, serviceName: string, apiId: string, diagnosticId: string, loggerid: string, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, serviceName: string, apiId: string, diagnosticId: string, loggerid: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Deletes the specified Logger from Diagnostic for an API. + * Creates a new Issue for an API or updates an existing one. * * @param {string} resourceGroupName The name of the resource group. * @@ -5117,27 +5225,46 @@ export interface ApiDiagnosticLogger { * @param {string} apiId API identifier. Must be unique in the current API * Management service instance. * - * @param {string} diagnosticId Diagnostic identifier. Must be unique in the - * current API Management service instance. - * - * @param {string} loggerid Logger identifier. Must be unique in the API + * @param {string} issueId Issue identifier. Must be unique in the current API * Management service instance. * + * @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 {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. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, diagnosticId: string, loggerid: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, parameters: models.IssueContract, options?: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes the specified Logger from Diagnostic for an API. + * Creates a new Issue for an API or updates an existing one. * * @param {string} resourceGroupName The name of the resource group. * @@ -5146,14 +5273,33 @@ export interface ApiDiagnosticLogger { * @param {string} apiId API identifier. Must be unique in the current API * Management service instance. * - * @param {string} diagnosticId Diagnostic identifier. Must be unique in the - * current API Management service instance. - * - * @param {string} loggerid Logger identifier. Must be unique in the API + * @param {string} issueId Issue identifier. Must be unique in the current API * Management service instance. * + * @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 {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 * @@ -5164,7 +5310,7 @@ export interface ApiDiagnosticLogger { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {IssueContract} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -5172,22 +5318,34 @@ export interface ApiDiagnosticLogger { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {IssueContract} [result] - The deserialized result object if an error did not occur. + * See {@link IssueContract} 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(resourceGroupName: string, serviceName: string, apiId: string, diagnosticId: string, loggerid: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, diagnosticId: string, loggerid: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, diagnosticId: string, loggerid: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, parameters: models.IssueContract, options?: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, parameters: models.IssueContract, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, parameters: models.IssueContract, options: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Lists all loggers assosiated with the specified Diagnostic of an API. + * Deletes the specified Issue from an API. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @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 {string} 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] Optional Parameters. * @@ -5196,17 +5354,28 @@ export interface ApiDiagnosticLogger { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByServiceNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteMethodWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, ifMatch: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Lists all loggers assosiated with the specified Diagnostic of an API. + * Deletes the specified Issue from an API. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @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 {string} 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] Optional Parameters. * @@ -5220,7 +5389,7 @@ export interface ApiDiagnosticLogger { * * {Promise} A promise is returned. * - * @resolve {LoggerCollection} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -5228,45 +5397,102 @@ export interface ApiDiagnosticLogger { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {LoggerCollection} [result] - The deserialized result object if an error did not occur. - * See {@link LoggerCollection} for more information. + * {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. */ - listByServiceNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByServiceNext(nextPageLink: string, callback: ServiceCallback): void; - listByServiceNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * ApiIssue - * __NOTE__: An instance of this class is automatically created for an - * instance of the ApiManagementClient. - */ -export interface ApiIssue { + deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, ifMatch: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, ifMatch: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, ifMatch: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** * Lists all issues assosiated with the specified API. * - * @param {string} resourceGroupName The name of the resource group. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * - * @param {string} serviceName The name of the API Management service. + * @param {object} [options] Optional Parameters. * - * @param {string} apiId API identifier. Must be unique in the current API - * Management service instance. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {object} [options] Optional Parameters. + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByServiceNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all issues assosiated with the specified API. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 {IssueCollection} - 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. + * + * {IssueCollection} [result] - The deserialized result object if an error did not occur. + * See {@link IssueCollection} 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. + */ + listByServiceNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServiceNext(nextPageLink: string, callback: ServiceCallback): void; + listByServiceNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ApiIssueComment + * __NOTE__: An instance of this class is automatically created for an + * instance of the ApiManagementClient. + */ +export interface ApiIssueComment { + + + /** + * Lists all comments for the Issue assosiated with the specified 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} [options] Optional Parameters. * * @param {string} [options.filter] | Field | Supported operators | * Supported functions | * |-------------|------------------------|-----------------------------------| * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | - * | state | eq | - * | * | userId | ge, le, eq, ne, gt, lt | substringof, startswith, * endswith | * @@ -5279,14 +5505,14 @@ export interface ApiIssue { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByServiceWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, options?: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; + listByServiceWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options?: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Lists all issues assosiated with the specified API. + * Lists all comments for the Issue assosiated with the specified API. * * @param {string} resourceGroupName The name of the resource group. * @@ -5295,14 +5521,15 @@ export interface ApiIssue { * @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} [options] Optional Parameters. * * @param {string} [options.filter] | Field | Supported operators | * Supported functions | * |-------------|------------------------|-----------------------------------| * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | - * | state | eq | - * | * | userId | ge, le, eq, ne, gt, lt | substringof, startswith, * endswith | * @@ -5320,7 +5547,7 @@ export interface ApiIssue { * * {Promise} A promise is returned. * - * @resolve {IssueCollection} - The deserialized result object. + * @resolve {IssueCommentCollection} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -5328,21 +5555,22 @@ export interface ApiIssue { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {IssueCollection} [result] - The deserialized result object if an error did not occur. - * See {@link IssueCollection} for more information. + * {IssueCommentCollection} [result] - The deserialized result object if an error did not occur. + * See {@link IssueCommentCollection} 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. */ - listByService(resourceGroupName: string, serviceName: string, apiId: string, options?: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }): Promise; - listByService(resourceGroupName: string, serviceName: string, apiId: string, callback: ServiceCallback): void; - listByService(resourceGroupName: string, serviceName: string, apiId: string, options: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByService(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options?: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }): Promise; + listByService(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, callback: ServiceCallback): void; + listByService(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets the entity state (Etag) version of the Issue for an API specified by - * its identifier. + * Gets the entity state (Etag) version of the issue Comment for an API + * specified by its identifier. * * @param {string} resourceGroupName The name of the resource group. * @@ -5354,6 +5582,9 @@ export interface ApiIssue { * @param {string} issueId Issue identifier. Must be unique in the current API * Management service instance. * + * @param {string} commentId Comment identifier within an Issue. Must be unique + * in the current Issue. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -5365,11 +5596,11 @@ export interface ApiIssue { * * @reject {Error|ServiceError} - The error object. */ - getEntityTagWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getEntityTagWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets the entity state (Etag) version of the Issue for an API specified by - * its identifier. + * Gets the entity state (Etag) version of the issue Comment for an API + * specified by its identifier. * * @param {string} resourceGroupName The name of the resource group. * @@ -5381,6 +5612,9 @@ export interface ApiIssue { * @param {string} issueId Issue identifier. Must be unique in the current API * Management service instance. * + * @param {string} commentId Comment identifier within an Issue. Must be unique + * in the current Issue. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -5407,13 +5641,14 @@ export interface ApiIssue { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - getEntityTag(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - getEntityTag(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, callback: ServiceCallback): void; - getEntityTag(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + getEntityTag(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getEntityTag(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, callback: ServiceCallback): void; + getEntityTag(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets the details of the Issue for an API specified by its identifier. + * Gets the details of the issue Comment for an API specified by its + * identifier. * * @param {string} resourceGroupName The name of the resource group. * @@ -5425,6 +5660,9 @@ export interface ApiIssue { * @param {string} issueId Issue identifier. Must be unique in the current API * Management service instance. * + * @param {string} commentId Comment identifier within an Issue. Must be unique + * in the current Issue. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -5432,14 +5670,15 @@ export interface ApiIssue { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets the details of the Issue for an API specified by its identifier. + * Gets the details of the issue Comment for an API specified by its + * identifier. * * @param {string} resourceGroupName The name of the resource group. * @@ -5451,6 +5690,9 @@ export interface ApiIssue { * @param {string} issueId Issue identifier. Must be unique in the current API * Management service instance. * + * @param {string} commentId Comment identifier within an Issue. Must be unique + * in the current Issue. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -5463,7 +5705,7 @@ export interface ApiIssue { * * {Promise} A promise is returned. * - * @resolve {IssueContract} - The deserialized result object. + * @resolve {IssueCommentContract} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -5471,20 +5713,20 @@ export interface ApiIssue { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {IssueContract} [result] - The deserialized result object if an error did not occur. - * See {@link IssueContract} for more information. + * {IssueCommentContract} [result] - The deserialized result object if an error did not occur. + * See {@link IssueCommentContract} 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. */ - get(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, callback: ServiceCallback): void; - get(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Creates a new Issue for an API or updates an existing one. + * Creates a new Comment for the Issue in an API or updates an existing one. * * @param {string} resourceGroupName The name of the resource group. * @@ -5496,23 +5738,18 @@ export interface ApiIssue { * @param {string} issueId Issue identifier. Must be unique in the current API * Management service instance. * - * @param {object} parameters Create parameters. + * @param {string} commentId Comment identifier within an Issue. Must be unique + * in the current Issue. * - * @param {string} parameters.title The issue title. + * @param {object} parameters Create parameters. * - * @param {string} parameters.description Text describing the issue. + * @param {string} parameters.text Comment text. * - * @param {date} [parameters.createdDate] Date and time when the issue was + * @param {date} [parameters.createdDate] Date and time when the comment 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.userId A resource identifier for the user who + * left the comment. * * @param {object} [options] Optional Parameters. * @@ -5525,14 +5762,14 @@ export interface ApiIssue { * * @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(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, parameters: models.IssueContract, options?: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, parameters: models.IssueCommentContract, options?: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates a new Issue for an API or updates an existing one. + * Creates a new Comment for the Issue in an API or updates an existing one. * * @param {string} resourceGroupName The name of the resource group. * @@ -5544,23 +5781,18 @@ export interface ApiIssue { * @param {string} issueId Issue identifier. Must be unique in the current API * Management service instance. * - * @param {object} parameters Create parameters. + * @param {string} commentId Comment identifier within an Issue. Must be unique + * in the current Issue. * - * @param {string} parameters.title The issue title. + * @param {object} parameters Create parameters. * - * @param {string} parameters.description Text describing the issue. + * @param {string} parameters.text Comment text. * - * @param {date} [parameters.createdDate] Date and time when the issue was + * @param {date} [parameters.createdDate] Date and time when the comment 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.userId A resource identifier for the user who + * left the comment. * * @param {object} [options] Optional Parameters. * @@ -5578,7 +5810,7 @@ export interface ApiIssue { * * {Promise} A promise is returned. * - * @resolve {IssueContract} - The deserialized result object. + * @resolve {IssueCommentContract} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -5586,20 +5818,20 @@ export interface ApiIssue { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {IssueContract} [result] - The deserialized result object if an error did not occur. - * See {@link IssueContract} for more information. + * {IssueCommentContract} [result] - The deserialized result object if an error did not occur. + * See {@link IssueCommentContract} 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. */ - createOrUpdate(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, parameters: models.IssueContract, options?: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, parameters: models.IssueContract, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, parameters: models.IssueContract, options: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, parameters: models.IssueCommentContract, options?: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, parameters: models.IssueCommentContract, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, parameters: models.IssueCommentContract, options: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Deletes the specified Issue from an API. + * Deletes the specified comment from an Issue. * * @param {string} resourceGroupName The name of the resource group. * @@ -5611,6 +5843,9 @@ export interface ApiIssue { * @param {string} issueId Issue identifier. Must be unique in the current API * Management service instance. * + * @param {string} commentId Comment identifier within an Issue. Must be unique + * in the current Issue. + * * @param {string} 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. @@ -5626,10 +5861,10 @@ export interface ApiIssue { * * @reject {Error|ServiceError} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, ifMatch: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteMethodWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, ifMatch: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes the specified Issue from an API. + * Deletes the specified comment from an Issue. * * @param {string} resourceGroupName The name of the resource group. * @@ -5641,6 +5876,9 @@ export interface ApiIssue { * @param {string} issueId Issue identifier. Must be unique in the current API * Management service instance. * + * @param {string} commentId Comment identifier within an Issue. Must be unique + * in the current Issue. + * * @param {string} 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. @@ -5671,13 +5909,13 @@ export interface ApiIssue { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, ifMatch: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, ifMatch: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, ifMatch: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, ifMatch: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, ifMatch: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, ifMatch: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Lists all issues assosiated with the specified API. + * Lists all comments for the Issue assosiated with the specified API. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -5689,14 +5927,14 @@ export interface ApiIssue { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByServiceNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByServiceNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Lists all issues assosiated with the specified API. + * Lists all comments for the Issue assosiated with the specified API. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -5713,7 +5951,7 @@ export interface ApiIssue { * * {Promise} A promise is returned. * - * @resolve {IssueCollection} - The deserialized result object. + * @resolve {IssueCommentCollection} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -5721,25 +5959,26 @@ export interface ApiIssue { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {IssueCollection} [result] - The deserialized result object if an error did not occur. - * See {@link IssueCollection} for more information. + * {IssueCommentCollection} [result] - The deserialized result object if an error did not occur. + * See {@link IssueCommentCollection} 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. */ - listByServiceNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByServiceNext(nextPageLink: string, callback: ServiceCallback): void; - listByServiceNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByServiceNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServiceNext(nextPageLink: string, callback: ServiceCallback): void; + listByServiceNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** * @class - * ApiIssueComment + * ApiIssueAttachment * __NOTE__: An instance of this class is automatically created for an * instance of the ApiManagementClient. */ -export interface ApiIssueComment { +export interface ApiIssueAttachment { /** @@ -5773,11 +6012,11 @@ export interface ApiIssueComment { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByServiceWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options?: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; + listByServiceWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options?: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Lists all comments for the Issue assosiated with the specified API. @@ -5815,7 +6054,7 @@ export interface ApiIssueComment { * * {Promise} A promise is returned. * - * @resolve {IssueCommentCollection} - The deserialized result object. + * @resolve {IssueAttachmentCollection} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -5823,21 +6062,21 @@ export interface ApiIssueComment { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {IssueCommentCollection} [result] - The deserialized result object if an error did not occur. - * See {@link IssueCommentCollection} for more + * {IssueAttachmentCollection} [result] - The deserialized result object if an error did not occur. + * See {@link IssueAttachmentCollection} 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. */ - listByService(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options?: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }): Promise; - listByService(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, callback: ServiceCallback): void; - listByService(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByService(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options?: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }): Promise; + listByService(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, callback: ServiceCallback): void; + listByService(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets the entity state (Etag) version of the issue Comment for an API + * Gets the entity state (Etag) version of the issue Attachment for an API * specified by its identifier. * * @param {string} resourceGroupName The name of the resource group. @@ -5850,8 +6089,8 @@ export interface ApiIssueComment { * @param {string} issueId Issue identifier. Must be unique in the current API * Management service instance. * - * @param {string} commentId Comment identifier within an Issue. Must be unique - * in the current Issue. + * @param {string} attachmentId Attachment identifier within an Issue. Must be + * unique in the current Issue. * * @param {object} [options] Optional Parameters. * @@ -5864,10 +6103,10 @@ export interface ApiIssueComment { * * @reject {Error|ServiceError} - The error object. */ - getEntityTagWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getEntityTagWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets the entity state (Etag) version of the issue Comment for an API + * Gets the entity state (Etag) version of the issue Attachment for an API * specified by its identifier. * * @param {string} resourceGroupName The name of the resource group. @@ -5880,8 +6119,8 @@ export interface ApiIssueComment { * @param {string} issueId Issue identifier. Must be unique in the current API * Management service instance. * - * @param {string} commentId Comment identifier within an Issue. Must be unique - * in the current Issue. + * @param {string} attachmentId Attachment identifier within an Issue. Must be + * unique in the current Issue. * * @param {object} [options] Optional Parameters. * @@ -5909,13 +6148,13 @@ export interface ApiIssueComment { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - getEntityTag(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - getEntityTag(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, callback: ServiceCallback): void; - getEntityTag(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + getEntityTag(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getEntityTag(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, callback: ServiceCallback): void; + getEntityTag(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets the details of the issue Comment for an API specified by its + * Gets the details of the issue Attachment for an API specified by its * identifier. * * @param {string} resourceGroupName The name of the resource group. @@ -5928,8 +6167,8 @@ export interface ApiIssueComment { * @param {string} issueId Issue identifier. Must be unique in the current API * Management service instance. * - * @param {string} commentId Comment identifier within an Issue. Must be unique - * in the current Issue. + * @param {string} attachmentId Attachment identifier within an Issue. Must be + * unique in the current Issue. * * @param {object} [options] Optional Parameters. * @@ -5938,14 +6177,14 @@ export interface ApiIssueComment { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets the details of the issue Comment for an API specified by its + * Gets the details of the issue Attachment for an API specified by its * identifier. * * @param {string} resourceGroupName The name of the resource group. @@ -5958,8 +6197,8 @@ export interface ApiIssueComment { * @param {string} issueId Issue identifier. Must be unique in the current API * Management service instance. * - * @param {string} commentId Comment identifier within an Issue. Must be unique - * in the current Issue. + * @param {string} attachmentId Attachment identifier within an Issue. Must be + * unique in the current Issue. * * @param {object} [options] Optional Parameters. * @@ -5973,7 +6212,7 @@ export interface ApiIssueComment { * * {Promise} A promise is returned. * - * @resolve {IssueCommentContract} - The deserialized result object. + * @resolve {IssueAttachmentContract} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -5981,20 +6220,21 @@ export interface ApiIssueComment { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {IssueCommentContract} [result] - The deserialized result object if an error did not occur. - * See {@link IssueCommentContract} for more information. + * {IssueAttachmentContract} [result] - The deserialized result object if an error did not occur. + * See {@link IssueAttachmentContract} 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. */ - get(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, callback: ServiceCallback): void; - get(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Creates a new Comment for the Issue in an API or updates an existing one. + * Creates a new Attachment for the Issue in an API or updates an existing one. * * @param {string} resourceGroupName The name of the resource group. * @@ -6006,18 +6246,20 @@ export interface ApiIssueComment { * @param {string} issueId Issue identifier. Must be unique in the current API * Management service instance. * - * @param {string} commentId Comment identifier within an Issue. Must be unique - * in the current Issue. + * @param {string} attachmentId Attachment identifier within an Issue. Must be + * unique in the current Issue. * * @param {object} parameters Create parameters. * - * @param {string} parameters.text Comment text. + * @param {string} parameters.title Filename by which the binary data will be + * saved. * - * @param {date} [parameters.createdDate] Date and time when the comment was - * created. + * @param {string} parameters.contentFormat Either 'link' if content is + * provided via an HTTP link or the MIME type of the Base64-encoded binary data + * provided in the 'content' property. * - * @param {string} parameters.userId A resource identifier for the user who - * left the comment. + * @param {string} parameters.content An HTTP link or Base64-encoded binary + * data. * * @param {object} [options] Optional Parameters. * @@ -6030,14 +6272,14 @@ export interface ApiIssueComment { * * @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(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, parameters: models.IssueCommentContract, options?: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, parameters: models.IssueAttachmentContract, options?: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates a new Comment for the Issue in an API or updates an existing one. + * Creates a new Attachment for the Issue in an API or updates an existing one. * * @param {string} resourceGroupName The name of the resource group. * @@ -6049,18 +6291,20 @@ export interface ApiIssueComment { * @param {string} issueId Issue identifier. Must be unique in the current API * Management service instance. * - * @param {string} commentId Comment identifier within an Issue. Must be unique - * in the current Issue. + * @param {string} attachmentId Attachment identifier within an Issue. Must be + * unique in the current Issue. * * @param {object} parameters Create parameters. * - * @param {string} parameters.text Comment text. + * @param {string} parameters.title Filename by which the binary data will be + * saved. * - * @param {date} [parameters.createdDate] Date and time when the comment was - * created. + * @param {string} parameters.contentFormat Either 'link' if content is + * provided via an HTTP link or the MIME type of the Base64-encoded binary data + * provided in the 'content' property. * - * @param {string} parameters.userId A resource identifier for the user who - * left the comment. + * @param {string} parameters.content An HTTP link or Base64-encoded binary + * data. * * @param {object} [options] Optional Parameters. * @@ -6078,7 +6322,7 @@ export interface ApiIssueComment { * * {Promise} A promise is returned. * - * @resolve {IssueCommentContract} - The deserialized result object. + * @resolve {IssueAttachmentContract} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -6086,16 +6330,17 @@ export interface ApiIssueComment { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {IssueCommentContract} [result] - The deserialized result object if an error did not occur. - * See {@link IssueCommentContract} for more information. + * {IssueAttachmentContract} [result] - The deserialized result object if an error did not occur. + * See {@link IssueAttachmentContract} 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. */ - createOrUpdate(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, parameters: models.IssueCommentContract, options?: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, parameters: models.IssueCommentContract, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, parameters: models.IssueCommentContract, options: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, parameters: models.IssueAttachmentContract, options?: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, parameters: models.IssueAttachmentContract, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, parameters: models.IssueAttachmentContract, options: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -6111,8 +6356,8 @@ export interface ApiIssueComment { * @param {string} issueId Issue identifier. Must be unique in the current API * Management service instance. * - * @param {string} commentId Comment identifier within an Issue. Must be unique - * in the current Issue. + * @param {string} attachmentId Attachment identifier within an Issue. Must be + * unique in the current Issue. * * @param {string} ifMatch ETag of the Issue Entity. ETag should match the * current entity state from the header response of the GET request or it @@ -6129,7 +6374,7 @@ export interface ApiIssueComment { * * @reject {Error|ServiceError} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, ifMatch: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteMethodWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, ifMatch: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Deletes the specified comment from an Issue. @@ -6144,8 +6389,8 @@ export interface ApiIssueComment { * @param {string} issueId Issue identifier. Must be unique in the current API * Management service instance. * - * @param {string} commentId Comment identifier within an Issue. Must be unique - * in the current Issue. + * @param {string} attachmentId Attachment identifier within an Issue. Must be + * unique in the current Issue. * * @param {string} ifMatch ETag of the Issue Entity. ETag should match the * current entity state from the header response of the GET request or it @@ -6177,9 +6422,9 @@ export interface ApiIssueComment { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, ifMatch: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, ifMatch: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, commentId: string, ifMatch: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, ifMatch: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, ifMatch: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, ifMatch: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -6195,11 +6440,11 @@ export interface ApiIssueComment { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByServiceNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByServiceNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Lists all comments for the Issue assosiated with the specified API. @@ -6219,7 +6464,7 @@ export interface ApiIssueComment { * * {Promise} A promise is returned. * - * @resolve {IssueCommentCollection} - The deserialized result object. + * @resolve {IssueAttachmentCollection} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -6227,48 +6472,44 @@ export interface ApiIssueComment { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {IssueCommentCollection} [result] - The deserialized result object if an error did not occur. - * See {@link IssueCommentCollection} for more + * {IssueAttachmentCollection} [result] - The deserialized result object if an error did not occur. + * See {@link IssueAttachmentCollection} 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. */ - listByServiceNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByServiceNext(nextPageLink: string, callback: ServiceCallback): void; - listByServiceNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByServiceNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServiceNext(nextPageLink: string, callback: ServiceCallback): void; + listByServiceNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** * @class - * ApiIssueAttachment + * AuthorizationServer * __NOTE__: An instance of this class is automatically created for an * instance of the ApiManagementClient. */ -export interface ApiIssueAttachment { +export interface AuthorizationServer { /** - * Lists all comments for the Issue assosiated with the specified API. + * Lists a collection of authorization servers defined within a service + * instance. * * @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} [options] Optional Parameters. * - * @param {string} [options.filter] | Field | Supported operators | - * Supported functions | - * |-------------|------------------------|-----------------------------------| - * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | - * | userId | ge, le, eq, ne, gt, lt | substringof, startswith, + * @param {string} [options.filter] | Field | Supported operators | + * Supported functions | + * |-------|------------------------|---------------------------------------------| + * | id | ge, le, eq, ne, gt, lt | substringof, contains, startswith, + * endswith | + * | name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, * endswith | * * @param {number} [options.top] Number of records to return. @@ -6280,32 +6521,28 @@ export interface ApiIssueAttachment { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByServiceWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options?: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; + listByServiceWithHttpOperationResponse(resourceGroupName: string, serviceName: string, options?: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Lists all comments for the Issue assosiated with the specified API. + * Lists a collection of authorization servers defined within a service + * instance. * * @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} [options] Optional Parameters. * - * @param {string} [options.filter] | Field | Supported operators | - * Supported functions | - * |-------------|------------------------|-----------------------------------| - * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | - * | userId | ge, le, eq, ne, gt, lt | substringof, startswith, + * @param {string} [options.filter] | Field | Supported operators | + * Supported functions | + * |-------|------------------------|---------------------------------------------| + * | id | ge, le, eq, ne, gt, lt | substringof, contains, startswith, + * endswith | + * | name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, * endswith | * * @param {number} [options.top] Number of records to return. @@ -6322,7 +6559,7 @@ export interface ApiIssueAttachment { * * {Promise} A promise is returned. * - * @resolve {IssueAttachmentCollection} - The deserialized result object. + * @resolve {AuthorizationServerCollection} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -6330,35 +6567,28 @@ export interface ApiIssueAttachment { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {IssueAttachmentCollection} [result] - The deserialized result object if an error did not occur. - * See {@link IssueAttachmentCollection} for more + * {AuthorizationServerCollection} [result] - The deserialized result object if an error did not occur. + * See {@link AuthorizationServerCollection} 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. */ - listByService(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options?: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }): Promise; - listByService(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, callback: ServiceCallback): void; - listByService(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, options: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByService(resourceGroupName: string, serviceName: string, options?: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }): Promise; + listByService(resourceGroupName: string, serviceName: string, callback: ServiceCallback): void; + listByService(resourceGroupName: string, serviceName: string, options: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets the entity state (Etag) version of the issue Attachment for an API - * specified by its identifier. + * Gets the entity state (Etag) version of the authorizationServer specified by + * its identifier. * * @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 {string} attachmentId Attachment identifier within an Issue. Must be - * unique in the current Issue. + * @param {string} authsid Identifier of the authorization server. * * @param {object} [options] Optional Parameters. * @@ -6371,24 +6601,17 @@ export interface ApiIssueAttachment { * * @reject {Error|ServiceError} - The error object. */ - getEntityTagWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getEntityTagWithHttpOperationResponse(resourceGroupName: string, serviceName: string, authsid: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets the entity state (Etag) version of the issue Attachment for an API - * specified by its identifier. + * Gets the entity state (Etag) version of the authorizationServer specified by + * its identifier. * * @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 {string} attachmentId Attachment identifier within an Issue. Must be - * unique in the current Issue. + * @param {string} authsid Identifier of the authorization server. * * @param {object} [options] Optional Parameters. * @@ -6416,27 +6639,19 @@ export interface ApiIssueAttachment { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - getEntityTag(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - getEntityTag(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, callback: ServiceCallback): void; - getEntityTag(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + getEntityTag(resourceGroupName: string, serviceName: string, authsid: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getEntityTag(resourceGroupName: string, serviceName: string, authsid: string, callback: ServiceCallback): void; + getEntityTag(resourceGroupName: string, serviceName: string, authsid: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets the details of the issue Attachment for an API specified by its - * identifier. + * Gets the details of the authorization server specified by its identifier. * * @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 {string} attachmentId Attachment identifier within an Issue. Must be - * unique in the current Issue. + * @param {string} authsid Identifier of the authorization server. * * @param {object} [options] Optional Parameters. * @@ -6445,28 +6660,20 @@ export interface ApiIssueAttachment { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, serviceName: string, authsid: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets the details of the issue Attachment for an API specified by its - * identifier. + * Gets the details of the authorization server specified by its identifier. * * @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 {string} attachmentId Attachment identifier within an Issue. Must be - * unique in the current Issue. + * @param {string} authsid Identifier of the authorization server. * * @param {object} [options] Optional Parameters. * @@ -6480,7 +6687,7 @@ export interface ApiIssueAttachment { * * {Promise} A promise is returned. * - * @resolve {IssueAttachmentContract} - The deserialized result object. + * @resolve {AuthorizationServerContract} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -6488,184 +6695,180 @@ export interface ApiIssueAttachment { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {IssueAttachmentContract} [result] - The deserialized result object if an error did not occur. - * See {@link IssueAttachmentContract} for more + * {AuthorizationServerContract} [result] - The deserialized result object if an error did not occur. + * See {@link AuthorizationServerContract} 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. */ - get(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, callback: ServiceCallback): void; - get(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, serviceName: string, authsid: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serviceName: string, authsid: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serviceName: string, authsid: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Creates a new Attachment for the Issue in an API or updates an existing one. + * Creates new authorization server or updates an existing authorization + * server. * * @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 {string} attachmentId Attachment identifier within an Issue. Must be - * unique in the current Issue. - * - * @param {object} parameters Create parameters. - * - * @param {string} parameters.title Filename by which the binary data will be - * saved. + * @param {string} authsid Identifier of the authorization server. * - * @param {string} parameters.contentFormat Either 'link' if content is - * provided via an HTTP link or the MIME type of the Base64-encoded binary data - * provided in the 'content' property. + * @param {object} parameters Create or update parameters. * - * @param {string} parameters.content An HTTP link or Base64-encoded binary - * data. + * @param {string} [parameters.description] Description of the authorization + * server. Can contain HTML formatting tags. * - * @param {object} [options] Optional Parameters. + * @param {array} [parameters.authorizationMethods] HTTP verbs supported by the + * authorization endpoint. GET must be always present. POST is optional. * - * @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 {array} [parameters.clientAuthenticationMethod] Method of + * authentication supported by the token endpoint of this authorization server. + * Possible values are Basic and/or Body. When Body is specified, client + * credentials and other parameters are passed within the request body in the + * application/x-www-form-urlencoded format. * - * @param {object} [options.customHeaders] Headers that will be added to the - * request + * @param {array} [parameters.tokenBodyParameters] Additional parameters + * required by the token endpoint of this authorization server represented as + * an array of JSON objects with name and value string properties, i.e. {"name" + * : "name value", "value": "a value"}. * - * @returns {Promise} A promise is returned + * @param {string} [parameters.tokenEndpoint] OAuth token endpoint. Contains + * absolute URI to entity being referenced. * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @param {boolean} [parameters.supportState] If true, authorization server + * will include state parameter from the authorization request to its response. + * Client may use state parameter to raise protocol security. * - * @reject {Error|ServiceError} - The error object. - */ - createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, parameters: models.IssueAttachmentContract, options?: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Creates a new Attachment for the Issue in an API or updates an existing one. + * @param {string} [parameters.defaultScope] Access token scope that is going + * to be requested by default. Can be overridden at the API level. Should be + * provided in the form of a string containing space-delimited values. * - * @param {string} resourceGroupName The name of the resource group. + * @param {array} [parameters.bearerTokenSendingMethods] Specifies the + * mechanism by which access token is passed to the API. * - * @param {string} serviceName The name of the API Management service. + * @param {string} [parameters.clientSecret] Client or app secret registered + * with this authorization server. * - * @param {string} apiId API identifier. Must be unique in the current API - * Management service instance. + * @param {string} [parameters.resourceOwnerUsername] Can be optionally + * specified when resource owner password grant type is supported by this + * authorization server. Default resource owner username. * - * @param {string} issueId Issue identifier. Must be unique in the current API - * Management service instance. + * @param {string} [parameters.resourceOwnerPassword] Can be optionally + * specified when resource owner password grant type is supported by this + * authorization server. Default resource owner password. * - * @param {string} attachmentId Attachment identifier within an Issue. Must be - * unique in the current Issue. + * @param {string} parameters.displayName User-friendly authorization server + * name. * - * @param {object} parameters Create parameters. + * @param {string} parameters.clientRegistrationEndpoint Optional reference to + * a page where client or app registration for this authorization server is + * performed. Contains absolute URL to entity being referenced. * - * @param {string} parameters.title Filename by which the binary data will be - * saved. + * @param {string} parameters.authorizationEndpoint OAuth authorization + * endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2. * - * @param {string} parameters.contentFormat Either 'link' if content is - * provided via an HTTP link or the MIME type of the Base64-encoded binary data - * provided in the 'content' property. + * @param {array} parameters.grantTypes Form of an authorization grant, which + * the client uses to request the access token. * - * @param {string} parameters.content An HTTP link or Base64-encoded binary - * data. + * @param {string} parameters.clientId Client or app id registered with this + * authorization server. * * @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 {string} [options.ifMatch] ETag of the Entity. Not required when + * creating an entity, but required when updating an entity. * * @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 {IssueAttachmentContract} - 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. - * - * {IssueAttachmentContract} [result] - The deserialized result object if an error did not occur. - * See {@link IssueAttachmentContract} for more - * information. + * @returns {Promise} A promise is returned * - * {WebResource} [request] - The HTTP Request object if an error did not occur. + * @resolve {HttpOperationResponse} - The deserialized result object. * - * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + * @reject {Error|ServiceError} - The error object. */ - createOrUpdate(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, parameters: models.IssueAttachmentContract, options?: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, parameters: models.IssueAttachmentContract, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, parameters: models.IssueAttachmentContract, options: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serviceName: string, authsid: string, parameters: models.AuthorizationServerContract, options?: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes the specified comment from an Issue. + * Creates new authorization server or updates an existing authorization + * server. * * @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} authsid Identifier of the authorization server. * - * @param {string} issueId Issue identifier. Must be unique in the current API - * Management service instance. + * @param {object} parameters Create or update parameters. * - * @param {string} attachmentId Attachment identifier within an Issue. Must be - * unique in the current Issue. + * @param {string} [parameters.description] Description of the authorization + * server. Can contain HTML formatting tags. * - * @param {string} 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 {array} [parameters.authorizationMethods] HTTP verbs supported by the + * authorization endpoint. GET must be always present. POST is optional. * - * @param {object} [options] Optional Parameters. + * @param {array} [parameters.clientAuthenticationMethod] Method of + * authentication supported by the token endpoint of this authorization server. + * Possible values are Basic and/or Body. When Body is specified, client + * credentials and other parameters are passed within the request body in the + * application/x-www-form-urlencoded format. * - * @param {object} [options.customHeaders] Headers that will be added to the - * request + * @param {array} [parameters.tokenBodyParameters] Additional parameters + * required by the token endpoint of this authorization server represented as + * an array of JSON objects with name and value string properties, i.e. {"name" + * : "name value", "value": "a value"}. * - * @returns {Promise} A promise is returned + * @param {string} [parameters.tokenEndpoint] OAuth token endpoint. Contains + * absolute URI to entity being referenced. * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @param {boolean} [parameters.supportState] If true, authorization server + * will include state parameter from the authorization request to its response. + * Client may use state parameter to raise protocol security. * - * @reject {Error|ServiceError} - The error object. - */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, ifMatch: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Deletes the specified comment from an Issue. + * @param {string} [parameters.defaultScope] Access token scope that is going + * to be requested by default. Can be overridden at the API level. Should be + * provided in the form of a string containing space-delimited values. * - * @param {string} resourceGroupName The name of the resource group. + * @param {array} [parameters.bearerTokenSendingMethods] Specifies the + * mechanism by which access token is passed to the API. * - * @param {string} serviceName The name of the API Management service. + * @param {string} [parameters.clientSecret] Client or app secret registered + * with this authorization server. * - * @param {string} apiId API identifier. Must be unique in the current API - * Management service instance. + * @param {string} [parameters.resourceOwnerUsername] Can be optionally + * specified when resource owner password grant type is supported by this + * authorization server. Default resource owner username. * - * @param {string} issueId Issue identifier. Must be unique in the current API - * Management service instance. + * @param {string} [parameters.resourceOwnerPassword] Can be optionally + * specified when resource owner password grant type is supported by this + * authorization server. Default resource owner password. * - * @param {string} attachmentId Attachment identifier within an Issue. Must be - * unique in the current Issue. + * @param {string} parameters.displayName User-friendly authorization server + * name. * - * @param {string} 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 {string} parameters.clientRegistrationEndpoint Optional reference to + * a page where client or app registration for this authorization server is + * performed. Contains absolute URL to entity being referenced. + * + * @param {string} parameters.authorizationEndpoint OAuth authorization + * endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2. + * + * @param {array} parameters.grantTypes Form of an authorization grant, which + * the client uses to request the access token. + * + * @param {string} parameters.clientId Client or app id registered with this + * authorization server. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.ifMatch] ETag of the Entity. Not required when + * creating an entity, but required when updating an entity. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -6676,7 +6879,7 @@ export interface ApiIssueAttachment { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {AuthorizationServerContract} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -6684,138 +6887,179 @@ export interface ApiIssueAttachment { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {AuthorizationServerContract} [result] - The deserialized result object if an error did not occur. + * See {@link AuthorizationServerContract} 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(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, ifMatch: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, ifMatch: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, serviceName: string, apiId: string, issueId: string, attachmentId: string, ifMatch: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serviceName: string, authsid: string, parameters: models.AuthorizationServerContract, options?: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, serviceName: string, authsid: string, parameters: models.AuthorizationServerContract, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serviceName: string, authsid: string, parameters: models.AuthorizationServerContract, options: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Lists all comments for the Issue assosiated with the specified API. + * Updates the details of the authorization server specified by its identifier. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} resourceGroupName The name of the resource group. * - * @param {object} [options] Optional Parameters. + * @param {string} serviceName The name of the API Management service. * - * @param {object} [options.customHeaders] Headers that will be added to the - * request + * @param {string} authsid Identifier of the authorization server. * - * @returns {Promise} A promise is returned + * @param {object} parameters OAuth2 Server settings Update parameters. * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @param {string} [parameters.description] Description of the authorization + * server. Can contain HTML formatting tags. * - * @reject {Error|ServiceError} - The error object. - */ - listByServiceNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Lists all comments for the Issue assosiated with the specified API. + * @param {array} [parameters.authorizationMethods] HTTP verbs supported by the + * authorization endpoint. GET must be always present. POST is optional. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {array} [parameters.clientAuthenticationMethod] Method of + * authentication supported by the token endpoint of this authorization server. + * Possible values are Basic and/or Body. When Body is specified, client + * credentials and other parameters are passed within the request body in the + * application/x-www-form-urlencoded format. * - * @param {object} [options] Optional Parameters. + * @param {array} [parameters.tokenBodyParameters] Additional parameters + * required by the token endpoint of this authorization server represented as + * an array of JSON objects with name and value string properties, i.e. {"name" + * : "name value", "value": "a value"}. * - * @param {object} [options.customHeaders] Headers that will be added to the - * request + * @param {string} [parameters.tokenEndpoint] OAuth token endpoint. Contains + * absolute URI to entity being referenced. * - * @param {ServiceCallback} [optionalCallback] - The optional callback. + * @param {boolean} [parameters.supportState] If true, authorization server + * will include state parameter from the authorization request to its response. + * Client may use state parameter to raise protocol security. * - * @returns {ServiceCallback|Promise} If a callback was passed as the last - * parameter then it returns the callback else returns a Promise. + * @param {string} [parameters.defaultScope] Access token scope that is going + * to be requested by default. Can be overridden at the API level. Should be + * provided in the form of a string containing space-delimited values. * - * {Promise} A promise is returned. + * @param {array} [parameters.bearerTokenSendingMethods] Specifies the + * mechanism by which access token is passed to the API. * - * @resolve {IssueAttachmentCollection} - The deserialized result object. + * @param {string} [parameters.clientSecret] Client or app secret registered + * with this authorization server. * - * @reject {Error|ServiceError} - The error object. + * @param {string} [parameters.resourceOwnerUsername] Can be optionally + * specified when resource owner password grant type is supported by this + * authorization server. Default resource owner username. * - * {ServiceCallback} optionalCallback(err, result, request, response) + * @param {string} [parameters.resourceOwnerPassword] Can be optionally + * specified when resource owner password grant type is supported by this + * authorization server. Default resource owner password. * - * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * @param {string} [parameters.displayName] User-friendly authorization server + * name. * - * {IssueAttachmentCollection} [result] - The deserialized result object if an error did not occur. - * See {@link IssueAttachmentCollection} for more - * information. + * @param {string} [parameters.clientRegistrationEndpoint] Optional reference + * to a page where client or app registration for this authorization server is + * performed. Contains absolute URL to entity being referenced. * - * {WebResource} [request] - The HTTP Request object if an error did not occur. + * @param {string} [parameters.authorizationEndpoint] OAuth authorization + * endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2. * - * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. - */ - listByServiceNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByServiceNext(nextPageLink: string, callback: ServiceCallback): void; - listByServiceNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * AuthorizationServer - * __NOTE__: An instance of this class is automatically created for an - * instance of the ApiManagementClient. - */ -export interface AuthorizationServer { - - - /** - * Lists a collection of authorization servers defined within a service - * instance. + * @param {array} [parameters.grantTypes] Form of an authorization grant, which + * the client uses to request the access token. * - * @param {string} resourceGroupName The name of the resource group. + * @param {string} [parameters.clientId] Client or app id registered with this + * authorization server. * - * @param {string} serviceName The name of the API Management service. + * @param {string} ifMatch ETag of the 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] Optional Parameters. * - * @param {string} [options.filter] | Field | Supported operators | - * Supported functions | - * |-------|------------------------|---------------------------------------------| - * | id | ge, le, eq, ne, gt, lt | substringof, contains, startswith, - * endswith | - * | name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, - * endswith | - * - * @param {number} [options.top] Number of records to return. - * - * @param {number} [options.skip] Number of records to skip. - * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByServiceWithHttpOperationResponse(resourceGroupName: string, serviceName: string, options?: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; + updateWithHttpOperationResponse(resourceGroupName: string, serviceName: string, authsid: string, parameters: models.AuthorizationServerUpdateContract, ifMatch: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Lists a collection of authorization servers defined within a service - * instance. + * Updates the details of the authorization server specified by its identifier. * * @param {string} resourceGroupName The name of the resource group. * * @param {string} serviceName The name of the API Management service. * - * @param {object} [options] Optional Parameters. + * @param {string} authsid Identifier of the authorization server. * - * @param {string} [options.filter] | Field | Supported operators | - * Supported functions | - * |-------|------------------------|---------------------------------------------| - * | id | ge, le, eq, ne, gt, lt | substringof, contains, startswith, - * endswith | - * | name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, - * endswith | + * @param {object} parameters OAuth2 Server settings Update parameters. * - * @param {number} [options.top] Number of records to return. + * @param {string} [parameters.description] Description of the authorization + * server. Can contain HTML formatting tags. * - * @param {number} [options.skip] Number of records to skip. + * @param {array} [parameters.authorizationMethods] HTTP verbs supported by the + * authorization endpoint. GET must be always present. POST is optional. + * + * @param {array} [parameters.clientAuthenticationMethod] Method of + * authentication supported by the token endpoint of this authorization server. + * Possible values are Basic and/or Body. When Body is specified, client + * credentials and other parameters are passed within the request body in the + * application/x-www-form-urlencoded format. + * + * @param {array} [parameters.tokenBodyParameters] Additional parameters + * required by the token endpoint of this authorization server represented as + * an array of JSON objects with name and value string properties, i.e. {"name" + * : "name value", "value": "a value"}. + * + * @param {string} [parameters.tokenEndpoint] OAuth token endpoint. Contains + * absolute URI to entity being referenced. + * + * @param {boolean} [parameters.supportState] If true, authorization server + * will include state parameter from the authorization request to its response. + * Client may use state parameter to raise protocol security. + * + * @param {string} [parameters.defaultScope] Access token scope that is going + * to be requested by default. Can be overridden at the API level. Should be + * provided in the form of a string containing space-delimited values. + * + * @param {array} [parameters.bearerTokenSendingMethods] Specifies the + * mechanism by which access token is passed to the API. + * + * @param {string} [parameters.clientSecret] Client or app secret registered + * with this authorization server. + * + * @param {string} [parameters.resourceOwnerUsername] Can be optionally + * specified when resource owner password grant type is supported by this + * authorization server. Default resource owner username. + * + * @param {string} [parameters.resourceOwnerPassword] Can be optionally + * specified when resource owner password grant type is supported by this + * authorization server. Default resource owner password. + * + * @param {string} [parameters.displayName] User-friendly authorization server + * name. + * + * @param {string} [parameters.clientRegistrationEndpoint] Optional reference + * to a page where client or app registration for this authorization server is + * performed. Contains absolute URL to entity being referenced. + * + * @param {string} [parameters.authorizationEndpoint] OAuth authorization + * endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2. + * + * @param {array} [parameters.grantTypes] Form of an authorization grant, which + * the client uses to request the access token. + * + * @param {string} [parameters.clientId] Client or app id registered with this + * authorization server. + * + * @param {string} ifMatch ETag of the 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] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -6827,7 +7071,7 @@ export interface AuthorizationServer { * * {Promise} A promise is returned. * - * @resolve {AuthorizationServerCollection} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -6835,22 +7079,19 @@ export interface AuthorizationServer { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {AuthorizationServerCollection} [result] - The deserialized result object if an error did not occur. - * See {@link AuthorizationServerCollection} for more - * information. + * {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. */ - listByService(resourceGroupName: string, serviceName: string, options?: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }): Promise; - listByService(resourceGroupName: string, serviceName: string, callback: ServiceCallback): void; - listByService(resourceGroupName: string, serviceName: string, options: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + update(resourceGroupName: string, serviceName: string, authsid: string, parameters: models.AuthorizationServerUpdateContract, ifMatch: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, serviceName: string, authsid: string, parameters: models.AuthorizationServerUpdateContract, ifMatch: string, callback: ServiceCallback): void; + update(resourceGroupName: string, serviceName: string, authsid: string, parameters: models.AuthorizationServerUpdateContract, ifMatch: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets the entity state (Etag) version of the authorizationServer specified by - * its identifier. + * Deletes specific authorization server instance. * * @param {string} resourceGroupName The name of the resource group. * @@ -6858,6 +7099,10 @@ export interface AuthorizationServer { * * @param {string} authsid Identifier of the authorization server. * + * @param {string} ifMatch ETag of the 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] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -6869,11 +7114,10 @@ export interface AuthorizationServer { * * @reject {Error|ServiceError} - The error object. */ - getEntityTagWithHttpOperationResponse(resourceGroupName: string, serviceName: string, authsid: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteMethodWithHttpOperationResponse(resourceGroupName: string, serviceName: string, authsid: string, ifMatch: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets the entity state (Etag) version of the authorizationServer specified by - * its identifier. + * Deletes specific authorization server instance. * * @param {string} resourceGroupName The name of the resource group. * @@ -6881,6 +7125,10 @@ export interface AuthorizationServer { * * @param {string} authsid Identifier of the authorization server. * + * @param {string} ifMatch ETag of the 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] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -6907,19 +7155,17 @@ export interface AuthorizationServer { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - getEntityTag(resourceGroupName: string, serviceName: string, authsid: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - getEntityTag(resourceGroupName: string, serviceName: string, authsid: string, callback: ServiceCallback): void; - getEntityTag(resourceGroupName: string, serviceName: string, authsid: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serviceName: string, authsid: string, ifMatch: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, serviceName: string, authsid: string, ifMatch: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serviceName: string, authsid: string, ifMatch: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets the details of the authorization server specified by its identifier. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} serviceName The name of the API Management service. + * Lists a collection of authorization servers defined within a service + * instance. * - * @param {string} authsid Identifier of the authorization server. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -6928,20 +7174,18 @@ export interface AuthorizationServer { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, serviceName: string, authsid: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByServiceNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets the details of the authorization server specified by its identifier. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} serviceName The name of the API Management service. + * Lists a collection of authorization servers defined within a service + * instance. * - * @param {string} authsid Identifier of the authorization server. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -6955,7 +7199,7 @@ export interface AuthorizationServer { * * {Promise} A promise is returned. * - * @resolve {AuthorizationServerContract} - The deserialized result object. + * @resolve {AuthorizationServerCollection} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -6963,179 +7207,211 @@ export interface AuthorizationServer { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {AuthorizationServerContract} [result] - The deserialized result object if an error did not occur. - * See {@link AuthorizationServerContract} for more + * {AuthorizationServerCollection} [result] - The deserialized result object if an error did not occur. + * See {@link AuthorizationServerCollection} 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. */ - get(resourceGroupName: string, serviceName: string, authsid: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, serviceName: string, authsid: string, callback: ServiceCallback): void; - get(resourceGroupName: string, serviceName: string, authsid: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - + listByServiceNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServiceNext(nextPageLink: string, callback: ServiceCallback): void; + listByServiceNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} - /** - * Creates new authorization server or updates an existing authorization - * server. - * +/** + * @class + * Backend + * __NOTE__: An instance of this class is automatically created for an + * instance of the ApiManagementClient. + */ +export interface Backend { + + + /** + * Lists a collection of backends in the specified service instance. + * * @param {string} resourceGroupName The name of the resource group. * * @param {string} serviceName The name of the API Management service. * - * @param {string} authsid Identifier of the authorization server. + * @param {object} [options] Optional Parameters. * - * @param {object} parameters Create or update parameters. + * @param {string} [options.filter] | Field | Supported operators | + * Supported functions | + * |-------|------------------------|---------------------------------------------| + * | id | ge, le, eq, ne, gt, lt | substringof, contains, startswith, + * endswith | + * | host | ge, le, eq, ne, gt, lt | substringof, contains, startswith, + * endswith | * - * @param {string} [parameters.description] Description of the authorization - * server. Can contain HTML formatting tags. + * @param {number} [options.top] Number of records to return. * - * @param {array} [parameters.authorizationMethods] HTTP verbs supported by the - * authorization endpoint. GET must be always present. POST is optional. + * @param {number} [options.skip] Number of records to skip. * - * @param {array} [parameters.clientAuthenticationMethod] Method of - * authentication supported by the token endpoint of this authorization server. - * Possible values are Basic and/or Body. When Body is specified, client - * credentials and other parameters are passed within the request body in the - * application/x-www-form-urlencoded format. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {array} [parameters.tokenBodyParameters] Additional parameters - * required by the token endpoint of this authorization server represented as - * an array of JSON objects with name and value string properties, i.e. {"name" - * : "name value", "value": "a value"}. + * @returns {Promise} A promise is returned * - * @param {string} [parameters.tokenEndpoint] OAuth token endpoint. Contains - * absolute URI to entity being referenced. + * @resolve {HttpOperationResponse} - The deserialized result object. * - * @param {boolean} [parameters.supportState] If true, authorization server - * will include state parameter from the authorization request to its response. - * Client may use state parameter to raise protocol security. + * @reject {Error|ServiceError} - The error object. + */ + listByServiceWithHttpOperationResponse(resourceGroupName: string, serviceName: string, options?: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists a collection of backends in the specified service instance. * - * @param {string} [parameters.defaultScope] Access token scope that is going - * to be requested by default. Can be overridden at the API level. Should be - * provided in the form of a string containing space-delimited values. + * @param {string} resourceGroupName The name of the resource group. * - * @param {array} [parameters.bearerTokenSendingMethods] Specifies the - * mechanism by which access token is passed to the API. + * @param {string} serviceName The name of the API Management service. * - * @param {string} [parameters.clientSecret] Client or app secret registered - * with this authorization server. + * @param {object} [options] Optional Parameters. * - * @param {string} [parameters.resourceOwnerUsername] Can be optionally - * specified when resource owner password grant type is supported by this - * authorization server. Default resource owner username. + * @param {string} [options.filter] | Field | Supported operators | + * Supported functions | + * |-------|------------------------|---------------------------------------------| + * | id | ge, le, eq, ne, gt, lt | substringof, contains, startswith, + * endswith | + * | host | ge, le, eq, ne, gt, lt | substringof, contains, startswith, + * endswith | * - * @param {string} [parameters.resourceOwnerPassword] Can be optionally - * specified when resource owner password grant type is supported by this - * authorization server. Default resource owner password. + * @param {number} [options.top] Number of records to return. * - * @param {string} parameters.displayName User-friendly authorization server - * name. + * @param {number} [options.skip] Number of records to skip. * - * @param {string} parameters.clientRegistrationEndpoint Optional reference to - * a page where client or app registration for this authorization server is - * performed. Contains absolute URL to entity being referenced. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {string} parameters.authorizationEndpoint OAuth authorization - * endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2. + * @param {ServiceCallback} [optionalCallback] - The optional callback. * - * @param {array} parameters.grantTypes Form of an authorization grant, which - * the client uses to request the access token. + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. * - * @param {string} parameters.clientId Client or app id registered with this - * authorization server. + * {Promise} A promise is returned. * - * @param {object} [options] Optional Parameters. + * @resolve {BackendCollection} - The deserialized result object. * - * @param {string} [options.ifMatch] ETag of the Entity. Not required when - * creating an entity, but required when updating an entity. + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {BackendCollection} [result] - The deserialized result object if an error did not occur. + * See {@link BackendCollection} 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. + */ + listByService(resourceGroupName: string, serviceName: string, options?: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }): Promise; + listByService(resourceGroupName: string, serviceName: string, callback: ServiceCallback): void; + listByService(resourceGroupName: string, serviceName: string, options: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the entity state (Etag) version of the backend specified by its + * identifier. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} serviceName The name of the API Management service. + * + * @param {string} backendid Identifier of the Backend entity. Must be unique + * in the current API Management service instance. + * + * @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. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serviceName: string, authsid: string, parameters: models.AuthorizationServerContract, options?: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + getEntityTagWithHttpOperationResponse(resourceGroupName: string, serviceName: string, backendid: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates new authorization server or updates an existing authorization - * server. + * Gets the entity state (Etag) version of the backend specified by its + * identifier. * * @param {string} resourceGroupName The name of the resource group. * * @param {string} serviceName The name of the API Management service. * - * @param {string} authsid Identifier of the authorization server. + * @param {string} backendid Identifier of the Backend entity. Must be unique + * in the current API Management service instance. * - * @param {object} parameters Create or update parameters. + * @param {object} [options] Optional Parameters. * - * @param {string} [parameters.description] Description of the authorization - * server. Can contain HTML formatting tags. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {array} [parameters.authorizationMethods] HTTP verbs supported by the - * authorization endpoint. GET must be always present. POST is optional. + * @param {ServiceCallback} [optionalCallback] - The optional callback. * - * @param {array} [parameters.clientAuthenticationMethod] Method of - * authentication supported by the token endpoint of this authorization server. - * Possible values are Basic and/or Body. When Body is specified, client - * credentials and other parameters are passed within the request body in the - * application/x-www-form-urlencoded format. + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. * - * @param {array} [parameters.tokenBodyParameters] Additional parameters - * required by the token endpoint of this authorization server represented as - * an array of JSON objects with name and value string properties, i.e. {"name" - * : "name value", "value": "a value"}. + * {Promise} A promise is returned. * - * @param {string} [parameters.tokenEndpoint] OAuth token endpoint. Contains - * absolute URI to entity being referenced. + * @resolve {null} - The deserialized result object. * - * @param {boolean} [parameters.supportState] If true, authorization server - * will include state parameter from the authorization request to its response. - * Client may use state parameter to raise protocol security. + * @reject {Error|ServiceError} - The error object. * - * @param {string} [parameters.defaultScope] Access token scope that is going - * to be requested by default. Can be overridden at the API level. Should be - * provided in the form of a string containing space-delimited values. + * {ServiceCallback} optionalCallback(err, result, request, response) * - * @param {array} [parameters.bearerTokenSendingMethods] Specifies the - * mechanism by which access token is passed to the API. + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * @param {string} [parameters.clientSecret] Client or app secret registered - * with this authorization server. + * {null} [result] - The deserialized result object if an error did not occur. * - * @param {string} [parameters.resourceOwnerUsername] Can be optionally - * specified when resource owner password grant type is supported by this - * authorization server. Default resource owner username. + * {WebResource} [request] - The HTTP Request object if an error did not occur. * - * @param {string} [parameters.resourceOwnerPassword] Can be optionally - * specified when resource owner password grant type is supported by this - * authorization server. Default resource owner password. + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + getEntityTag(resourceGroupName: string, serviceName: string, backendid: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getEntityTag(resourceGroupName: string, serviceName: string, backendid: string, callback: ServiceCallback): void; + getEntityTag(resourceGroupName: string, serviceName: string, backendid: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the details of the backend specified by its identifier. * - * @param {string} parameters.displayName User-friendly authorization server - * name. + * @param {string} resourceGroupName The name of the resource group. * - * @param {string} parameters.clientRegistrationEndpoint Optional reference to - * a page where client or app registration for this authorization server is - * performed. Contains absolute URL to entity being referenced. + * @param {string} serviceName The name of the API Management service. * - * @param {string} parameters.authorizationEndpoint OAuth authorization - * endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2. + * @param {string} backendid Identifier of the Backend entity. Must be unique + * in the current API Management service instance. * - * @param {array} parameters.grantTypes Form of an authorization grant, which - * the client uses to request the access token. + * @param {object} [options] Optional Parameters. * - * @param {string} parameters.clientId Client or app id registered with this - * authorization server. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {object} [options] Optional Parameters. + * @returns {Promise} A promise is returned * - * @param {string} [options.ifMatch] ETag of the Entity. Not required when - * creating an entity, but required when updating an entity. + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, serviceName: string, backendid: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the details of the backend specified by its identifier. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} serviceName The name of the API Management service. + * + * @param {string} backendid Identifier of the Backend entity. Must be unique + * in the current API Management service instance. + * + * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -7147,7 +7423,7 @@ export interface AuthorizationServer { * * {Promise} A promise is returned. * - * @resolve {AuthorizationServerContract} - The deserialized result object. + * @resolve {BackendContract} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -7155,575 +7431,31 @@ export interface AuthorizationServer { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {AuthorizationServerContract} [result] - The deserialized result object if an error did not occur. - * See {@link AuthorizationServerContract} for more - * information. + * {BackendContract} [result] - The deserialized result object if an error did not occur. + * See {@link BackendContract} 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. */ - createOrUpdate(resourceGroupName: string, serviceName: string, authsid: string, parameters: models.AuthorizationServerContract, options?: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, serviceName: string, authsid: string, parameters: models.AuthorizationServerContract, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, serviceName: string, authsid: string, parameters: models.AuthorizationServerContract, options: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, serviceName: string, backendid: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serviceName: string, backendid: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serviceName: string, backendid: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Updates the details of the authorization server specified by its identifier. + * Creates or Updates a backend. * * @param {string} resourceGroupName The name of the resource group. * * @param {string} serviceName The name of the API Management service. * - * @param {string} authsid Identifier of the authorization server. + * @param {string} backendid Identifier of the Backend entity. Must be unique + * in the current API Management service instance. * - * @param {object} parameters OAuth2 Server settings Update parameters. + * @param {object} parameters Create parameters. * - * @param {string} [parameters.description] Description of the authorization - * server. Can contain HTML formatting tags. - * - * @param {array} [parameters.authorizationMethods] HTTP verbs supported by the - * authorization endpoint. GET must be always present. POST is optional. - * - * @param {array} [parameters.clientAuthenticationMethod] Method of - * authentication supported by the token endpoint of this authorization server. - * Possible values are Basic and/or Body. When Body is specified, client - * credentials and other parameters are passed within the request body in the - * application/x-www-form-urlencoded format. - * - * @param {array} [parameters.tokenBodyParameters] Additional parameters - * required by the token endpoint of this authorization server represented as - * an array of JSON objects with name and value string properties, i.e. {"name" - * : "name value", "value": "a value"}. - * - * @param {string} [parameters.tokenEndpoint] OAuth token endpoint. Contains - * absolute URI to entity being referenced. - * - * @param {boolean} [parameters.supportState] If true, authorization server - * will include state parameter from the authorization request to its response. - * Client may use state parameter to raise protocol security. - * - * @param {string} [parameters.defaultScope] Access token scope that is going - * to be requested by default. Can be overridden at the API level. Should be - * provided in the form of a string containing space-delimited values. - * - * @param {array} [parameters.bearerTokenSendingMethods] Specifies the - * mechanism by which access token is passed to the API. - * - * @param {string} [parameters.clientSecret] Client or app secret registered - * with this authorization server. - * - * @param {string} [parameters.resourceOwnerUsername] Can be optionally - * specified when resource owner password grant type is supported by this - * authorization server. Default resource owner username. - * - * @param {string} [parameters.resourceOwnerPassword] Can be optionally - * specified when resource owner password grant type is supported by this - * authorization server. Default resource owner password. - * - * @param {string} [parameters.displayName] User-friendly authorization server - * name. - * - * @param {string} [parameters.clientRegistrationEndpoint] Optional reference - * to a page where client or app registration for this authorization server is - * performed. Contains absolute URL to entity being referenced. - * - * @param {string} [parameters.authorizationEndpoint] OAuth authorization - * endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2. - * - * @param {array} [parameters.grantTypes] Form of an authorization grant, which - * the client uses to request the access token. - * - * @param {string} [parameters.clientId] Client or app id registered with this - * authorization server. - * - * @param {string} ifMatch ETag of the 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] 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. - */ - updateWithHttpOperationResponse(resourceGroupName: string, serviceName: string, authsid: string, parameters: models.AuthorizationServerUpdateContract, ifMatch: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Updates the details of the authorization server specified by its identifier. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} serviceName The name of the API Management service. - * - * @param {string} authsid Identifier of the authorization server. - * - * @param {object} parameters OAuth2 Server settings Update parameters. - * - * @param {string} [parameters.description] Description of the authorization - * server. Can contain HTML formatting tags. - * - * @param {array} [parameters.authorizationMethods] HTTP verbs supported by the - * authorization endpoint. GET must be always present. POST is optional. - * - * @param {array} [parameters.clientAuthenticationMethod] Method of - * authentication supported by the token endpoint of this authorization server. - * Possible values are Basic and/or Body. When Body is specified, client - * credentials and other parameters are passed within the request body in the - * application/x-www-form-urlencoded format. - * - * @param {array} [parameters.tokenBodyParameters] Additional parameters - * required by the token endpoint of this authorization server represented as - * an array of JSON objects with name and value string properties, i.e. {"name" - * : "name value", "value": "a value"}. - * - * @param {string} [parameters.tokenEndpoint] OAuth token endpoint. Contains - * absolute URI to entity being referenced. - * - * @param {boolean} [parameters.supportState] If true, authorization server - * will include state parameter from the authorization request to its response. - * Client may use state parameter to raise protocol security. - * - * @param {string} [parameters.defaultScope] Access token scope that is going - * to be requested by default. Can be overridden at the API level. Should be - * provided in the form of a string containing space-delimited values. - * - * @param {array} [parameters.bearerTokenSendingMethods] Specifies the - * mechanism by which access token is passed to the API. - * - * @param {string} [parameters.clientSecret] Client or app secret registered - * with this authorization server. - * - * @param {string} [parameters.resourceOwnerUsername] Can be optionally - * specified when resource owner password grant type is supported by this - * authorization server. Default resource owner username. - * - * @param {string} [parameters.resourceOwnerPassword] Can be optionally - * specified when resource owner password grant type is supported by this - * authorization server. Default resource owner password. - * - * @param {string} [parameters.displayName] User-friendly authorization server - * name. - * - * @param {string} [parameters.clientRegistrationEndpoint] Optional reference - * to a page where client or app registration for this authorization server is - * performed. Contains absolute URL to entity being referenced. - * - * @param {string} [parameters.authorizationEndpoint] OAuth authorization - * endpoint. See http://tools.ietf.org/html/rfc6749#section-3.2. - * - * @param {array} [parameters.grantTypes] Form of an authorization grant, which - * the client uses to request the access token. - * - * @param {string} [parameters.clientId] Client or app id registered with this - * authorization server. - * - * @param {string} ifMatch ETag of the 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] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @param {ServiceCallback} [optionalCallback] - The optional callback. - * - * @returns {ServiceCallback|Promise} If a callback was passed as the last - * parameter then it returns the callback else returns a Promise. - * - * {Promise} A promise is returned. - * - * @resolve {null} - The deserialized result object. - * - * @reject {Error|ServiceError} - The error object. - * - * {ServiceCallback} optionalCallback(err, result, request, response) - * - * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. - * - * {null} [result] - The deserialized result object if an error did not occur. - * - * {WebResource} [request] - The HTTP Request object if an error did not occur. - * - * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. - */ - update(resourceGroupName: string, serviceName: string, authsid: string, parameters: models.AuthorizationServerUpdateContract, ifMatch: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - update(resourceGroupName: string, serviceName: string, authsid: string, parameters: models.AuthorizationServerUpdateContract, ifMatch: string, callback: ServiceCallback): void; - update(resourceGroupName: string, serviceName: string, authsid: string, parameters: models.AuthorizationServerUpdateContract, ifMatch: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Deletes specific authorization server instance. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} serviceName The name of the API Management service. - * - * @param {string} authsid Identifier of the authorization server. - * - * @param {string} ifMatch ETag of the 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] 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. - */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, serviceName: string, authsid: string, ifMatch: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Deletes specific authorization server instance. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} serviceName The name of the API Management service. - * - * @param {string} authsid Identifier of the authorization server. - * - * @param {string} ifMatch ETag of the 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] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @param {ServiceCallback} [optionalCallback] - The optional callback. - * - * @returns {ServiceCallback|Promise} If a callback was passed as the last - * parameter then it returns the callback else returns a Promise. - * - * {Promise} A promise is returned. - * - * @resolve {null} - The deserialized result object. - * - * @reject {Error|ServiceError} - The error object. - * - * {ServiceCallback} optionalCallback(err, result, request, response) - * - * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. - * - * {null} [result] - The deserialized result object if an error did not occur. - * - * {WebResource} [request] - The HTTP Request object if an error did not occur. - * - * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. - */ - deleteMethod(resourceGroupName: string, serviceName: string, authsid: string, ifMatch: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, serviceName: string, authsid: string, ifMatch: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, serviceName: string, authsid: string, ifMatch: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Lists a collection of authorization servers defined within a service - * instance. - * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. - * - * @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. - */ - listByServiceNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Lists a collection of authorization servers defined within a service - * instance. - * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. - * - * @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 {AuthorizationServerCollection} - 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. - * - * {AuthorizationServerCollection} [result] - The deserialized result object if an error did not occur. - * See {@link AuthorizationServerCollection} 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. - */ - listByServiceNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByServiceNext(nextPageLink: string, callback: ServiceCallback): void; - listByServiceNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * Backend - * __NOTE__: An instance of this class is automatically created for an - * instance of the ApiManagementClient. - */ -export interface Backend { - - - /** - * Lists a collection of backends in the specified service instance. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} serviceName The name of the API Management service. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.filter] | Field | Supported operators | - * Supported functions | - * |-------|------------------------|---------------------------------------------| - * | id | ge, le, eq, ne, gt, lt | substringof, contains, startswith, - * endswith | - * | host | ge, le, eq, ne, gt, lt | substringof, contains, startswith, - * endswith | - * - * @param {number} [options.top] Number of records to return. - * - * @param {number} [options.skip] Number of records to skip. - * - * @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. - */ - listByServiceWithHttpOperationResponse(resourceGroupName: string, serviceName: string, options?: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Lists a collection of backends in the specified service instance. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} serviceName The name of the API Management service. - * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.filter] | Field | Supported operators | - * Supported functions | - * |-------|------------------------|---------------------------------------------| - * | id | ge, le, eq, ne, gt, lt | substringof, contains, startswith, - * endswith | - * | host | ge, le, eq, ne, gt, lt | substringof, contains, startswith, - * endswith | - * - * @param {number} [options.top] Number of records to return. - * - * @param {number} [options.skip] Number of records to skip. - * - * @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 {BackendCollection} - 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. - * - * {BackendCollection} [result] - The deserialized result object if an error did not occur. - * See {@link BackendCollection} 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. - */ - listByService(resourceGroupName: string, serviceName: string, options?: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }): Promise; - listByService(resourceGroupName: string, serviceName: string, callback: ServiceCallback): void; - listByService(resourceGroupName: string, serviceName: string, options: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Gets the entity state (Etag) version of the backend specified by its - * identifier. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} serviceName The name of the API Management service. - * - * @param {string} backendid Identifier of the Backend entity. Must be unique - * in the current API Management service instance. - * - * @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. - */ - getEntityTagWithHttpOperationResponse(resourceGroupName: string, serviceName: string, backendid: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Gets the entity state (Etag) version of the backend specified by its - * identifier. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} serviceName The name of the API Management service. - * - * @param {string} backendid Identifier of the Backend entity. Must be unique - * in the current API Management service instance. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @param {ServiceCallback} [optionalCallback] - The optional callback. - * - * @returns {ServiceCallback|Promise} If a callback was passed as the last - * parameter then it returns the callback else returns a Promise. - * - * {Promise} A promise is returned. - * - * @resolve {null} - The deserialized result object. - * - * @reject {Error|ServiceError} - The error object. - * - * {ServiceCallback} optionalCallback(err, result, request, response) - * - * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. - * - * {null} [result] - The deserialized result object if an error did not occur. - * - * {WebResource} [request] - The HTTP Request object if an error did not occur. - * - * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. - */ - getEntityTag(resourceGroupName: string, serviceName: string, backendid: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - getEntityTag(resourceGroupName: string, serviceName: string, backendid: string, callback: ServiceCallback): void; - getEntityTag(resourceGroupName: string, serviceName: string, backendid: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Gets the details of the backend specified by its identifier. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} serviceName The name of the API Management service. - * - * @param {string} backendid Identifier of the Backend entity. Must be unique - * in the current API Management service instance. - * - * @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. - */ - getWithHttpOperationResponse(resourceGroupName: string, serviceName: string, backendid: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Gets the details of the backend specified by its identifier. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} serviceName The name of the API Management service. - * - * @param {string} backendid Identifier of the Backend entity. Must be unique - * in the current API Management service instance. - * - * @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 {BackendContract} - 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. - * - * {BackendContract} [result] - The deserialized result object if an error did not occur. - * See {@link BackendContract} 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. - */ - get(resourceGroupName: string, serviceName: string, backendid: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, serviceName: string, backendid: string, callback: ServiceCallback): void; - get(resourceGroupName: string, serviceName: string, backendid: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Creates or Updates a backend. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} serviceName The name of the API Management service. - * - * @param {string} backendid Identifier of the Backend entity. Must be unique - * in the current API Management service instance. - * - * @param {object} parameters Create parameters. - * - * @param {string} [parameters.title] Backend Title. + * @param {string} [parameters.title] Backend Title. * * @param {string} [parameters.description] Backend Description. * @@ -9513,234 +9245,7 @@ export interface ApiManagementService { /** - * Gets an API Management service resource description. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} serviceName The name of the API Management service. - * - * @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. - */ - getWithHttpOperationResponse(resourceGroupName: string, serviceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Gets an API Management service resource description. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} serviceName The name of the API Management service. - * - * @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 {ApiManagementServiceResource} - 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. - * - * {ApiManagementServiceResource} [result] - The deserialized result object if an error did not occur. - * See {@link ApiManagementServiceResource} 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. - */ - get(resourceGroupName: string, serviceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, serviceName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, serviceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Deletes an existing API Management service. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} serviceName The name of the API Management service. - * - * @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. - */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, serviceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Deletes an existing API Management service. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} serviceName The name of the API Management service. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @param {ServiceCallback} [optionalCallback] - The optional callback. - * - * @returns {ServiceCallback|Promise} If a callback was passed as the last - * parameter then it returns the callback else returns a Promise. - * - * {Promise} A promise is returned. - * - * @resolve {null} - The deserialized result object. - * - * @reject {Error|ServiceError} - The error object. - * - * {ServiceCallback} optionalCallback(err, result, request, response) - * - * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. - * - * {null} [result] - The deserialized result object if an error did not occur. - * - * {WebResource} [request] - The HTTP Request object if an error did not occur. - * - * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. - */ - deleteMethod(resourceGroupName: string, serviceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, serviceName: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, serviceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * List all API Management services within a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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. - */ - listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * List all API Management services within a resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @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 {ApiManagementServiceListResult} - 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. - * - * {ApiManagementServiceListResult} [result] - The deserialized result object if an error did not occur. - * See {@link ApiManagementServiceListResult} 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. - */ - listByResourceGroup(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; - listByResourceGroup(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Lists all API Management services within an Azure subscription. - * - * @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. - */ - listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Lists all API Management services within an Azure subscription. - * - * @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 {ApiManagementServiceListResult} - 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. - * - * {ApiManagementServiceListResult} [result] - The deserialized result object if an error did not occur. - * See {@link ApiManagementServiceListResult} 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?: { customHeaders? : { [headerName: string]: string; } }): Promise; - list(callback: ServiceCallback): void; - list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Gets the Single-Sign-On token for the API Management Service which is valid - * for 5 Minutes. + * Gets an API Management service resource description. * * @param {string} resourceGroupName The name of the resource group. * @@ -9753,15 +9258,14 @@ export interface ApiManagementService { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getSsoTokenWithHttpOperationResponse(resourceGroupName: string, serviceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, serviceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets the Single-Sign-On token for the API Management Service which is valid - * for 5 Minutes. + * Gets an API Management service resource description. * * @param {string} resourceGroupName The name of the resource group. * @@ -9779,7 +9283,7 @@ export interface ApiManagementService { * * {Promise} A promise is returned. * - * @resolve {ApiManagementServiceGetSsoTokenResult} - The deserialized result object. + * @resolve {ApiManagementServiceResource} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -9787,26 +9291,25 @@ export interface ApiManagementService { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ApiManagementServiceGetSsoTokenResult} [result] - The deserialized result object if an error did not occur. - * See {@link ApiManagementServiceGetSsoTokenResult} for - * more information. + * {ApiManagementServiceResource} [result] - The deserialized result object if an error did not occur. + * See {@link ApiManagementServiceResource} 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. */ - getSsoToken(resourceGroupName: string, serviceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - getSsoToken(resourceGroupName: string, serviceName: string, callback: ServiceCallback): void; - getSsoToken(resourceGroupName: string, serviceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, serviceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serviceName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serviceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Checks availability and correctness of a name for an API Management service. + * Deletes an existing API Management service. * - * @param {object} parameters Parameters supplied to the CheckNameAvailability - * operation. + * @param {string} resourceGroupName The name of the resource group. * - * @param {string} parameters.name The name to check for availability. + * @param {string} serviceName The name of the API Management service. * * @param {object} [options] Optional Parameters. * @@ -9815,19 +9318,18 @@ export interface ApiManagementService { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - checkNameAvailabilityWithHttpOperationResponse(parameters: models.ApiManagementServiceCheckNameAvailabilityParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteMethodWithHttpOperationResponse(resourceGroupName: string, serviceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Checks availability and correctness of a name for an API Management service. + * Deletes an existing API Management service. * - * @param {object} parameters Parameters supplied to the CheckNameAvailability - * operation. + * @param {string} resourceGroupName The name of the resource group. * - * @param {string} parameters.name The name to check for availability. + * @param {string} serviceName The name of the API Management service. * * @param {object} [options] Optional Parameters. * @@ -9841,7 +9343,7 @@ export interface ApiManagementService { * * {Promise} A promise is returned. * - * @resolve {ApiManagementServiceNameAvailabilityResult} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -9849,68 +9351,42 @@ export interface ApiManagementService { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ApiManagementServiceNameAvailabilityResult} [result] - The deserialized result object if an error did not occur. - * See {@link ApiManagementServiceNameAvailabilityResult} - * for more information. + * {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. */ - checkNameAvailability(parameters: models.ApiManagementServiceCheckNameAvailabilityParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - checkNameAvailability(parameters: models.ApiManagementServiceCheckNameAvailabilityParameters, callback: ServiceCallback): void; - checkNameAvailability(parameters: models.ApiManagementServiceCheckNameAvailabilityParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serviceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, serviceName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serviceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Updates the Microsoft.ApiManagement resource running in the Virtual network - * to pick the updated network settings. + * List all API Management services within a resource group. * * @param {string} resourceGroupName The name of the resource group. * - * @param {string} serviceName The name of the API Management service. - * * @param {object} [options] Optional Parameters. * - * @param {object} [options.parameters] Parameters supplied to the Apply - * Network Configuration operation. If the parameters are empty, all the - * regions in which the Api Management service is deployed will be updated - * sequentially without incurring downtime in the region. - * - * @param {string} [options.parameters.location] Location of the Api Management - * service to update for a multi-region service. For a service deployed in a - * single region, this parameter is not required. - * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - applyNetworkConfigurationUpdatesWithHttpOperationResponse(resourceGroupName: string, serviceName: string, options?: { parameters? : models.ApiManagementServiceApplyNetworkConfigurationParameters, customHeaders? : { [headerName: string]: string; } }): Promise>; + listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Updates the Microsoft.ApiManagement resource running in the Virtual network - * to pick the updated network settings. + * List all API Management services within a resource group. * * @param {string} resourceGroupName The name of the resource group. * - * @param {string} serviceName The name of the API Management service. - * * @param {object} [options] Optional Parameters. * - * @param {object} [options.parameters] Parameters supplied to the Apply - * Network Configuration operation. If the parameters are empty, all the - * regions in which the Api Management service is deployed will be updated - * sequentially without incurring downtime in the region. - * - * @param {string} [options.parameters.location] Location of the Api Management - * service to update for a multi-region service. For a service deployed in a - * single region, this parameter is not required. - * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -9921,7 +9397,7 @@ export interface ApiManagementService { * * {Promise} A promise is returned. * - * @resolve {ApiManagementServiceResource} - The deserialized result object. + * @resolve {ApiManagementServiceListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -9929,36 +9405,21 @@ export interface ApiManagementService { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ApiManagementServiceResource} [result] - The deserialized result object if an error did not occur. - * See {@link ApiManagementServiceResource} for more + * {ApiManagementServiceListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ApiManagementServiceListResult} 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. */ - applyNetworkConfigurationUpdates(resourceGroupName: string, serviceName: string, options?: { parameters? : models.ApiManagementServiceApplyNetworkConfigurationParameters, customHeaders? : { [headerName: string]: string; } }): Promise; - applyNetworkConfigurationUpdates(resourceGroupName: string, serviceName: string, callback: ServiceCallback): void; - applyNetworkConfigurationUpdates(resourceGroupName: string, serviceName: string, options: { parameters? : models.ApiManagementServiceApplyNetworkConfigurationParameters, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByResourceGroup(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; + listByResourceGroup(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Upload Custom Domain SSL certificate for an API Management service. This - * operation will be deprecated in future releases. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} serviceName The name of the API Management service. - * - * @param {object} parameters Parameters supplied to the Upload SSL certificate - * for an API Management service operation. - * - * @param {string} parameters.type Hostname type. Possible values include: - * 'Proxy', 'Portal', 'Management', 'Scm' - * - * @param {string} parameters.certificate Base64 Encoded certificate. - * - * @param {string} parameters.certificatePassword Certificate password. + * Lists all API Management services within an Azure subscription. * * @param {object} [options] Optional Parameters. * @@ -9967,29 +9428,14 @@ export interface ApiManagementService { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - uploadCertificateWithHttpOperationResponse(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceUploadCertificateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Upload Custom Domain SSL certificate for an API Management service. This - * operation will be deprecated in future releases. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} serviceName The name of the API Management service. - * - * @param {object} parameters Parameters supplied to the Upload SSL certificate - * for an API Management service operation. - * - * @param {string} parameters.type Hostname type. Possible values include: - * 'Proxy', 'Portal', 'Management', 'Scm' - * - * @param {string} parameters.certificate Base64 Encoded certificate. - * - * @param {string} parameters.certificatePassword Certificate password. + * Lists all API Management services within an Azure subscription. * * @param {object} [options] Optional Parameters. * @@ -10003,7 +9449,7 @@ export interface ApiManagementService { * * {Promise} A promise is returned. * - * @resolve {CertificateInformation} - The deserialized result object. + * @resolve {ApiManagementServiceListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -10011,36 +9457,27 @@ export interface ApiManagementService { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {CertificateInformation} [result] - The deserialized result object if an error did not occur. - * See {@link CertificateInformation} for more + * {ApiManagementServiceListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ApiManagementServiceListResult} 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. */ - uploadCertificate(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceUploadCertificateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - uploadCertificate(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceUploadCertificateParameters, callback: ServiceCallback): void; - uploadCertificate(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceUploadCertificateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Creates, updates, or deletes the custom hostnames for an API Management - * service. The custom hostname can be applied to the Proxy and Portal - * endpoint. This is a long running operation and could take several minutes to - * complete. This operation will be deprecated in the next version update. + * Gets the Single-Sign-On token for the API Management Service which is valid + * for 5 Minutes. * * @param {string} resourceGroupName The name of the resource group. * * @param {string} serviceName The name of the API Management service. * - * @param {object} parameters Parameters supplied to the UpdateHostname - * operation. - * - * @param {array} [parameters.update] Hostnames to create or update. - * - * @param {array} [parameters.deleteProperty] Hostnames types to delete. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -10048,29 +9485,20 @@ export interface ApiManagementService { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - updateHostnameWithHttpOperationResponse(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceUpdateHostnameParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getSsoTokenWithHttpOperationResponse(resourceGroupName: string, serviceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates, updates, or deletes the custom hostnames for an API Management - * service. The custom hostname can be applied to the Proxy and Portal - * endpoint. This is a long running operation and could take several minutes to - * complete. This operation will be deprecated in the next version update. + * Gets the Single-Sign-On token for the API Management Service which is valid + * for 5 Minutes. * * @param {string} resourceGroupName The name of the resource group. * * @param {string} serviceName The name of the API Management service. * - * @param {object} parameters Parameters supplied to the UpdateHostname - * operation. - * - * @param {array} [parameters.update] Hostnames to create or update. - * - * @param {array} [parameters.deleteProperty] Hostnames types to delete. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -10083,7 +9511,7 @@ export interface ApiManagementService { * * {Promise} A promise is returned. * - * @resolve {ApiManagementServiceResource} - The deserialized result object. + * @resolve {ApiManagementServiceGetSsoTokenResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -10091,41 +9519,26 @@ export interface ApiManagementService { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ApiManagementServiceResource} [result] - The deserialized result object if an error did not occur. - * See {@link ApiManagementServiceResource} for more - * information. + * {ApiManagementServiceGetSsoTokenResult} [result] - The deserialized result object if an error did not occur. + * See {@link ApiManagementServiceGetSsoTokenResult} 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. */ - updateHostname(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceUpdateHostnameParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - updateHostname(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceUpdateHostnameParameters, callback: ServiceCallback): void; - updateHostname(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceUpdateHostnameParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + getSsoToken(resourceGroupName: string, serviceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getSsoToken(resourceGroupName: string, serviceName: string, callback: ServiceCallback): void; + getSsoToken(resourceGroupName: string, serviceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Restores a backup of an API Management service created using the - * ApiManagementService_Backup operation on the current service. This is a long - * running operation and could take several minutes to complete. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} serviceName The name of the API Management service. - * - * @param {object} parameters Parameters supplied to the Restore API Management - * service from backup operation. - * - * @param {string} parameters.storageAccount Azure Cloud Storage account (used - * to place/retrieve the backup) name. - * - * @param {string} parameters.accessKey Azure Cloud Storage account (used to - * place/retrieve the backup) access key. + * Checks availability and correctness of a name for an API Management service. * - * @param {string} parameters.containerName Azure Cloud Storage blob container - * name used to place/retrieve the backup. + * @param {object} parameters Parameters supplied to the CheckNameAvailability + * operation. * - * @param {string} parameters.backupName The name of the backup file to create. + * @param {string} parameters.name The name to check for availability. * * @param {object} [options] Optional Parameters. * @@ -10134,34 +9547,19 @@ export interface ApiManagementService { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginRestoreWithHttpOperationResponse(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceBackupRestoreParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + checkNameAvailabilityWithHttpOperationResponse(parameters: models.ApiManagementServiceCheckNameAvailabilityParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Restores a backup of an API Management service created using the - * ApiManagementService_Backup operation on the current service. This is a long - * running operation and could take several minutes to complete. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} serviceName The name of the API Management service. - * - * @param {object} parameters Parameters supplied to the Restore API Management - * service from backup operation. - * - * @param {string} parameters.storageAccount Azure Cloud Storage account (used - * to place/retrieve the backup) name. - * - * @param {string} parameters.accessKey Azure Cloud Storage account (used to - * place/retrieve the backup) access key. + * Checks availability and correctness of a name for an API Management service. * - * @param {string} parameters.containerName Azure Cloud Storage blob container - * name used to place/retrieve the backup. + * @param {object} parameters Parameters supplied to the CheckNameAvailability + * operation. * - * @param {string} parameters.backupName The name of the backup file to create. + * @param {string} parameters.name The name to check for availability. * * @param {object} [options] Optional Parameters. * @@ -10175,7 +9573,7 @@ export interface ApiManagementService { * * {Promise} A promise is returned. * - * @resolve {ApiManagementServiceResource} - The deserialized result object. + * @resolve {ApiManagementServiceNameAvailabilityResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -10183,43 +9581,37 @@ export interface ApiManagementService { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ApiManagementServiceResource} [result] - The deserialized result object if an error did not occur. - * See {@link ApiManagementServiceResource} for more - * information. + * {ApiManagementServiceNameAvailabilityResult} [result] - The deserialized result object if an error did not occur. + * See {@link ApiManagementServiceNameAvailabilityResult} + * 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. */ - beginRestore(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceBackupRestoreParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginRestore(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceBackupRestoreParameters, callback: ServiceCallback): void; - beginRestore(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceBackupRestoreParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + checkNameAvailability(parameters: models.ApiManagementServiceCheckNameAvailabilityParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + checkNameAvailability(parameters: models.ApiManagementServiceCheckNameAvailabilityParameters, callback: ServiceCallback): void; + checkNameAvailability(parameters: models.ApiManagementServiceCheckNameAvailabilityParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Creates a backup of the API Management service to the given Azure Storage - * Account. This is long running operation and could take several minutes to - * complete. + * Updates the Microsoft.ApiManagement resource running in the Virtual network + * to pick the updated network settings. * * @param {string} resourceGroupName The name of the resource group. * * @param {string} serviceName The name of the API Management service. * - * @param {object} parameters Parameters supplied to the - * ApiManagementService_Backup operation. - * - * @param {string} parameters.storageAccount Azure Cloud Storage account (used - * to place/retrieve the backup) name. - * - * @param {string} parameters.accessKey Azure Cloud Storage account (used to - * place/retrieve the backup) access key. - * - * @param {string} parameters.containerName Azure Cloud Storage blob container - * name used to place/retrieve the backup. + * @param {object} [options] Optional Parameters. * - * @param {string} parameters.backupName The name of the backup file to create. + * @param {object} [options.parameters] Parameters supplied to the Apply + * Network Configuration operation. If the parameters are empty, all the + * regions in which the Api Management service is deployed will be updated + * sequentially without incurring downtime in the region. * - * @param {object} [options] Optional Parameters. + * @param {string} [options.parameters.location] Location of the Api Management + * service to update for a multi-region service. For a service deployed in a + * single region, this parameter is not required. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -10230,32 +9622,26 @@ export interface ApiManagementService { * * @reject {Error|ServiceError} - The error object. */ - beginBackupWithHttpOperationResponse(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceBackupRestoreParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + applyNetworkConfigurationUpdatesWithHttpOperationResponse(resourceGroupName: string, serviceName: string, options?: { parameters? : models.ApiManagementServiceApplyNetworkConfigurationParameters, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates a backup of the API Management service to the given Azure Storage - * Account. This is long running operation and could take several minutes to - * complete. + * Updates the Microsoft.ApiManagement resource running in the Virtual network + * to pick the updated network settings. * * @param {string} resourceGroupName The name of the resource group. * * @param {string} serviceName The name of the API Management service. * - * @param {object} parameters Parameters supplied to the - * ApiManagementService_Backup operation. - * - * @param {string} parameters.storageAccount Azure Cloud Storage account (used - * to place/retrieve the backup) name. - * - * @param {string} parameters.accessKey Azure Cloud Storage account (used to - * place/retrieve the backup) access key. - * - * @param {string} parameters.containerName Azure Cloud Storage blob container - * name used to place/retrieve the backup. + * @param {object} [options] Optional Parameters. * - * @param {string} parameters.backupName The name of the backup file to create. + * @param {object} [options.parameters] Parameters supplied to the Apply + * Network Configuration operation. If the parameters are empty, all the + * regions in which the Api Management service is deployed will be updated + * sequentially without incurring downtime in the region. * - * @param {object} [options] Optional Parameters. + * @param {string} [options.parameters.location] Location of the Api Management + * service to update for a multi-region service. For a service deployed in a + * single region, this parameter is not required. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -10283,78 +9669,28 @@ export interface ApiManagementService { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginBackup(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceBackupRestoreParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginBackup(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceBackupRestoreParameters, callback: ServiceCallback): void; - beginBackup(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceBackupRestoreParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + applyNetworkConfigurationUpdates(resourceGroupName: string, serviceName: string, options?: { parameters? : models.ApiManagementServiceApplyNetworkConfigurationParameters, customHeaders? : { [headerName: string]: string; } }): Promise; + applyNetworkConfigurationUpdates(resourceGroupName: string, serviceName: string, callback: ServiceCallback): void; + applyNetworkConfigurationUpdates(resourceGroupName: string, serviceName: string, options: { parameters? : models.ApiManagementServiceApplyNetworkConfigurationParameters, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Creates or updates an API Management service. This is long running operation - * and could take several minutes to complete. + * Upload Custom Domain SSL certificate for an API Management service. This + * operation will be deprecated in future releases. * * @param {string} resourceGroupName The name of the resource group. * * @param {string} serviceName The name of the API Management service. * - * @param {object} parameters Parameters supplied to the CreateOrUpdate API - * Management service operation. - * - * @param {string} [parameters.notificationSenderEmail] Email address from - * which the notification will be sent. - * - * @param {array} [parameters.hostnameConfigurations] Custom hostname - * configuration of the API Management service. - * - * @param {object} [parameters.virtualNetworkConfiguration] Virtual network - * configuration of the API Management service. - * - * @param {string} [parameters.virtualNetworkConfiguration.subnetResourceId] - * The full resource ID of a subnet in a virtual network to deploy the API - * Management service in. - * - * @param {array} [parameters.additionalLocations] Additional datacenter - * locations of the API Management service. - * - * @param {object} [parameters.customProperties] Custom properties of the API - * Management service. Setting - * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` - * will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 - * and 1.2). Setting - * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can - * be used to disable just TLS 1.1 and setting - * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can - * be used to disable TLS 1.0 on an API Management service. - * - * @param {array} [parameters.certificates] List of Certificates that need to - * be installed in the API Management service. Max supported certificates that - * can be installed is 10. - * - * @param {string} [parameters.virtualNetworkType] The type of VPN in which API - * Managemet service needs to be configured in. None (Default Value) means the - * API Management service is not part of any Virtual Network, External means - * the API Management deployment is set up inside a Virtual Network having an - * Internet Facing Endpoint, and Internal means that API Management deployment - * is setup inside a Virtual Network having an Intranet Facing Endpoint only. - * Possible values include: 'None', 'External', 'Internal' - * - * @param {string} parameters.publisherEmail Publisher email. - * - * @param {string} parameters.publisherName Publisher name. - * - * @param {object} parameters.sku SKU properties of the API Management service. - * - * @param {string} parameters.sku.name Name of the Sku. Possible values - * include: 'Developer', 'Standard', 'Premium', 'Basic' - * - * @param {number} [parameters.sku.capacity] Capacity of the SKU (number of - * deployed units of the SKU). The default value is 1. + * @param {object} parameters Parameters supplied to the Upload SSL certificate + * for an API Management service operation. * - * @param {object} [parameters.identity] Managed service identity of the Api - * Management service. + * @param {string} parameters.type Hostname type. Possible values include: + * 'Proxy', 'Portal', 'Management', 'Scm' * - * @param {string} parameters.location Resource location. + * @param {string} parameters.certificate Base64 Encoded certificate. * - * @param {object} [parameters.tags] Resource tags. + * @param {string} parameters.certificatePassword Certificate password. * * @param {object} [options] Optional Parameters. * @@ -10363,79 +9699,29 @@ export interface ApiManagementService { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + uploadCertificateWithHttpOperationResponse(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceUploadCertificateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates or updates an API Management service. This is long running operation - * and could take several minutes to complete. + * Upload Custom Domain SSL certificate for an API Management service. This + * operation will be deprecated in future releases. * * @param {string} resourceGroupName The name of the resource group. * * @param {string} serviceName The name of the API Management service. * - * @param {object} parameters Parameters supplied to the CreateOrUpdate API - * Management service operation. - * - * @param {string} [parameters.notificationSenderEmail] Email address from - * which the notification will be sent. - * - * @param {array} [parameters.hostnameConfigurations] Custom hostname - * configuration of the API Management service. - * - * @param {object} [parameters.virtualNetworkConfiguration] Virtual network - * configuration of the API Management service. - * - * @param {string} [parameters.virtualNetworkConfiguration.subnetResourceId] - * The full resource ID of a subnet in a virtual network to deploy the API - * Management service in. - * - * @param {array} [parameters.additionalLocations] Additional datacenter - * locations of the API Management service. - * - * @param {object} [parameters.customProperties] Custom properties of the API - * Management service. Setting - * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` - * will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 - * and 1.2). Setting - * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can - * be used to disable just TLS 1.1 and setting - * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can - * be used to disable TLS 1.0 on an API Management service. - * - * @param {array} [parameters.certificates] List of Certificates that need to - * be installed in the API Management service. Max supported certificates that - * can be installed is 10. - * - * @param {string} [parameters.virtualNetworkType] The type of VPN in which API - * Managemet service needs to be configured in. None (Default Value) means the - * API Management service is not part of any Virtual Network, External means - * the API Management deployment is set up inside a Virtual Network having an - * Internet Facing Endpoint, and Internal means that API Management deployment - * is setup inside a Virtual Network having an Intranet Facing Endpoint only. - * Possible values include: 'None', 'External', 'Internal' - * - * @param {string} parameters.publisherEmail Publisher email. - * - * @param {string} parameters.publisherName Publisher name. - * - * @param {object} parameters.sku SKU properties of the API Management service. - * - * @param {string} parameters.sku.name Name of the Sku. Possible values - * include: 'Developer', 'Standard', 'Premium', 'Basic' - * - * @param {number} [parameters.sku.capacity] Capacity of the SKU (number of - * deployed units of the SKU). The default value is 1. + * @param {object} parameters Parameters supplied to the Upload SSL certificate + * for an API Management service operation. * - * @param {object} [parameters.identity] Managed service identity of the Api - * Management service. + * @param {string} parameters.type Hostname type. Possible values include: + * 'Proxy', 'Portal', 'Management', 'Scm' * - * @param {string} parameters.location Resource location. + * @param {string} parameters.certificate Base64 Encoded certificate. * - * @param {object} [parameters.tags] Resource tags. + * @param {string} parameters.certificatePassword Certificate password. * * @param {object} [options] Optional Parameters. * @@ -10449,7 +9735,7 @@ export interface ApiManagementService { * * {Promise} A promise is returned. * - * @resolve {ApiManagementServiceResource} - The deserialized result object. + * @resolve {CertificateInformation} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -10457,163 +9743,157 @@ export interface ApiManagementService { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ApiManagementServiceResource} [result] - The deserialized result object if an error did not occur. - * See {@link ApiManagementServiceResource} for more + * {CertificateInformation} [result] - The deserialized result object if an error did not occur. + * See {@link CertificateInformation} 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. */ - beginCreateOrUpdate(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginCreateOrUpdate(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceResource, callback: ServiceCallback): void; - beginCreateOrUpdate(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceResource, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + uploadCertificate(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceUploadCertificateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + uploadCertificate(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceUploadCertificateParameters, callback: ServiceCallback): void; + uploadCertificate(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceUploadCertificateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Updates an existing API Management service. + * Creates, updates, or deletes the custom hostnames for an API Management + * service. The custom hostname can be applied to the Proxy and Portal + * endpoint. This is a long running operation and could take several minutes to + * complete. This operation will be deprecated in the next version update. * * @param {string} resourceGroupName The name of the resource group. * * @param {string} serviceName The name of the API Management service. * - * @param {object} parameters Parameters supplied to the CreateOrUpdate API - * Management service operation. - * - * @param {string} [parameters.notificationSenderEmail] Email address from - * which the notification will be sent. - * - * @param {array} [parameters.hostnameConfigurations] Custom hostname - * configuration of the API Management service. - * - * @param {object} [parameters.virtualNetworkConfiguration] Virtual network - * configuration of the API Management service. + * @param {object} parameters Parameters supplied to the UpdateHostname + * operation. * - * @param {string} [parameters.virtualNetworkConfiguration.subnetResourceId] - * The full resource ID of a subnet in a virtual network to deploy the API - * Management service in. + * @param {array} [parameters.update] Hostnames to create or update. * - * @param {array} [parameters.additionalLocations] Additional datacenter - * locations of the API Management service. + * @param {array} [parameters.deleteProperty] Hostnames types to delete. * - * @param {object} [parameters.customProperties] Custom properties of the API - * Management service. Setting - * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` - * will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 - * and 1.2). Setting - * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can - * be used to disable just TLS 1.1 and setting - * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can - * be used to disable TLS 1.0 on an API Management service. + * @param {object} [options] Optional Parameters. * - * @param {array} [parameters.certificates] List of Certificates that need to - * be installed in the API Management service. Max supported certificates that - * can be installed is 10. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {string} [parameters.virtualNetworkType] The type of VPN in which API - * Managemet service needs to be configured in. None (Default Value) means the - * API Management service is not part of any Virtual Network, External means - * the API Management deployment is set up inside a Virtual Network having an - * Internet Facing Endpoint, and Internal means that API Management deployment - * is setup inside a Virtual Network having an Intranet Facing Endpoint only. - * Possible values include: 'None', 'External', 'Internal' + * @returns {Promise} A promise is returned * - * @param {string} [parameters.publisherEmail] Publisher email. + * @resolve {HttpOperationResponse} - The deserialized result object. * - * @param {string} [parameters.publisherName] Publisher name. + * @reject {Error|ServiceError} - The error object. + */ + updateHostnameWithHttpOperationResponse(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceUpdateHostnameParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates, updates, or deletes the custom hostnames for an API Management + * service. The custom hostname can be applied to the Proxy and Portal + * endpoint. This is a long running operation and could take several minutes to + * complete. This operation will be deprecated in the next version update. * - * @param {object} [parameters.sku] SKU properties of the API Management - * service. + * @param {string} resourceGroupName The name of the resource group. * - * @param {string} parameters.sku.name Name of the Sku. Possible values - * include: 'Developer', 'Standard', 'Premium', 'Basic' + * @param {string} serviceName The name of the API Management service. * - * @param {number} [parameters.sku.capacity] Capacity of the SKU (number of - * deployed units of the SKU). The default value is 1. + * @param {object} parameters Parameters supplied to the UpdateHostname + * operation. * - * @param {object} [parameters.identity] Managed service identity of the Api - * Management service. + * @param {array} [parameters.update] Hostnames to create or update. * - * @param {object} [parameters.tags] Resource tags. + * @param {array} [parameters.deleteProperty] Hostnames types to delete. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * - * @returns {Promise} A promise is returned + * @param {ServiceCallback} [optionalCallback] - The optional callback. * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. * - * @reject {Error|ServiceError} - The error object. + * {Promise} A promise is returned. + * + * @resolve {ApiManagementServiceResource} - 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. + * + * {ApiManagementServiceResource} [result] - The deserialized result object if an error did not occur. + * See {@link ApiManagementServiceResource} 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. */ - beginUpdateWithHttpOperationResponse(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + updateHostname(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceUpdateHostnameParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + updateHostname(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceUpdateHostnameParameters, callback: ServiceCallback): void; + updateHostname(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceUpdateHostnameParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + /** - * Updates an existing API Management service. + * Restores a backup of an API Management service created using the + * ApiManagementService_Backup operation on the current service. This is a long + * running operation and could take several minutes to complete. * * @param {string} resourceGroupName The name of the resource group. * * @param {string} serviceName The name of the API Management service. * - * @param {object} parameters Parameters supplied to the CreateOrUpdate API - * Management service operation. + * @param {object} parameters Parameters supplied to the Restore API Management + * service from backup operation. * - * @param {string} [parameters.notificationSenderEmail] Email address from - * which the notification will be sent. + * @param {string} parameters.storageAccount Azure Cloud Storage account (used + * to place/retrieve the backup) name. * - * @param {array} [parameters.hostnameConfigurations] Custom hostname - * configuration of the API Management service. + * @param {string} parameters.accessKey Azure Cloud Storage account (used to + * place/retrieve the backup) access key. * - * @param {object} [parameters.virtualNetworkConfiguration] Virtual network - * configuration of the API Management service. + * @param {string} parameters.containerName Azure Cloud Storage blob container + * name used to place/retrieve the backup. * - * @param {string} [parameters.virtualNetworkConfiguration.subnetResourceId] - * The full resource ID of a subnet in a virtual network to deploy the API - * Management service in. + * @param {string} parameters.backupName The name of the backup file to create. * - * @param {array} [parameters.additionalLocations] Additional datacenter - * locations of the API Management service. + * @param {object} [options] Optional Parameters. * - * @param {object} [parameters.customProperties] Custom properties of the API - * Management service. Setting - * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` - * will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 - * and 1.2). Setting - * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can - * be used to disable just TLS 1.1 and setting - * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can - * be used to disable TLS 1.0 on an API Management service. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {array} [parameters.certificates] List of Certificates that need to - * be installed in the API Management service. Max supported certificates that - * can be installed is 10. + * @returns {Promise} A promise is returned * - * @param {string} [parameters.virtualNetworkType] The type of VPN in which API - * Managemet service needs to be configured in. None (Default Value) means the - * API Management service is not part of any Virtual Network, External means - * the API Management deployment is set up inside a Virtual Network having an - * Internet Facing Endpoint, and Internal means that API Management deployment - * is setup inside a Virtual Network having an Intranet Facing Endpoint only. - * Possible values include: 'None', 'External', 'Internal' + * @resolve {HttpOperationResponse} - The deserialized result object. * - * @param {string} [parameters.publisherEmail] Publisher email. + * @reject {Error|ServiceError} - The error object. + */ + beginRestoreWithHttpOperationResponse(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceBackupRestoreParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Restores a backup of an API Management service created using the + * ApiManagementService_Backup operation on the current service. This is a long + * running operation and could take several minutes to complete. * - * @param {string} [parameters.publisherName] Publisher name. + * @param {string} resourceGroupName The name of the resource group. * - * @param {object} [parameters.sku] SKU properties of the API Management - * service. + * @param {string} serviceName The name of the API Management service. * - * @param {string} parameters.sku.name Name of the Sku. Possible values - * include: 'Developer', 'Standard', 'Premium', 'Basic' + * @param {object} parameters Parameters supplied to the Restore API Management + * service from backup operation. * - * @param {number} [parameters.sku.capacity] Capacity of the SKU (number of - * deployed units of the SKU). The default value is 1. + * @param {string} parameters.storageAccount Azure Cloud Storage account (used + * to place/retrieve the backup) name. * - * @param {object} [parameters.identity] Managed service identity of the Api - * Management service. + * @param {string} parameters.accessKey Azure Cloud Storage account (used to + * place/retrieve the backup) access key. * - * @param {object} [parameters.tags] Resource tags. + * @param {string} parameters.containerName Azure Cloud Storage blob container + * name used to place/retrieve the backup. + * + * @param {string} parameters.backupName The name of the backup file to create. * * @param {object} [options] Optional Parameters. * @@ -10643,29 +9923,35 @@ export interface ApiManagementService { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginUpdate(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginUpdate(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceUpdateParameters, callback: ServiceCallback): void; - beginUpdate(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginRestore(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceBackupRestoreParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginRestore(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceBackupRestoreParameters, callback: ServiceCallback): void; + beginRestore(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceBackupRestoreParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Updates the Microsoft.ApiManagement resource running in the Virtual network - * to pick the updated network settings. + * Creates a backup of the API Management service to the given Azure Storage + * Account. This is long running operation and could take several minutes to + * complete. * * @param {string} resourceGroupName The name of the resource group. * * @param {string} serviceName The name of the API Management service. * - * @param {object} [options] Optional Parameters. + * @param {object} parameters Parameters supplied to the + * ApiManagementService_Backup operation. * - * @param {object} [options.parameters] Parameters supplied to the Apply - * Network Configuration operation. If the parameters are empty, all the - * regions in which the Api Management service is deployed will be updated - * sequentially without incurring downtime in the region. + * @param {string} parameters.storageAccount Azure Cloud Storage account (used + * to place/retrieve the backup) name. * - * @param {string} [options.parameters.location] Location of the Api Management - * service to update for a multi-region service. For a service deployed in a - * single region, this parameter is not required. + * @param {string} parameters.accessKey Azure Cloud Storage account (used to + * place/retrieve the backup) access key. + * + * @param {string} parameters.containerName Azure Cloud Storage blob container + * name used to place/retrieve the backup. + * + * @param {string} parameters.backupName The name of the backup file to create. + * + * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -10676,26 +9962,32 @@ export interface ApiManagementService { * * @reject {Error|ServiceError} - The error object. */ - beginApplyNetworkConfigurationUpdatesWithHttpOperationResponse(resourceGroupName: string, serviceName: string, options?: { parameters? : models.ApiManagementServiceApplyNetworkConfigurationParameters, customHeaders? : { [headerName: string]: string; } }): Promise>; + beginBackupWithHttpOperationResponse(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceBackupRestoreParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Updates the Microsoft.ApiManagement resource running in the Virtual network - * to pick the updated network settings. + * Creates a backup of the API Management service to the given Azure Storage + * Account. This is long running operation and could take several minutes to + * complete. * * @param {string} resourceGroupName The name of the resource group. * * @param {string} serviceName The name of the API Management service. * - * @param {object} [options] Optional Parameters. + * @param {object} parameters Parameters supplied to the + * ApiManagementService_Backup operation. * - * @param {object} [options.parameters] Parameters supplied to the Apply - * Network Configuration operation. If the parameters are empty, all the - * regions in which the Api Management service is deployed will be updated - * sequentially without incurring downtime in the region. + * @param {string} parameters.storageAccount Azure Cloud Storage account (used + * to place/retrieve the backup) name. * - * @param {string} [options.parameters.location] Location of the Api Management - * service to update for a multi-region service. For a service deployed in a - * single region, this parameter is not required. + * @param {string} parameters.accessKey Azure Cloud Storage account (used to + * place/retrieve the backup) access key. + * + * @param {string} parameters.containerName Azure Cloud Storage blob container + * name used to place/retrieve the backup. + * + * @param {string} parameters.backupName The name of the backup file to create. + * + * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -10719,31 +10011,82 @@ export interface ApiManagementService { * See {@link ApiManagementServiceResource} for more * information. * - * {WebResource} [request] - The HTTP Request 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. + */ + beginBackup(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceBackupRestoreParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginBackup(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceBackupRestoreParameters, callback: ServiceCallback): void; + beginBackup(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceBackupRestoreParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates an API Management service. This is long running operation + * and could take several minutes to complete. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} serviceName The name of the API Management service. + * + * @param {object} parameters Parameters supplied to the CreateOrUpdate API + * Management service operation. + * + * @param {string} [parameters.notificationSenderEmail] Email address from + * which the notification will be sent. + * + * @param {array} [parameters.hostnameConfigurations] Custom hostname + * configuration of the API Management service. + * + * @param {object} [parameters.virtualNetworkConfiguration] Virtual network + * configuration of the API Management service. + * + * @param {string} [parameters.virtualNetworkConfiguration.subnetResourceId] + * The full resource ID of a subnet in a virtual network to deploy the API + * Management service in. + * + * @param {array} [parameters.additionalLocations] Additional datacenter + * locations of the API Management service. + * + * @param {object} [parameters.customProperties] Custom properties of the API + * Management service. Setting + * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` + * will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 + * and 1.2). Setting + * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can + * be used to disable just TLS 1.1 and setting + * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can + * be used to disable TLS 1.0 on an API Management service. + * + * @param {array} [parameters.certificates] List of Certificates that need to + * be installed in the API Management service. Max supported certificates that + * can be installed is 10. + * + * @param {string} [parameters.virtualNetworkType] The type of VPN in which API + * Managemet service needs to be configured in. None (Default Value) means the + * API Management service is not part of any Virtual Network, External means + * the API Management deployment is set up inside a Virtual Network having an + * Internet Facing Endpoint, and Internal means that API Management deployment + * is setup inside a Virtual Network having an Intranet Facing Endpoint only. + * Possible values include: 'None', 'External', 'Internal' + * + * @param {string} parameters.publisherEmail Publisher email. + * + * @param {string} parameters.publisherName Publisher name. * - * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. - */ - beginApplyNetworkConfigurationUpdates(resourceGroupName: string, serviceName: string, options?: { parameters? : models.ApiManagementServiceApplyNetworkConfigurationParameters, customHeaders? : { [headerName: string]: string; } }): Promise; - beginApplyNetworkConfigurationUpdates(resourceGroupName: string, serviceName: string, callback: ServiceCallback): void; - beginApplyNetworkConfigurationUpdates(resourceGroupName: string, serviceName: string, options: { parameters? : models.ApiManagementServiceApplyNetworkConfigurationParameters, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Creates, updates, or deletes the custom hostnames for an API Management - * service. The custom hostname can be applied to the Proxy and Portal - * endpoint. This is a long running operation and could take several minutes to - * complete. This operation will be deprecated in the next version update. + * @param {object} parameters.sku SKU properties of the API Management service. * - * @param {string} resourceGroupName The name of the resource group. + * @param {string} parameters.sku.name Name of the Sku. Possible values + * include: 'Developer', 'Standard', 'Premium', 'Basic' * - * @param {string} serviceName The name of the API Management service. + * @param {number} [parameters.sku.capacity] Capacity of the SKU (number of + * deployed units of the SKU). The default value is 1. * - * @param {object} parameters Parameters supplied to the UpdateHostname - * operation. + * @param {object} [parameters.identity] Managed service identity of the Api + * Management service. * - * @param {array} [parameters.update] Hostnames to create or update. + * @param {string} parameters.location Resource location. * - * @param {array} [parameters.deleteProperty] Hostnames types to delete. + * @param {object} [parameters.tags] Resource tags. * * @param {object} [options] Optional Parameters. * @@ -10756,24 +10099,75 @@ export interface ApiManagementService { * * @reject {Error|ServiceError} - The error object. */ - beginUpdateHostnameWithHttpOperationResponse(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceUpdateHostnameParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates, updates, or deletes the custom hostnames for an API Management - * service. The custom hostname can be applied to the Proxy and Portal - * endpoint. This is a long running operation and could take several minutes to - * complete. This operation will be deprecated in the next version update. + * Creates or updates an API Management service. This is long running operation + * and could take several minutes to complete. * * @param {string} resourceGroupName The name of the resource group. * * @param {string} serviceName The name of the API Management service. * - * @param {object} parameters Parameters supplied to the UpdateHostname - * operation. + * @param {object} parameters Parameters supplied to the CreateOrUpdate API + * Management service operation. * - * @param {array} [parameters.update] Hostnames to create or update. + * @param {string} [parameters.notificationSenderEmail] Email address from + * which the notification will be sent. * - * @param {array} [parameters.deleteProperty] Hostnames types to delete. + * @param {array} [parameters.hostnameConfigurations] Custom hostname + * configuration of the API Management service. + * + * @param {object} [parameters.virtualNetworkConfiguration] Virtual network + * configuration of the API Management service. + * + * @param {string} [parameters.virtualNetworkConfiguration.subnetResourceId] + * The full resource ID of a subnet in a virtual network to deploy the API + * Management service in. + * + * @param {array} [parameters.additionalLocations] Additional datacenter + * locations of the API Management service. + * + * @param {object} [parameters.customProperties] Custom properties of the API + * Management service. Setting + * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` + * will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 + * and 1.2). Setting + * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can + * be used to disable just TLS 1.1 and setting + * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can + * be used to disable TLS 1.0 on an API Management service. + * + * @param {array} [parameters.certificates] List of Certificates that need to + * be installed in the API Management service. Max supported certificates that + * can be installed is 10. + * + * @param {string} [parameters.virtualNetworkType] The type of VPN in which API + * Managemet service needs to be configured in. None (Default Value) means the + * API Management service is not part of any Virtual Network, External means + * the API Management deployment is set up inside a Virtual Network having an + * Internet Facing Endpoint, and Internal means that API Management deployment + * is setup inside a Virtual Network having an Intranet Facing Endpoint only. + * Possible values include: 'None', 'External', 'Internal' + * + * @param {string} parameters.publisherEmail Publisher email. + * + * @param {string} parameters.publisherName Publisher name. + * + * @param {object} parameters.sku SKU properties of the API Management service. + * + * @param {string} parameters.sku.name Name of the Sku. Possible values + * include: 'Developer', 'Standard', 'Premium', 'Basic' + * + * @param {number} [parameters.sku.capacity] Capacity of the SKU (number of + * deployed units of the SKU). The default value is 1. + * + * @param {object} [parameters.identity] Managed service identity of the Api + * Management service. + * + * @param {string} parameters.location Resource location. + * + * @param {object} [parameters.tags] Resource tags. * * @param {object} [options] Optional Parameters. * @@ -10803,74 +10197,76 @@ export interface ApiManagementService { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginUpdateHostname(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceUpdateHostnameParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginUpdateHostname(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceUpdateHostnameParameters, callback: ServiceCallback): void; - beginUpdateHostname(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceUpdateHostnameParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceResource, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceResource, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceResource, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * List all API Management services within a resource group. - * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. - * - * @param {object} [options] Optional Parameters. + * Updates an existing API Management service. * - * @param {object} [options.customHeaders] Headers that will be added to the - * request + * @param {string} resourceGroupName The name of the resource group. * - * @returns {Promise} A promise is returned + * @param {string} serviceName The name of the API Management service. * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @param {object} parameters Parameters supplied to the CreateOrUpdate API + * Management service operation. * - * @reject {Error|ServiceError} - The error object. - */ - listByResourceGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * List all API Management services within a resource group. + * @param {string} [parameters.notificationSenderEmail] Email address from + * which the notification will be sent. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {array} [parameters.hostnameConfigurations] Custom hostname + * configuration of the API Management service. * - * @param {object} [options] Optional Parameters. + * @param {object} [parameters.virtualNetworkConfiguration] Virtual network + * configuration of the API Management service. * - * @param {object} [options.customHeaders] Headers that will be added to the - * request + * @param {string} [parameters.virtualNetworkConfiguration.subnetResourceId] + * The full resource ID of a subnet in a virtual network to deploy the API + * Management service in. * - * @param {ServiceCallback} [optionalCallback] - The optional callback. + * @param {array} [parameters.additionalLocations] Additional datacenter + * locations of the API Management service. * - * @returns {ServiceCallback|Promise} If a callback was passed as the last - * parameter then it returns the callback else returns a Promise. + * @param {object} [parameters.customProperties] Custom properties of the API + * Management service. Setting + * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` + * will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 + * and 1.2). Setting + * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can + * be used to disable just TLS 1.1 and setting + * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can + * be used to disable TLS 1.0 on an API Management service. * - * {Promise} A promise is returned. + * @param {array} [parameters.certificates] List of Certificates that need to + * be installed in the API Management service. Max supported certificates that + * can be installed is 10. * - * @resolve {ApiManagementServiceListResult} - The deserialized result object. + * @param {string} [parameters.virtualNetworkType] The type of VPN in which API + * Managemet service needs to be configured in. None (Default Value) means the + * API Management service is not part of any Virtual Network, External means + * the API Management deployment is set up inside a Virtual Network having an + * Internet Facing Endpoint, and Internal means that API Management deployment + * is setup inside a Virtual Network having an Intranet Facing Endpoint only. + * Possible values include: 'None', 'External', 'Internal' * - * @reject {Error|ServiceError} - The error object. + * @param {string} [parameters.publisherEmail] Publisher email. * - * {ServiceCallback} optionalCallback(err, result, request, response) + * @param {string} [parameters.publisherName] Publisher name. * - * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * @param {object} [parameters.sku] SKU properties of the API Management + * service. * - * {ApiManagementServiceListResult} [result] - The deserialized result object if an error did not occur. - * See {@link ApiManagementServiceListResult} for more - * information. + * @param {string} parameters.sku.name Name of the Sku. Possible values + * include: 'Developer', 'Standard', 'Premium', 'Basic' * - * {WebResource} [request] - The HTTP Request object if an error did not occur. + * @param {number} [parameters.sku.capacity] Capacity of the SKU (number of + * deployed units of the SKU). The default value is 1. * - * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. - */ - listByResourceGroupNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByResourceGroupNext(nextPageLink: string, callback: ServiceCallback): void; - listByResourceGroupNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Lists all API Management services within an Azure subscription. + * @param {object} [parameters.identity] Managed service identity of the Api + * Management service. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {object} [parameters.tags] Resource tags. * * @param {object} [options] Optional Parameters. * @@ -10879,17 +10275,77 @@ export interface ApiManagementService { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginUpdateWithHttpOperationResponse(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Lists all API Management services within an Azure subscription. + * Updates an existing API Management service. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} serviceName The name of the API Management service. + * + * @param {object} parameters Parameters supplied to the CreateOrUpdate API + * Management service operation. + * + * @param {string} [parameters.notificationSenderEmail] Email address from + * which the notification will be sent. + * + * @param {array} [parameters.hostnameConfigurations] Custom hostname + * configuration of the API Management service. + * + * @param {object} [parameters.virtualNetworkConfiguration] Virtual network + * configuration of the API Management service. + * + * @param {string} [parameters.virtualNetworkConfiguration.subnetResourceId] + * The full resource ID of a subnet in a virtual network to deploy the API + * Management service in. + * + * @param {array} [parameters.additionalLocations] Additional datacenter + * locations of the API Management service. + * + * @param {object} [parameters.customProperties] Custom properties of the API + * Management service. Setting + * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` + * will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 + * and 1.2). Setting + * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can + * be used to disable just TLS 1.1 and setting + * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can + * be used to disable TLS 1.0 on an API Management service. + * + * @param {array} [parameters.certificates] List of Certificates that need to + * be installed in the API Management service. Max supported certificates that + * can be installed is 10. + * + * @param {string} [parameters.virtualNetworkType] The type of VPN in which API + * Managemet service needs to be configured in. None (Default Value) means the + * API Management service is not part of any Virtual Network, External means + * the API Management deployment is set up inside a Virtual Network having an + * Internet Facing Endpoint, and Internal means that API Management deployment + * is setup inside a Virtual Network having an Intranet Facing Endpoint only. + * Possible values include: 'None', 'External', 'Internal' + * + * @param {string} [parameters.publisherEmail] Publisher email. + * + * @param {string} [parameters.publisherName] Publisher name. + * + * @param {object} [parameters.sku] SKU properties of the API Management + * service. + * + * @param {string} parameters.sku.name Name of the Sku. Possible values + * include: 'Developer', 'Standard', 'Premium', 'Basic' + * + * @param {number} [parameters.sku.capacity] Capacity of the SKU (number of + * deployed units of the SKU). The default value is 1. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {object} [parameters.identity] Managed service identity of the Api + * Management service. + * + * @param {object} [parameters.tags] Resource tags. * * @param {object} [options] Optional Parameters. * @@ -10903,7 +10359,7 @@ export interface ApiManagementService { * * {Promise} A promise is returned. * - * @resolve {ApiManagementServiceListResult} - The deserialized result object. + * @resolve {ApiManagementServiceResource} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -10911,30 +10367,22 @@ export interface ApiManagementService { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ApiManagementServiceListResult} [result] - The deserialized result object if an error did not occur. - * See {@link ApiManagementServiceListResult} for more + * {ApiManagementServiceResource} [result] - The deserialized result object if an error did not occur. + * See {@link ApiManagementServiceResource} 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?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listNext(nextPageLink: string, callback: ServiceCallback): void; - listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * Diagnostic - * __NOTE__: An instance of this class is automatically created for an - * instance of the ApiManagementClient. - */ -export interface Diagnostic { + beginUpdate(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdate(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceUpdateParameters, callback: ServiceCallback): void; + beginUpdate(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Lists all diagnostics of the API Management service instance. + * Updates the Microsoft.ApiManagement resource running in the Virtual network + * to pick the updated network settings. * * @param {string} resourceGroupName The name of the resource group. * @@ -10942,28 +10390,29 @@ export interface Diagnostic { * * @param {object} [options] Optional Parameters. * - * @param {string} [options.filter] | Field | Supported operators | - * Supported functions | - * |-------------|------------------------|-----------------------------------| - * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | - * - * @param {number} [options.top] Number of records to return. + * @param {object} [options.parameters] Parameters supplied to the Apply + * Network Configuration operation. If the parameters are empty, all the + * regions in which the Api Management service is deployed will be updated + * sequentially without incurring downtime in the region. * - * @param {number} [options.skip] Number of records to skip. + * @param {string} [options.parameters.location] Location of the Api Management + * service to update for a multi-region service. For a service deployed in a + * single region, this parameter is not required. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByServiceWithHttpOperationResponse(resourceGroupName: string, serviceName: string, options?: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; + beginApplyNetworkConfigurationUpdatesWithHttpOperationResponse(resourceGroupName: string, serviceName: string, options?: { parameters? : models.ApiManagementServiceApplyNetworkConfigurationParameters, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Lists all diagnostics of the API Management service instance. + * Updates the Microsoft.ApiManagement resource running in the Virtual network + * to pick the updated network settings. * * @param {string} resourceGroupName The name of the resource group. * @@ -10971,14 +10420,14 @@ export interface Diagnostic { * * @param {object} [options] Optional Parameters. * - * @param {string} [options.filter] | Field | Supported operators | - * Supported functions | - * |-------------|------------------------|-----------------------------------| - * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | - * - * @param {number} [options.top] Number of records to return. + * @param {object} [options.parameters] Parameters supplied to the Apply + * Network Configuration operation. If the parameters are empty, all the + * regions in which the Api Management service is deployed will be updated + * sequentially without incurring downtime in the region. * - * @param {number} [options.skip] Number of records to skip. + * @param {string} [options.parameters.location] Location of the Api Management + * service to update for a multi-region service. For a service deployed in a + * single region, this parameter is not required. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -10990,7 +10439,7 @@ export interface Diagnostic { * * {Promise} A promise is returned. * - * @resolve {DiagnosticCollection} - The deserialized result object. + * @resolve {ApiManagementServiceResource} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -10998,28 +10447,35 @@ export interface Diagnostic { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {DiagnosticCollection} [result] - The deserialized result object if an error did not occur. - * See {@link DiagnosticCollection} for more information. + * {ApiManagementServiceResource} [result] - The deserialized result object if an error did not occur. + * See {@link ApiManagementServiceResource} 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. */ - listByService(resourceGroupName: string, serviceName: string, options?: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }): Promise; - listByService(resourceGroupName: string, serviceName: string, callback: ServiceCallback): void; - listByService(resourceGroupName: string, serviceName: string, options: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginApplyNetworkConfigurationUpdates(resourceGroupName: string, serviceName: string, options?: { parameters? : models.ApiManagementServiceApplyNetworkConfigurationParameters, customHeaders? : { [headerName: string]: string; } }): Promise; + beginApplyNetworkConfigurationUpdates(resourceGroupName: string, serviceName: string, callback: ServiceCallback): void; + beginApplyNetworkConfigurationUpdates(resourceGroupName: string, serviceName: string, options: { parameters? : models.ApiManagementServiceApplyNetworkConfigurationParameters, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets the entity state (Etag) version of the Diagnostic specified by its - * identifier. + * Creates, updates, or deletes the custom hostnames for an API Management + * service. The custom hostname can be applied to the Proxy and Portal + * endpoint. This is a long running operation and could take several minutes to + * complete. This operation will be deprecated in the next version update. * * @param {string} resourceGroupName The name of the resource group. * * @param {string} serviceName The name of the API Management service. * - * @param {string} diagnosticId Diagnostic identifier. Must be unique in the - * current API Management service instance. + * @param {object} parameters Parameters supplied to the UpdateHostname + * operation. + * + * @param {array} [parameters.update] Hostnames to create or update. + * + * @param {array} [parameters.deleteProperty] Hostnames types to delete. * * @param {object} [options] Optional Parameters. * @@ -11028,22 +10484,28 @@ export interface Diagnostic { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getEntityTagWithHttpOperationResponse(resourceGroupName: string, serviceName: string, diagnosticId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginUpdateHostnameWithHttpOperationResponse(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceUpdateHostnameParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets the entity state (Etag) version of the Diagnostic specified by its - * identifier. + * Creates, updates, or deletes the custom hostnames for an API Management + * service. The custom hostname can be applied to the Proxy and Portal + * endpoint. This is a long running operation and could take several minutes to + * complete. This operation will be deprecated in the next version update. * * @param {string} resourceGroupName The name of the resource group. * * @param {string} serviceName The name of the API Management service. * - * @param {string} diagnosticId Diagnostic identifier. Must be unique in the - * current API Management service instance. + * @param {object} parameters Parameters supplied to the UpdateHostname + * operation. + * + * @param {array} [parameters.update] Hostnames to create or update. + * + * @param {array} [parameters.deleteProperty] Hostnames types to delete. * * @param {object} [options] Optional Parameters. * @@ -11057,7 +10519,7 @@ export interface Diagnostic { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {ApiManagementServiceResource} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -11065,26 +10527,24 @@ export interface Diagnostic { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {ApiManagementServiceResource} [result] - The deserialized result object if an error did not occur. + * See {@link ApiManagementServiceResource} 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. */ - getEntityTag(resourceGroupName: string, serviceName: string, diagnosticId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - getEntityTag(resourceGroupName: string, serviceName: string, diagnosticId: string, callback: ServiceCallback): void; - getEntityTag(resourceGroupName: string, serviceName: string, diagnosticId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginUpdateHostname(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceUpdateHostnameParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdateHostname(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceUpdateHostnameParameters, callback: ServiceCallback): void; + beginUpdateHostname(resourceGroupName: string, serviceName: string, parameters: models.ApiManagementServiceUpdateHostnameParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets the details of the Diagnostic specified by its identifier. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} serviceName The name of the API Management service. + * List all API Management services within a resource group. * - * @param {string} diagnosticId Diagnostic identifier. Must be unique in the - * current API Management service instance. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -11093,21 +10553,17 @@ export interface Diagnostic { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, serviceName: string, diagnosticId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByResourceGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets the details of the Diagnostic specified by its identifier. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} serviceName The name of the API Management service. + * List all API Management services within a resource group. * - * @param {string} diagnosticId Diagnostic identifier. Must be unique in the - * current API Management service instance. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -11121,7 +10577,7 @@ export interface Diagnostic { * * {Promise} A promise is returned. * - * @resolve {DiagnosticContract} - The deserialized result object. + * @resolve {ApiManagementServiceListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -11129,69 +10585,46 @@ export interface Diagnostic { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {DiagnosticContract} [result] - The deserialized result object if an error did not occur. - * See {@link DiagnosticContract} for more information. + * {ApiManagementServiceListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ApiManagementServiceListResult} 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. */ - get(resourceGroupName: string, serviceName: string, diagnosticId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, serviceName: string, diagnosticId: string, callback: ServiceCallback): void; - get(resourceGroupName: string, serviceName: string, diagnosticId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByResourceGroupNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroupNext(nextPageLink: string, callback: ServiceCallback): void; + listByResourceGroupNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Creates a new Diagnostic or updates an existing one. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} serviceName The name of the API Management service. - * - * @param {string} diagnosticId Diagnostic identifier. Must be unique in the - * current API Management service instance. - * - * @param {object} parameters Create parameters. + * Lists all API Management services within an Azure subscription. * - * @param {boolean} parameters.enabled Indicates whether a diagnostic should - * receive data or not. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * - * @param {string} [options.ifMatch] ETag of the Entity. Not required when - * creating an entity, but required when updating an entity. - * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @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(resourceGroupName: string, serviceName: string, diagnosticId: string, parameters: models.DiagnosticContract, options?: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates a new Diagnostic or updates an existing one. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} serviceName The name of the API Management service. - * - * @param {string} diagnosticId Diagnostic identifier. Must be unique in the - * current API Management service instance. - * - * @param {object} parameters Create parameters. + * Lists all API Management services within an Azure subscription. * - * @param {boolean} parameters.enabled Indicates whether a diagnostic should - * receive data or not. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * - * @param {string} [options.ifMatch] ETag of the Entity. Not required when - * creating an entity, but required when updating an entity. - * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -11202,7 +10635,7 @@ export interface Diagnostic { * * {Promise} A promise is returned. * - * @resolve {DiagnosticContract} - The deserialized result object. + * @resolve {ApiManagementServiceListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -11210,70 +10643,74 @@ export interface Diagnostic { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {DiagnosticContract} [result] - The deserialized result object if an error did not occur. - * See {@link DiagnosticContract} for more information. + * {ApiManagementServiceListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ApiManagementServiceListResult} 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. */ - createOrUpdate(resourceGroupName: string, serviceName: string, diagnosticId: string, parameters: models.DiagnosticContract, options?: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, serviceName: string, diagnosticId: string, parameters: models.DiagnosticContract, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, serviceName: string, diagnosticId: string, parameters: models.DiagnosticContract, options: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Diagnostic + * __NOTE__: An instance of this class is automatically created for an + * instance of the ApiManagementClient. + */ +export interface Diagnostic { /** - * Updates the details of the Diagnostic specified by its identifier. + * Lists all diagnostics of the API Management service instance. * * @param {string} resourceGroupName The name of the resource group. * * @param {string} serviceName The name of the API Management service. * - * @param {string} diagnosticId Diagnostic identifier. Must be unique in the - * current API Management service instance. - * - * @param {object} parameters Diagnostic Update parameters. + * @param {object} [options] Optional Parameters. * - * @param {boolean} parameters.enabled Indicates whether a diagnostic should - * receive data or not. + * @param {string} [options.filter] | Field | Supported operators | + * Supported functions | + * |-------------|------------------------|-----------------------------------| + * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | * - * @param {string} ifMatch ETag of the Entity. ETag should match the current - * entity state from the header response of the GET request or it should be * - * for unconditional update. + * @param {number} [options.top] Number of records to return. * - * @param {object} [options] Optional Parameters. + * @param {number} [options.skip] Number of records to skip. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @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(resourceGroupName: string, serviceName: string, diagnosticId: string, parameters: models.DiagnosticContract, ifMatch: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByServiceWithHttpOperationResponse(resourceGroupName: string, serviceName: string, options?: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Updates the details of the Diagnostic specified by its identifier. + * Lists all diagnostics of the API Management service instance. * * @param {string} resourceGroupName The name of the resource group. * * @param {string} serviceName The name of the API Management service. * - * @param {string} diagnosticId Diagnostic identifier. Must be unique in the - * current API Management service instance. - * - * @param {object} parameters Diagnostic Update parameters. + * @param {object} [options] Optional Parameters. * - * @param {boolean} parameters.enabled Indicates whether a diagnostic should - * receive data or not. + * @param {string} [options.filter] | Field | Supported operators | + * Supported functions | + * |-------------|------------------------|-----------------------------------| + * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | * - * @param {string} ifMatch ETag of the Entity. ETag should match the current - * entity state from the header response of the GET request or it should be * - * for unconditional update. + * @param {number} [options.top] Number of records to return. * - * @param {object} [options] Optional Parameters. + * @param {number} [options.skip] Number of records to skip. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -11285,7 +10722,7 @@ export interface Diagnostic { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {DiagnosticCollection} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -11293,19 +10730,21 @@ export interface Diagnostic { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {DiagnosticCollection} [result] - The deserialized result object if an error did not occur. + * See {@link DiagnosticCollection} 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. */ - update(resourceGroupName: string, serviceName: string, diagnosticId: string, parameters: models.DiagnosticContract, ifMatch: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - update(resourceGroupName: string, serviceName: string, diagnosticId: string, parameters: models.DiagnosticContract, ifMatch: string, callback: ServiceCallback): void; - update(resourceGroupName: string, serviceName: string, diagnosticId: string, parameters: models.DiagnosticContract, ifMatch: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByService(resourceGroupName: string, serviceName: string, options?: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }): Promise; + listByService(resourceGroupName: string, serviceName: string, callback: ServiceCallback): void; + listByService(resourceGroupName: string, serviceName: string, options: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Deletes the specified Diagnostic. + * Gets the entity state (Etag) version of the Diagnostic specified by its + * identifier. * * @param {string} resourceGroupName The name of the resource group. * @@ -11314,10 +10753,6 @@ export interface Diagnostic { * @param {string} diagnosticId Diagnostic identifier. Must be unique in the * current API Management service instance. * - * @param {string} ifMatch ETag of the 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] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -11329,10 +10764,11 @@ export interface Diagnostic { * * @reject {Error|ServiceError} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, serviceName: string, diagnosticId: string, ifMatch: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getEntityTagWithHttpOperationResponse(resourceGroupName: string, serviceName: string, diagnosticId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes the specified Diagnostic. + * Gets the entity state (Etag) version of the Diagnostic specified by its + * identifier. * * @param {string} resourceGroupName The name of the resource group. * @@ -11341,10 +10777,6 @@ export interface Diagnostic { * @param {string} diagnosticId Diagnostic identifier. Must be unique in the * current API Management service instance. * - * @param {string} ifMatch ETag of the 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] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -11371,16 +10803,20 @@ export interface Diagnostic { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - deleteMethod(resourceGroupName: string, serviceName: string, diagnosticId: string, ifMatch: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, serviceName: string, diagnosticId: string, ifMatch: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, serviceName: string, diagnosticId: string, ifMatch: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + getEntityTag(resourceGroupName: string, serviceName: string, diagnosticId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getEntityTag(resourceGroupName: string, serviceName: string, diagnosticId: string, callback: ServiceCallback): void; + getEntityTag(resourceGroupName: string, serviceName: string, diagnosticId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Lists all diagnostics of the API Management service instance. + * Gets the details of the Diagnostic specified by its identifier. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} serviceName The name of the API Management service. + * + * @param {string} diagnosticId Diagnostic identifier. Must be unique in the + * current API Management service instance. * * @param {object} [options] Optional Parameters. * @@ -11389,17 +10825,21 @@ export interface Diagnostic { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByServiceNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, serviceName: string, diagnosticId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Lists all diagnostics of the API Management service instance. + * Gets the details of the Diagnostic specified by its identifier. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} serviceName The name of the API Management service. + * + * @param {string} diagnosticId Diagnostic identifier. Must be unique in the + * current API Management service instance. * * @param {object} [options] Optional Parameters. * @@ -11413,7 +10853,7 @@ export interface Diagnostic { * * {Promise} A promise is returned. * - * @resolve {DiagnosticCollection} - The deserialized result object. + * @resolve {DiagnosticContract} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -11421,30 +10861,20 @@ export interface Diagnostic { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {DiagnosticCollection} [result] - The deserialized result object if an error did not occur. - * See {@link DiagnosticCollection} for more information. + * {DiagnosticContract} [result] - The deserialized result object if an error did not occur. + * See {@link DiagnosticContract} 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. */ - listByServiceNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByServiceNext(nextPageLink: string, callback: ServiceCallback): void; - listByServiceNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * DiagnosticLogger - * __NOTE__: An instance of this class is automatically created for an - * instance of the ApiManagementClient. - */ -export interface DiagnosticLogger { + get(resourceGroupName: string, serviceName: string, diagnosticId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serviceName: string, diagnosticId: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serviceName: string, diagnosticId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Lists all loggers assosiated with the specified Diagnostic of the API - * Management service instance. + * Creates a new Diagnostic or updates an existing one. * * @param {string} resourceGroupName The name of the resource group. * @@ -11453,85 +10883,59 @@ export interface DiagnosticLogger { * @param {string} diagnosticId Diagnostic identifier. Must be unique in the * current API Management service instance. * - * @param {object} [options] Optional Parameters. + * @param {object} parameters Create parameters. * - * @param {string} [options.filter] | Field | Supported operators | - * Supported functions | - * |-------------|------------------------|-----------------------------------| - * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | - * | type | eq | | + * @param {string} [parameters.alwaysLog] Specifies for what type of messages + * sampling settings should not apply. Possible values include: 'allErrors' * - * @param {number} [options.top] Number of records to return. + * @param {string} parameters.loggerId Resource Id of a target logger. * - * @param {number} [options.skip] Number of records to skip. + * @param {object} [parameters.sampling] Sampling settings for Diagnostic. * - * @param {object} [options.customHeaders] Headers that will be added to the - * request + * @param {string} [parameters.sampling.samplingType] Sampling type. Possible + * values include: 'fixed' * - * @returns {Promise} A promise is returned + * @param {number} [parameters.sampling.percentage] Rate of sampling for + * fixed-rate sampling. * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @param {object} [parameters.frontend] Diagnostic settings for + * incoming/outcoming HTTP messages to the Gateway. * - * @reject {Error|ServiceError} - The error object. - */ - listByServiceWithHttpOperationResponse(resourceGroupName: string, serviceName: string, diagnosticId: string, options?: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Lists all loggers assosiated with the specified Diagnostic of the API - * Management service instance. + * @param {object} [parameters.backend] Diagnostic settings for + * incoming/outcoming HTTP messages to the Backend * - * @param {string} resourceGroupName The name of the resource group. + * @param {object} [parameters.backend.request] Diagnostic settings for + * request. * - * @param {string} serviceName The name of the API Management service. + * @param {object} [parameters.backend.response] Diagnostic settings for + * response. * - * @param {string} diagnosticId Diagnostic identifier. Must be unique in the - * current API Management service instance. + * @param {array} [parameters.backend.response.headers] Array of HTTP Headers + * to log. * - * @param {object} [options] Optional Parameters. + * @param {object} [parameters.backend.response.body] Body logging settings. * - * @param {string} [options.filter] | Field | Supported operators | - * Supported functions | - * |-------------|------------------------|-----------------------------------| - * | id | ge, le, eq, ne, gt, lt | substringof, startswith, endswith | - * | type | eq | | + * @param {number} [parameters.backend.response.body.bytes] Number of request + * body bytes to log. * - * @param {number} [options.top] Number of records to return. + * @param {object} [options] Optional Parameters. * - * @param {number} [options.skip] Number of records to skip. + * @param {string} [options.ifMatch] ETag of the Entity. Not required when + * creating an entity, but required when updating an entity. * * @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 {LoggerCollection} - 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. - * - * {LoggerCollection} [result] - The deserialized result object if an error did not occur. - * See {@link LoggerCollection} for more information. + * @returns {Promise} A promise is returned * - * {WebResource} [request] - The HTTP Request object if an error did not occur. + * @resolve {HttpOperationResponse} - The deserialized result object. * - * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + * @reject {Error|ServiceError} - The error object. */ - listByService(resourceGroupName: string, serviceName: string, diagnosticId: string, options?: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }): Promise; - listByService(resourceGroupName: string, serviceName: string, diagnosticId: string, callback: ServiceCallback): void; - listByService(resourceGroupName: string, serviceName: string, diagnosticId: string, options: { filter? : string, top? : number, skip? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serviceName: string, diagnosticId: string, parameters: models.DiagnosticContract, options?: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Checks that logger entity specified by identifier is associated with the - * diagnostics entity. + * Creates a new Diagnostic or updates an existing one. * * @param {string} resourceGroupName The name of the resource group. * @@ -11540,38 +10944,46 @@ export interface DiagnosticLogger { * @param {string} diagnosticId Diagnostic identifier. Must be unique in the * current API Management service instance. * - * @param {string} loggerid Logger identifier. Must be unique in the API - * Management service instance. + * @param {object} parameters Create parameters. * - * @param {object} [options] Optional Parameters. + * @param {string} [parameters.alwaysLog] Specifies for what type of messages + * sampling settings should not apply. Possible values include: 'allErrors' * - * @param {object} [options.customHeaders] Headers that will be added to the - * request + * @param {string} parameters.loggerId Resource Id of a target logger. * - * @returns {Promise} A promise is returned + * @param {object} [parameters.sampling] Sampling settings for Diagnostic. * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @param {string} [parameters.sampling.samplingType] Sampling type. Possible + * values include: 'fixed' * - * @reject {Error|ServiceError} - The error object. - */ - checkEntityExistsWithHttpOperationResponse(resourceGroupName: string, serviceName: string, diagnosticId: string, loggerid: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Checks that logger entity specified by identifier is associated with the - * diagnostics entity. + * @param {number} [parameters.sampling.percentage] Rate of sampling for + * fixed-rate sampling. * - * @param {string} resourceGroupName The name of the resource group. + * @param {object} [parameters.frontend] Diagnostic settings for + * incoming/outcoming HTTP messages to the Gateway. * - * @param {string} serviceName The name of the API Management service. + * @param {object} [parameters.backend] Diagnostic settings for + * incoming/outcoming HTTP messages to the Backend * - * @param {string} diagnosticId Diagnostic identifier. Must be unique in the - * current API Management service instance. + * @param {object} [parameters.backend.request] Diagnostic settings for + * request. * - * @param {string} loggerid Logger identifier. Must be unique in the API - * Management service instance. + * @param {object} [parameters.backend.response] Diagnostic settings for + * response. + * + * @param {array} [parameters.backend.response.headers] Array of HTTP Headers + * to log. + * + * @param {object} [parameters.backend.response.body] Body logging settings. + * + * @param {number} [parameters.backend.response.body.bytes] Number of request + * body bytes to log. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.ifMatch] ETag of the Entity. Not required when + * creating an entity, but required when updating an entity. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -11582,7 +10994,7 @@ export interface DiagnosticLogger { * * {Promise} A promise is returned. * - * @resolve {Boolean} - The deserialized result object. + * @resolve {DiagnosticContract} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -11590,19 +11002,20 @@ export interface DiagnosticLogger { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Boolean} [result] - The deserialized result object if an error did not occur. + * {DiagnosticContract} [result] - The deserialized result object if an error did not occur. + * See {@link DiagnosticContract} 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. */ - checkEntityExists(resourceGroupName: string, serviceName: string, diagnosticId: string, loggerid: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - checkEntityExists(resourceGroupName: string, serviceName: string, diagnosticId: string, loggerid: string, callback: ServiceCallback): void; - checkEntityExists(resourceGroupName: string, serviceName: string, diagnosticId: string, loggerid: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serviceName: string, diagnosticId: string, parameters: models.DiagnosticContract, options?: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, serviceName: string, diagnosticId: string, parameters: models.DiagnosticContract, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serviceName: string, diagnosticId: string, parameters: models.DiagnosticContract, options: { ifMatch? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Attaches a logger to a dignostic. + * Updates the details of the Diagnostic specified by its identifier. * * @param {string} resourceGroupName The name of the resource group. * @@ -11611,8 +11024,44 @@ export interface DiagnosticLogger { * @param {string} diagnosticId Diagnostic identifier. Must be unique in the * current API Management service instance. * - * @param {string} loggerid Logger identifier. Must be unique in the API - * Management service instance. + * @param {object} parameters Diagnostic Update parameters. + * + * @param {string} [parameters.alwaysLog] Specifies for what type of messages + * sampling settings should not apply. Possible values include: 'allErrors' + * + * @param {string} parameters.loggerId Resource Id of a target logger. + * + * @param {object} [parameters.sampling] Sampling settings for Diagnostic. + * + * @param {string} [parameters.sampling.samplingType] Sampling type. Possible + * values include: 'fixed' + * + * @param {number} [parameters.sampling.percentage] Rate of sampling for + * fixed-rate sampling. + * + * @param {object} [parameters.frontend] Diagnostic settings for + * incoming/outcoming HTTP messages to the Gateway. + * + * @param {object} [parameters.backend] Diagnostic settings for + * incoming/outcoming HTTP messages to the Backend + * + * @param {object} [parameters.backend.request] Diagnostic settings for + * request. + * + * @param {object} [parameters.backend.response] Diagnostic settings for + * response. + * + * @param {array} [parameters.backend.response.headers] Array of HTTP Headers + * to log. + * + * @param {object} [parameters.backend.response.body] Body logging settings. + * + * @param {number} [parameters.backend.response.body.bytes] Number of request + * body bytes to log. + * + * @param {string} ifMatch ETag of the 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] Optional Parameters. * @@ -11621,14 +11070,14 @@ export interface DiagnosticLogger { * * @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(resourceGroupName: string, serviceName: string, diagnosticId: string, loggerid: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + updateWithHttpOperationResponse(resourceGroupName: string, serviceName: string, diagnosticId: string, parameters: models.DiagnosticContract, ifMatch: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Attaches a logger to a dignostic. + * Updates the details of the Diagnostic specified by its identifier. * * @param {string} resourceGroupName The name of the resource group. * @@ -11637,8 +11086,44 @@ export interface DiagnosticLogger { * @param {string} diagnosticId Diagnostic identifier. Must be unique in the * current API Management service instance. * - * @param {string} loggerid Logger identifier. Must be unique in the API - * Management service instance. + * @param {object} parameters Diagnostic Update parameters. + * + * @param {string} [parameters.alwaysLog] Specifies for what type of messages + * sampling settings should not apply. Possible values include: 'allErrors' + * + * @param {string} parameters.loggerId Resource Id of a target logger. + * + * @param {object} [parameters.sampling] Sampling settings for Diagnostic. + * + * @param {string} [parameters.sampling.samplingType] Sampling type. Possible + * values include: 'fixed' + * + * @param {number} [parameters.sampling.percentage] Rate of sampling for + * fixed-rate sampling. + * + * @param {object} [parameters.frontend] Diagnostic settings for + * incoming/outcoming HTTP messages to the Gateway. + * + * @param {object} [parameters.backend] Diagnostic settings for + * incoming/outcoming HTTP messages to the Backend + * + * @param {object} [parameters.backend.request] Diagnostic settings for + * request. + * + * @param {object} [parameters.backend.response] Diagnostic settings for + * response. + * + * @param {array} [parameters.backend.response.headers] Array of HTTP Headers + * to log. + * + * @param {object} [parameters.backend.response.body] Body logging settings. + * + * @param {number} [parameters.backend.response.body.bytes] Number of request + * body bytes to log. + * + * @param {string} ifMatch ETag of the 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] Optional Parameters. * @@ -11652,7 +11137,7 @@ export interface DiagnosticLogger { * * {Promise} A promise is returned. * - * @resolve {LoggerContract} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -11660,20 +11145,19 @@ export interface DiagnosticLogger { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {LoggerContract} [result] - The deserialized result object if an error did not occur. - * See {@link LoggerContract} for more information. + * {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. */ - createOrUpdate(resourceGroupName: string, serviceName: string, diagnosticId: string, loggerid: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, serviceName: string, diagnosticId: string, loggerid: string, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, serviceName: string, diagnosticId: string, loggerid: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + update(resourceGroupName: string, serviceName: string, diagnosticId: string, parameters: models.DiagnosticContract, ifMatch: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, serviceName: string, diagnosticId: string, parameters: models.DiagnosticContract, ifMatch: string, callback: ServiceCallback): void; + update(resourceGroupName: string, serviceName: string, diagnosticId: string, parameters: models.DiagnosticContract, ifMatch: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Deletes the specified Logger from Diagnostic. + * Deletes the specified Diagnostic. * * @param {string} resourceGroupName The name of the resource group. * @@ -11682,8 +11166,9 @@ export interface DiagnosticLogger { * @param {string} diagnosticId Diagnostic identifier. Must be unique in the * current API Management service instance. * - * @param {string} loggerid Logger identifier. Must be unique in the API - * Management service instance. + * @param {string} ifMatch ETag of the 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] Optional Parameters. * @@ -11696,10 +11181,10 @@ export interface DiagnosticLogger { * * @reject {Error|ServiceError} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, serviceName: string, diagnosticId: string, loggerid: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteMethodWithHttpOperationResponse(resourceGroupName: string, serviceName: string, diagnosticId: string, ifMatch: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes the specified Logger from Diagnostic. + * Deletes the specified Diagnostic. * * @param {string} resourceGroupName The name of the resource group. * @@ -11708,8 +11193,9 @@ export interface DiagnosticLogger { * @param {string} diagnosticId Diagnostic identifier. Must be unique in the * current API Management service instance. * - * @param {string} loggerid Logger identifier. Must be unique in the API - * Management service instance. + * @param {string} ifMatch ETag of the 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] Optional Parameters. * @@ -11737,14 +11223,13 @@ export interface DiagnosticLogger { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - deleteMethod(resourceGroupName: string, serviceName: string, diagnosticId: string, loggerid: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, serviceName: string, diagnosticId: string, loggerid: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, serviceName: string, diagnosticId: string, loggerid: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serviceName: string, diagnosticId: string, ifMatch: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, serviceName: string, diagnosticId: string, ifMatch: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serviceName: string, diagnosticId: string, ifMatch: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Lists all loggers assosiated with the specified Diagnostic of the API - * Management service instance. + * Lists all diagnostics of the API Management service instance. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -11756,15 +11241,14 @@ export interface DiagnosticLogger { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByServiceNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByServiceNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Lists all loggers assosiated with the specified Diagnostic of the API - * Management service instance. + * Lists all diagnostics of the API Management service instance. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -11781,7 +11265,7 @@ export interface DiagnosticLogger { * * {Promise} A promise is returned. * - * @resolve {LoggerCollection} - The deserialized result object. + * @resolve {DiagnosticCollection} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -11789,16 +11273,16 @@ export interface DiagnosticLogger { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {LoggerCollection} [result] - The deserialized result object if an error did not occur. - * See {@link LoggerCollection} for more information. + * {DiagnosticCollection} [result] - The deserialized result object if an error did not occur. + * See {@link DiagnosticCollection} 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. */ - listByServiceNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByServiceNext(nextPageLink: string, callback: ServiceCallback): void; - listByServiceNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByServiceNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServiceNext(nextPageLink: string, callback: ServiceCallback): void; + listByServiceNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** @@ -14205,6 +13689,9 @@ export interface Logger { * @param {boolean} [parameters.isBuffered] Whether records are buffered in the * logger before publishing. Default is assumed to be true. * + * @param {string} [parameters.resourceId] Azure Resource Id of a log target + * (either Azure Event Hub resource or Azure Application Insights resource). + * * @param {object} [options] Optional Parameters. * * @param {string} [options.ifMatch] ETag of the Entity. Not required when @@ -14245,6 +13732,9 @@ export interface Logger { * @param {boolean} [parameters.isBuffered] Whether records are buffered in the * logger before publishing. Default is assumed to be true. * + * @param {string} [parameters.resourceId] Azure Resource Id of a log target + * (either Azure Event Hub resource or Azure Application Insights resource). + * * @param {object} [options] Optional Parameters. * * @param {string} [options.ifMatch] ETag of the Entity. Not required when @@ -17292,14 +16782,14 @@ export interface Product { * omitted when creating a new product it's value is assumed to be true. * * @param {boolean} [parameters.approvalRequired] whether subscription approval - * is required. If false, new subscriptions will be approved automatically + * is required. If false, new subscriptions will be approved automatically * enabling developers to call the product’s APIs immediately after - * subscribing. If true, administrators must manually approve the subscription + * subscribing. If true, administrators must manually approve the subscription * before the developer can any of the product’s APIs. Can be present only if * subscriptionRequired property is present and has a value of false. * * @param {number} [parameters.subscriptionsLimit] Whether the number of - * subscriptions a user can have to this product at the same time. Set to null + * subscriptions a user can have to this product at the same time. Set to null * or omit to allow unlimited per user subscriptions. Can be present only if * subscriptionRequired property is present and has a value of false. * @@ -17355,14 +16845,14 @@ export interface Product { * omitted when creating a new product it's value is assumed to be true. * * @param {boolean} [parameters.approvalRequired] whether subscription approval - * is required. If false, new subscriptions will be approved automatically + * is required. If false, new subscriptions will be approved automatically * enabling developers to call the product’s APIs immediately after - * subscribing. If true, administrators must manually approve the subscription + * subscribing. If true, administrators must manually approve the subscription * before the developer can any of the product’s APIs. Can be present only if * subscriptionRequired property is present and has a value of false. * * @param {number} [parameters.subscriptionsLimit] Whether the number of - * subscriptions a user can have to this product at the same time. Set to null + * subscriptions a user can have to this product at the same time. Set to null * or omit to allow unlimited per user subscriptions. Can be present only if * subscriptionRequired property is present and has a value of false. * @@ -17437,14 +16927,14 @@ export interface Product { * omitted when creating a new product it's value is assumed to be true. * * @param {boolean} [parameters.approvalRequired] whether subscription approval - * is required. If false, new subscriptions will be approved automatically + * is required. If false, new subscriptions will be approved automatically * enabling developers to call the product’s APIs immediately after - * subscribing. If true, administrators must manually approve the subscription + * subscribing. If true, administrators must manually approve the subscription * before the developer can any of the product’s APIs. Can be present only if * subscriptionRequired property is present and has a value of false. * * @param {number} [parameters.subscriptionsLimit] Whether the number of - * subscriptions a user can have to this product at the same time. Set to null + * subscriptions a user can have to this product at the same time. Set to null * or omit to allow unlimited per user subscriptions. Can be present only if * subscriptionRequired property is present and has a value of false. * @@ -17501,14 +16991,14 @@ export interface Product { * omitted when creating a new product it's value is assumed to be true. * * @param {boolean} [parameters.approvalRequired] whether subscription approval - * is required. If false, new subscriptions will be approved automatically + * is required. If false, new subscriptions will be approved automatically * enabling developers to call the product’s APIs immediately after - * subscribing. If true, administrators must manually approve the subscription + * subscribing. If true, administrators must manually approve the subscription * before the developer can any of the product’s APIs. Can be present only if * subscriptionRequired property is present and has a value of false. * * @param {number} [parameters.subscriptionsLimit] Whether the number of - * subscriptions a user can have to this product at the same time. Set to null + * subscriptions a user can have to this product at the same time. Set to null * or omit to allow unlimited per user subscriptions. Can be present only if * subscriptionRequired property is present and has a value of false. * diff --git a/lib/services/apimanagement/lib/operations/index.js b/lib/services/apimanagement/lib/operations/index.js index e5955aa5a7..ed88b74d86 100644 --- a/lib/services/apimanagement/lib/operations/index.js +++ b/lib/services/apimanagement/lib/operations/index.js @@ -26,7 +26,6 @@ exports.ApiProduct = require('./apiProduct'); exports.ApiPolicy = require('./apiPolicy'); exports.ApiSchema = require('./apiSchema'); exports.ApiDiagnostic = require('./apiDiagnostic'); -exports.ApiDiagnosticLogger = require('./apiDiagnosticLogger'); exports.ApiIssue = require('./apiIssue'); exports.ApiIssueComment = require('./apiIssueComment'); exports.ApiIssueAttachment = require('./apiIssueAttachment'); @@ -36,7 +35,6 @@ exports.Certificate = require('./certificate'); exports.ApiManagementOperations = require('./apiManagementOperations'); exports.ApiManagementService = require('./apiManagementService'); exports.Diagnostic = require('./diagnostic'); -exports.DiagnosticLogger = require('./diagnosticLogger'); exports.EmailTemplate = require('./emailTemplate'); exports.Group = require('./group'); exports.GroupUser = require('./groupUser'); diff --git a/lib/services/apimanagement/lib/operations/logger.js b/lib/services/apimanagement/lib/operations/logger.js index e04109b31e..39ab5e5d6a 100644 --- a/lib/services/apimanagement/lib/operations/logger.js +++ b/lib/services/apimanagement/lib/operations/logger.js @@ -580,6 +580,9 @@ function _get(resourceGroupName, serviceName, loggerid, options, callback) { * @param {boolean} [parameters.isBuffered] Whether records are buffered in the * logger before publishing. Default is assumed to be true. * + * @param {string} [parameters.resourceId] Azure Resource Id of a log target + * (either Azure Event Hub resource or Azure Application Insights resource). + * * @param {object} [options] Optional Parameters. * * @param {string} [options.ifMatch] ETag of the Entity. Not required when @@ -1622,6 +1625,9 @@ class Logger { * @param {boolean} [parameters.isBuffered] Whether records are buffered in the * logger before publishing. Default is assumed to be true. * + * @param {string} [parameters.resourceId] Azure Resource Id of a log target + * (either Azure Event Hub resource or Azure Application Insights resource). + * * @param {object} [options] Optional Parameters. * * @param {string} [options.ifMatch] ETag of the Entity. Not required when @@ -1674,6 +1680,9 @@ class Logger { * @param {boolean} [parameters.isBuffered] Whether records are buffered in the * logger before publishing. Default is assumed to be true. * + * @param {string} [parameters.resourceId] Azure Resource Id of a log target + * (either Azure Event Hub resource or Azure Application Insights resource). + * * @param {object} [options] Optional Parameters. * * @param {string} [options.ifMatch] ETag of the Entity. Not required when diff --git a/lib/services/apimanagement/lib/operations/product.js b/lib/services/apimanagement/lib/operations/product.js index 2f715cb8c6..f4a2d57636 100644 --- a/lib/services/apimanagement/lib/operations/product.js +++ b/lib/services/apimanagement/lib/operations/product.js @@ -609,14 +609,14 @@ function _get(resourceGroupName, serviceName, productId, options, callback) { * omitted when creating a new product it's value is assumed to be true. * * @param {boolean} [parameters.approvalRequired] whether subscription approval - * is required. If false, new subscriptions will be approved automatically + * is required. If false, new subscriptions will be approved automatically * enabling developers to call the product’s APIs immediately after - * subscribing. If true, administrators must manually approve the subscription + * subscribing. If true, administrators must manually approve the subscription * before the developer can any of the product’s APIs. Can be present only if * subscriptionRequired property is present and has a value of false. * * @param {number} [parameters.subscriptionsLimit] Whether the number of - * subscriptions a user can have to this product at the same time. Set to null + * subscriptions a user can have to this product at the same time. Set to null * or omit to allow unlimited per user subscriptions. Can be present only if * subscriptionRequired property is present and has a value of false. * @@ -871,14 +871,14 @@ function _createOrUpdate(resourceGroupName, serviceName, productId, parameters, * omitted when creating a new product it's value is assumed to be true. * * @param {boolean} [parameters.approvalRequired] whether subscription approval - * is required. If false, new subscriptions will be approved automatically + * is required. If false, new subscriptions will be approved automatically * enabling developers to call the product’s APIs immediately after - * subscribing. If true, administrators must manually approve the subscription + * subscribing. If true, administrators must manually approve the subscription * before the developer can any of the product’s APIs. Can be present only if * subscriptionRequired property is present and has a value of false. * * @param {number} [parameters.subscriptionsLimit] Whether the number of - * subscriptions a user can have to this product at the same time. Set to null + * subscriptions a user can have to this product at the same time. Set to null * or omit to allow unlimited per user subscriptions. Can be present only if * subscriptionRequired property is present and has a value of false. * @@ -1741,14 +1741,14 @@ class Product { * omitted when creating a new product it's value is assumed to be true. * * @param {boolean} [parameters.approvalRequired] whether subscription approval - * is required. If false, new subscriptions will be approved automatically + * is required. If false, new subscriptions will be approved automatically * enabling developers to call the product’s APIs immediately after - * subscribing. If true, administrators must manually approve the subscription + * subscribing. If true, administrators must manually approve the subscription * before the developer can any of the product’s APIs. Can be present only if * subscriptionRequired property is present and has a value of false. * * @param {number} [parameters.subscriptionsLimit] Whether the number of - * subscriptions a user can have to this product at the same time. Set to null + * subscriptions a user can have to this product at the same time. Set to null * or omit to allow unlimited per user subscriptions. Can be present only if * subscriptionRequired property is present and has a value of false. * @@ -1816,14 +1816,14 @@ class Product { * omitted when creating a new product it's value is assumed to be true. * * @param {boolean} [parameters.approvalRequired] whether subscription approval - * is required. If false, new subscriptions will be approved automatically + * is required. If false, new subscriptions will be approved automatically * enabling developers to call the product’s APIs immediately after - * subscribing. If true, administrators must manually approve the subscription + * subscribing. If true, administrators must manually approve the subscription * before the developer can any of the product’s APIs. Can be present only if * subscriptionRequired property is present and has a value of false. * * @param {number} [parameters.subscriptionsLimit] Whether the number of - * subscriptions a user can have to this product at the same time. Set to null + * subscriptions a user can have to this product at the same time. Set to null * or omit to allow unlimited per user subscriptions. Can be present only if * subscriptionRequired property is present and has a value of false. * @@ -1913,14 +1913,14 @@ class Product { * omitted when creating a new product it's value is assumed to be true. * * @param {boolean} [parameters.approvalRequired] whether subscription approval - * is required. If false, new subscriptions will be approved automatically + * is required. If false, new subscriptions will be approved automatically * enabling developers to call the product’s APIs immediately after - * subscribing. If true, administrators must manually approve the subscription + * subscribing. If true, administrators must manually approve the subscription * before the developer can any of the product’s APIs. Can be present only if * subscriptionRequired property is present and has a value of false. * * @param {number} [parameters.subscriptionsLimit] Whether the number of - * subscriptions a user can have to this product at the same time. Set to null + * subscriptions a user can have to this product at the same time. Set to null * or omit to allow unlimited per user subscriptions. Can be present only if * subscriptionRequired property is present and has a value of false. * @@ -1989,14 +1989,14 @@ class Product { * omitted when creating a new product it's value is assumed to be true. * * @param {boolean} [parameters.approvalRequired] whether subscription approval - * is required. If false, new subscriptions will be approved automatically + * is required. If false, new subscriptions will be approved automatically * enabling developers to call the product’s APIs immediately after - * subscribing. If true, administrators must manually approve the subscription + * subscribing. If true, administrators must manually approve the subscription * before the developer can any of the product’s APIs. Can be present only if * subscriptionRequired property is present and has a value of false. * * @param {number} [parameters.subscriptionsLimit] Whether the number of - * subscriptions a user can have to this product at the same time. Set to null + * subscriptions a user can have to this product at the same time. Set to null * or omit to allow unlimited per user subscriptions. Can be present only if * subscriptionRequired property is present and has a value of false. *