From 139c8cb6ee050c1b0d0264c49559f719c1ad0966 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 17 Jul 2018 19:38:57 +0000 Subject: [PATCH] Generated from f54b36deb73654dd59a4d4b3571371268b1414ae BugFix: defaultSinkRefs is an array of string --- .../serviceFabricMeshManagement/LICENSE.txt | 21 + .../serviceFabricMeshManagement/README.md | 42 + .../lib/models/applicationProperties.js | 155 ++ .../models/applicationResourceDescription.js | 211 ++ .../applicationResourceDescriptionList.js | 67 + .../lib/models/availableOperationDisplay.js | 77 + ...ternalMonitoringPipelineSinkDescription.js | 119 + .../models/containerCodePackageProperties.js | 260 ++ .../lib/models/containerEvent.js | 92 + .../lib/models/containerInstanceView.js | 105 + .../lib/models/containerLabel.js | 60 + .../lib/models/containerLogs.js | 52 + .../lib/models/containerState.js | 84 + .../lib/models/containerVolume.js | 70 + .../lib/models/diagnosticsDescription.js | 92 + .../lib/models/diagnosticsRef.js | 68 + .../lib/models/diagnosticsSinkProperties.js | 75 + .../lib/models/endpointProperties.js | 60 + .../lib/models/environmentVariable.js | 60 + .../lib/models/errorModel.js | 60 + .../lib/models/imageRegistryCredential.js | 69 + .../lib/models/index.d.ts | 968 ++++++++ .../lib/models/index.js | 69 + .../lib/models/ingressConfig.js | 82 + .../lib/models/layer4IngressConfig.js | 88 + .../lib/models/managedProxyResource.js | 79 + .../lib/models/networkProperties.js | 78 + .../lib/models/networkRef.js | 52 + .../lib/models/networkResourceDescription.js | 134 + .../models/networkResourceDescriptionList.js | 67 + .../lib/models/operationListResult.js | 69 + .../lib/models/operationResult.js | 86 + .../models/provisionedResourceProperties.js | 53 + .../lib/models/proxyResource.js | 80 + .../lib/models/resource.js | 85 + .../lib/models/resourceLimits.js | 63 + .../lib/models/resourceRequests.js | 66 + .../lib/models/resourceRequirements.js | 73 + .../lib/models/serviceList.js | 68 + .../lib/models/serviceReplicaDescription.js | 101 + .../lib/models/serviceReplicaList.js | 68 + .../lib/models/serviceReplicaProperties.js | 106 + .../lib/models/serviceResourceDescription.js | 169 ++ .../lib/models/setting.js | 60 + .../lib/models/trackedResource.js | 95 + .../lib/models/volumeProperties.js | 79 + .../volumeProviderParametersAzureFile.js | 71 + .../lib/models/volumeResourceDescription.js | 135 + .../models/volumeResourceDescriptionList.js | 67 + .../lib/operations/application.js | 1770 +++++++++++++ .../lib/operations/codePackage.js | 311 +++ .../lib/operations/index.d.ts | 2209 +++++++++++++++++ .../lib/operations/index.js | 23 + .../lib/operations/network.js | 1758 +++++++++++++ .../lib/operations/operations.js | 466 ++++ .../lib/operations/replica.js | 767 ++++++ .../lib/operations/service.js | 741 ++++++ .../lib/operations/volume.js | 1753 +++++++++++++ .../serviceFabricMeshManagementClient.d.ts | 68 + .../lib/serviceFabricMeshManagementClient.js | 91 + .../serviceFabricMeshManagement/package.json | 25 + 61 files changed, 15092 insertions(+) create mode 100644 lib/services/serviceFabricMeshManagement/LICENSE.txt create mode 100644 lib/services/serviceFabricMeshManagement/README.md create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/applicationProperties.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/applicationResourceDescription.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/applicationResourceDescriptionList.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/availableOperationDisplay.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/azureInternalMonitoringPipelineSinkDescription.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/containerCodePackageProperties.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/containerEvent.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/containerInstanceView.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/containerLabel.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/containerLogs.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/containerState.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/containerVolume.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/diagnosticsDescription.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/diagnosticsRef.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/diagnosticsSinkProperties.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/endpointProperties.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/environmentVariable.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/errorModel.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/imageRegistryCredential.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/index.d.ts create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/index.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/ingressConfig.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/layer4IngressConfig.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/managedProxyResource.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/networkProperties.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/networkRef.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/networkResourceDescription.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/networkResourceDescriptionList.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/operationListResult.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/operationResult.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/provisionedResourceProperties.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/proxyResource.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/resource.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/resourceLimits.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/resourceRequests.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/resourceRequirements.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/serviceList.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/serviceReplicaDescription.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/serviceReplicaList.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/serviceReplicaProperties.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/serviceResourceDescription.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/setting.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/trackedResource.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/volumeProperties.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/volumeProviderParametersAzureFile.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/volumeResourceDescription.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/models/volumeResourceDescriptionList.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/operations/application.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/operations/codePackage.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/operations/index.d.ts create mode 100644 lib/services/serviceFabricMeshManagement/lib/operations/index.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/operations/network.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/operations/operations.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/operations/replica.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/operations/service.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/operations/volume.js create mode 100644 lib/services/serviceFabricMeshManagement/lib/serviceFabricMeshManagementClient.d.ts create mode 100644 lib/services/serviceFabricMeshManagement/lib/serviceFabricMeshManagementClient.js create mode 100644 lib/services/serviceFabricMeshManagement/package.json diff --git a/lib/services/serviceFabricMeshManagement/LICENSE.txt b/lib/services/serviceFabricMeshManagement/LICENSE.txt new file mode 100644 index 0000000000..5431ba98b9 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/LICENSE.txt @@ -0,0 +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. diff --git a/lib/services/serviceFabricMeshManagement/README.md b/lib/services/serviceFabricMeshManagement/README.md new file mode 100644 index 0000000000..5237987aef --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/README.md @@ -0,0 +1,42 @@ +--- +uid: azure-arm-servicefabricmesh +summary: *content + +--- +# Microsoft Azure SDK for Node.js - ServiceFabricMeshManagementClient +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-servicefabricmesh +``` + +## How to use + +### Authentication, client creation and get application as an example. + +```javascript +const msRestAzure = require("ms-rest-azure"); +const ServiceFabricMeshManagementClient = require("azure-arm-servicefabricmesh"); +msRestAzure.interactiveLogin().then((creds) => { + const subscriptionId = ""; + const client = new ServiceFabricMeshManagementClient(creds, subscriptionId); + const resourceGroupName = "testresourceGroupName"; + const applicationName = "testapplicationName"; + return client.application.get(resourceGroupName, applicationName).then((result) => { + console.log("The result is:"); + console.log(result); + }); +}).catch((err) => { + console.log('An error occurred:'); + console.dir(err, {depth: null, colors: true}); +}); + +## Related projects + +- [Microsoft Azure SDK for Node.js](https://github.com/Azure/azure-sdk-for-node) diff --git a/lib/services/serviceFabricMeshManagement/lib/models/applicationProperties.js b/lib/services/serviceFabricMeshManagement/lib/models/applicationProperties.js new file mode 100644 index 0000000000..6c923b1ba8 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/applicationProperties.js @@ -0,0 +1,155 @@ +/* + * 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'); + +/** + * This type describes properties of an application resource. + * + */ +class ApplicationProperties { + /** + * Create a ApplicationProperties. + * @member {string} [description] User readable description of the + * application. + * @member {string} [debugParams] Internal use. + * @member {array} [services] describes the services in the application. + * @member {string} [healthState] Describes the health state of an + * application resource. Possible values include: 'Invalid', 'Ok', 'Warning', + * 'Error', 'Unknown' + * @member {string} [unhealthyEvaluation] When the application's health state + * is not 'Ok', this additional details from service fabric Health Manager + * for the user to know why the application is marked unhealthy. + * @member {string} [status] Status of the application resource. Possible + * values include: 'Invalid', 'Ready', 'Upgrading', 'Creating', 'Deleting', + * 'Failed' + * @member {string} [statusDetails] Gives additional information about the + * current status of the application deployment. + * @member {array} [serviceNames] Names of the services in the application. + * @member {object} [diagnostics] Describes the diagnostics definition and + * usage for an application resource. + * @member {array} [diagnostics.sinks] List of supported sinks that can be + * referenced. + * @member {boolean} [diagnostics.enabled] Status of whether or not sinks are + * enabled. + * @member {array} [diagnostics.defaultSinkRefs] The sinks to be used if + * diagnostics is enabled. Sink choices can be overridden at the service and + * code package level. + */ + constructor() { + } + + /** + * Defines the metadata of ApplicationProperties + * + * @returns {object} metadata of ApplicationProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationProperties', + type: { + name: 'Composite', + className: 'ApplicationProperties', + modelProperties: { + description: { + required: false, + serializedName: 'description', + type: { + name: 'String' + } + }, + debugParams: { + required: false, + serializedName: 'debugParams', + type: { + name: 'String' + } + }, + services: { + required: false, + serializedName: 'services', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ServiceResourceDescriptionElementType', + type: { + name: 'Composite', + className: 'ServiceResourceDescription' + } + } + } + }, + healthState: { + required: false, + readOnly: true, + serializedName: 'healthState', + type: { + name: 'String' + } + }, + unhealthyEvaluation: { + required: false, + readOnly: true, + serializedName: 'unhealthyEvaluation', + type: { + name: 'String' + } + }, + status: { + required: false, + readOnly: true, + serializedName: 'status', + type: { + name: 'String' + } + }, + statusDetails: { + required: false, + readOnly: true, + serializedName: 'statusDetails', + type: { + name: 'String' + } + }, + serviceNames: { + required: false, + readOnly: true, + serializedName: 'serviceNames', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + diagnostics: { + required: false, + serializedName: 'diagnostics', + type: { + name: 'Composite', + className: 'DiagnosticsDescription' + } + } + } + } + }; + } +} + +module.exports = ApplicationProperties; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/applicationResourceDescription.js b/lib/services/serviceFabricMeshManagement/lib/models/applicationResourceDescription.js new file mode 100644 index 0000000000..67560b8e4f --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/applicationResourceDescription.js @@ -0,0 +1,211 @@ +/* + * 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'); + +/** + * This type describes an application resource. + * + * @extends models['TrackedResource'] + */ +class ApplicationResourceDescription extends models['TrackedResource'] { + /** + * Create a ApplicationResourceDescription. + * @member {string} [provisioningState] State of the resource. + * @member {string} [description] User readable description of the + * application. + * @member {string} [debugParams] Internal use. + * @member {array} [services] describes the services in the application. + * @member {string} [healthState] Describes the health state of an + * application resource. Possible values include: 'Invalid', 'Ok', 'Warning', + * 'Error', 'Unknown' + * @member {string} [unhealthyEvaluation] When the application's health state + * is not 'Ok', this additional details from service fabric Health Manager + * for the user to know why the application is marked unhealthy. + * @member {string} [status] Status of the application resource. Possible + * values include: 'Invalid', 'Ready', 'Upgrading', 'Creating', 'Deleting', + * 'Failed' + * @member {string} [statusDetails] Gives additional information about the + * current status of the application deployment. + * @member {array} [serviceNames] Names of the services in the application. + * @member {object} [diagnostics] Describes the diagnostics definition and + * usage for an application resource. + * @member {array} [diagnostics.sinks] List of supported sinks that can be + * referenced. + * @member {boolean} [diagnostics.enabled] Status of whether or not sinks are + * enabled. + * @member {array} [diagnostics.defaultSinkRefs] The sinks to be used if + * diagnostics is enabled. Sink choices can be overridden at the service and + * code package level. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ApplicationResourceDescription + * + * @returns {object} metadata of ApplicationResourceDescription + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationResourceDescription', + type: { + name: 'Composite', + className: 'ApplicationResourceDescription', + 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' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + debugParams: { + required: false, + serializedName: 'properties.debugParams', + type: { + name: 'String' + } + }, + services: { + required: false, + serializedName: 'properties.services', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ServiceResourceDescriptionElementType', + type: { + name: 'Composite', + className: 'ServiceResourceDescription' + } + } + } + }, + healthState: { + required: false, + readOnly: true, + serializedName: 'properties.healthState', + type: { + name: 'String' + } + }, + unhealthyEvaluation: { + required: false, + readOnly: true, + serializedName: 'properties.unhealthyEvaluation', + type: { + name: 'String' + } + }, + status: { + required: false, + readOnly: true, + serializedName: 'properties.status', + type: { + name: 'String' + } + }, + statusDetails: { + required: false, + readOnly: true, + serializedName: 'properties.statusDetails', + type: { + name: 'String' + } + }, + serviceNames: { + required: false, + readOnly: true, + serializedName: 'properties.serviceNames', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + diagnostics: { + required: false, + serializedName: 'properties.diagnostics', + type: { + name: 'Composite', + className: 'DiagnosticsDescription' + } + } + } + } + }; + } +} + +module.exports = ApplicationResourceDescription; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/applicationResourceDescriptionList.js b/lib/services/serviceFabricMeshManagement/lib/models/applicationResourceDescriptionList.js new file mode 100644 index 0000000000..fb4642dfab --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/applicationResourceDescriptionList.js @@ -0,0 +1,67 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * A pageable list of application resources. + */ +class ApplicationResourceDescriptionList extends Array { + /** + * Create a ApplicationResourceDescriptionList. + * @member {string} [nextLink] URI to fetch the next page of the list. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ApplicationResourceDescriptionList + * + * @returns {object} metadata of ApplicationResourceDescriptionList + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationResourceDescriptionList', + type: { + name: 'Composite', + className: 'ApplicationResourceDescriptionList', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplicationResourceDescriptionElementType', + type: { + name: 'Composite', + className: 'ApplicationResourceDescription' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ApplicationResourceDescriptionList; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/availableOperationDisplay.js b/lib/services/serviceFabricMeshManagement/lib/models/availableOperationDisplay.js new file mode 100644 index 0000000000..646195f603 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/availableOperationDisplay.js @@ -0,0 +1,77 @@ +/* + * 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'; + +/** + * An operation available at the listed Azure resource provider. + * + */ +class AvailableOperationDisplay { + /** + * Create a AvailableOperationDisplay. + * @member {string} [provider] Name of the operation provider. + * @member {string} [resource] Name of the resource on which the operation is + * available. + * @member {string} [operation] Name of the available operation. + * @member {string} [description] Description of the available operation. + */ + constructor() { + } + + /** + * Defines the metadata of AvailableOperationDisplay + * + * @returns {object} metadata of AvailableOperationDisplay + * + */ + mapper() { + return { + required: false, + serializedName: 'AvailableOperationDisplay', + type: { + name: 'Composite', + className: 'AvailableOperationDisplay', + modelProperties: { + provider: { + required: false, + serializedName: 'provider', + type: { + name: 'String' + } + }, + resource: { + required: false, + serializedName: 'resource', + type: { + name: 'String' + } + }, + operation: { + required: false, + serializedName: 'operation', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'description', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AvailableOperationDisplay; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/azureInternalMonitoringPipelineSinkDescription.js b/lib/services/serviceFabricMeshManagement/lib/models/azureInternalMonitoringPipelineSinkDescription.js new file mode 100644 index 0000000000..bf2023bc50 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/azureInternalMonitoringPipelineSinkDescription.js @@ -0,0 +1,119 @@ +/* + * 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'); + +/** + * Diagnostics settings for Geneva. + * + * @extends models['DiagnosticsSinkProperties'] + */ +class AzureInternalMonitoringPipelineSinkDescription extends models['DiagnosticsSinkProperties'] { + /** + * Create a AzureInternalMonitoringPipelineSinkDescription. + * @member {string} [accountName] Azure Internal monitoring pipeline account. + * @member {string} [namespace] Azure Internal monitoring pipeline account + * namespace. + * @member {string} [maConfigUrl] Azure Internal monitoring agent + * configuration. + * @member {object} [fluentdConfigUrl] Azure Internal monitoring agent + * fluentd configuration. + * @member {string} [autoKeyConfigUrl] Azure Internal monitoring pipeline + * autokey associated with the certificate. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of AzureInternalMonitoringPipelineSinkDescription + * + * @returns {object} metadata of AzureInternalMonitoringPipelineSinkDescription + * + */ + mapper() { + return { + required: false, + serializedName: 'AzureInternalMonitoringPipeline', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'kind', + clientName: 'kind' + }, + uberParent: 'DiagnosticsSinkProperties', + className: 'AzureInternalMonitoringPipelineSinkDescription', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'description', + type: { + name: 'String' + } + }, + kind: { + required: true, + serializedName: 'kind', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + }, + accountName: { + required: false, + serializedName: 'accountName', + type: { + name: 'String' + } + }, + namespace: { + required: false, + serializedName: 'namespace', + type: { + name: 'String' + } + }, + maConfigUrl: { + required: false, + serializedName: 'maConfigUrl', + type: { + name: 'String' + } + }, + fluentdConfigUrl: { + required: false, + serializedName: 'fluentdConfigUrl', + type: { + name: 'Object' + } + }, + autoKeyConfigUrl: { + required: false, + serializedName: 'autoKeyConfigUrl', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AzureInternalMonitoringPipelineSinkDescription; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/containerCodePackageProperties.js b/lib/services/serviceFabricMeshManagement/lib/models/containerCodePackageProperties.js new file mode 100644 index 0000000000..a4bfeaeb25 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/containerCodePackageProperties.js @@ -0,0 +1,260 @@ +/* + * 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'); + +/** + * Describes a container and its runtime properties. + * + */ +class ContainerCodePackageProperties { + /** + * Create a ContainerCodePackageProperties. + * @member {string} name The name of the code package. + * @member {string} image The Container image to use. + * @member {object} [imageRegistryCredential] Image registry credential. + * @member {string} [imageRegistryCredential.server] Docker image registry + * server, without protocol such as `http` and `https`. + * @member {string} [imageRegistryCredential.username] The username for the + * private registry. + * @member {string} [imageRegistryCredential.password] The password for the + * private registry. + * @member {string} [entrypoint] Override for the default entry point in the + * container. + * @member {array} [commands] Command array to execute within the container + * in exec form. + * @member {array} [environmentVariables] The environment variables to set in + * this container + * @member {array} [settings] The settings to set in this container. The + * setting file path can be fetched from environment variable + * "Fabric_SettingPath". The path for Windows container is "C:\\secrets". The + * path for Linux container is "/var/secrets". + * @member {array} [labels] The labels to set in this container. + * @member {array} [endpoints] The endpoints exposed by this container. + * @member {object} resources This type describes the resource requirements + * for a container or a service. + * @member {object} [resources.requests] Describes the requested resources + * for a given container. + * @member {number} [resources.requests.memoryInGB] The memory request in GB + * for this container. + * @member {number} [resources.requests.cpu] Requested number of CPU cores. + * At present, only full cores are supported. + * @member {object} [resources.limits] Describes the maximum limits on the + * resources for a given container. + * @member {number} [resources.limits.memoryInGB] The memory limit in GB. + * @member {number} [resources.limits.cpu] CPU limits in cores. At present, + * only full cores are supported. + * @member {array} [volumeRefs] The volumes to be attached to the container. + * @member {object} [instanceView] Runtime information of a container + * instance. + * @member {number} [instanceView.restartCount] The number of times the + * container has been restarted. + * @member {object} [instanceView.currentState] Current container instance + * state. + * @member {string} [instanceView.currentState.state] The state of this + * container + * @member {date} [instanceView.currentState.startTime] Date/time when the + * container state started. + * @member {string} [instanceView.currentState.exitCode] The container exit + * code. + * @member {date} [instanceView.currentState.finishTime] Date/time when the + * container state finished. + * @member {string} [instanceView.currentState.detailStatus] Human-readable + * status of this state. + * @member {object} [instanceView.previousState] Previous container instance + * state. + * @member {string} [instanceView.previousState.state] The state of this + * container + * @member {date} [instanceView.previousState.startTime] Date/time when the + * container state started. + * @member {string} [instanceView.previousState.exitCode] The container exit + * code. + * @member {date} [instanceView.previousState.finishTime] Date/time when the + * container state finished. + * @member {string} [instanceView.previousState.detailStatus] Human-readable + * status of this state. + * @member {array} [instanceView.events] The events of this container + * instance. + * @member {object} [diagnostics] Reference to sinks in + * DiagnosticsDescription. + * @member {boolean} [diagnostics.enabled] Status of whether or not sinks are + * enabled. + * @member {array} [diagnostics.sinkRefs] List of sinks to be used if + * enabled. References the list of sinks in DiagnosticsDescription. + */ + constructor() { + } + + /** + * Defines the metadata of ContainerCodePackageProperties + * + * @returns {object} metadata of ContainerCodePackageProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'ContainerCodePackageProperties', + type: { + name: 'Composite', + className: 'ContainerCodePackageProperties', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + image: { + required: true, + serializedName: 'image', + type: { + name: 'String' + } + }, + imageRegistryCredential: { + required: false, + serializedName: 'imageRegistryCredential', + type: { + name: 'Composite', + className: 'ImageRegistryCredential' + } + }, + entrypoint: { + required: false, + serializedName: 'entrypoint', + type: { + name: 'String' + } + }, + commands: { + required: false, + serializedName: 'commands', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + environmentVariables: { + required: false, + serializedName: 'environmentVariables', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'EnvironmentVariableElementType', + type: { + name: 'Composite', + className: 'EnvironmentVariable' + } + } + } + }, + settings: { + required: false, + serializedName: 'settings', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SettingElementType', + type: { + name: 'Composite', + className: 'Setting' + } + } + } + }, + labels: { + required: false, + serializedName: 'labels', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ContainerLabelElementType', + type: { + name: 'Composite', + className: 'ContainerLabel' + } + } + } + }, + endpoints: { + required: false, + serializedName: 'endpoints', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'EndpointPropertiesElementType', + type: { + name: 'Composite', + className: 'EndpointProperties' + } + } + } + }, + resources: { + required: true, + serializedName: 'resources', + type: { + name: 'Composite', + className: 'ResourceRequirements' + } + }, + volumeRefs: { + required: false, + serializedName: 'volumeRefs', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ContainerVolumeElementType', + type: { + name: 'Composite', + className: 'ContainerVolume' + } + } + } + }, + instanceView: { + required: false, + readOnly: true, + serializedName: 'instanceView', + type: { + name: 'Composite', + className: 'ContainerInstanceView' + } + }, + diagnostics: { + required: false, + serializedName: 'diagnostics', + type: { + name: 'Composite', + className: 'DiagnosticsRef' + } + } + } + } + }; + } +} + +module.exports = ContainerCodePackageProperties; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/containerEvent.js b/lib/services/serviceFabricMeshManagement/lib/models/containerEvent.js new file mode 100644 index 0000000000..ac09182ea5 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/containerEvent.js @@ -0,0 +1,92 @@ +/* + * 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'; + +/** + * A container event. + * + */ +class ContainerEvent { + /** + * Create a ContainerEvent. + * @member {string} [name] The name of the container event. + * @member {number} [count] The count of the event. + * @member {string} [firstTimestamp] Date/time of the first event. + * @member {string} [lastTimestamp] Date/time of the last event. + * @member {string} [message] The event message + * @member {string} [type] The event type. + */ + constructor() { + } + + /** + * Defines the metadata of ContainerEvent + * + * @returns {object} metadata of ContainerEvent + * + */ + mapper() { + return { + required: false, + serializedName: 'ContainerEvent', + type: { + name: 'Composite', + className: 'ContainerEvent', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + count: { + required: false, + serializedName: 'count', + type: { + name: 'Number' + } + }, + firstTimestamp: { + required: false, + serializedName: 'firstTimestamp', + type: { + name: 'String' + } + }, + lastTimestamp: { + required: false, + serializedName: 'lastTimestamp', + type: { + name: 'String' + } + }, + message: { + required: false, + serializedName: 'message', + type: { + name: 'String' + } + }, + type: { + required: false, + serializedName: 'type', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ContainerEvent; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/containerInstanceView.js b/lib/services/serviceFabricMeshManagement/lib/models/containerInstanceView.js new file mode 100644 index 0000000000..f20bedb6d3 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/containerInstanceView.js @@ -0,0 +1,105 @@ +/* + * 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'); + +/** + * Runtime information of a container instance. + * + */ +class ContainerInstanceView { + /** + * Create a ContainerInstanceView. + * @member {number} [restartCount] The number of times the container has been + * restarted. + * @member {object} [currentState] Current container instance state. + * @member {string} [currentState.state] The state of this container + * @member {date} [currentState.startTime] Date/time when the container state + * started. + * @member {string} [currentState.exitCode] The container exit code. + * @member {date} [currentState.finishTime] Date/time when the container + * state finished. + * @member {string} [currentState.detailStatus] Human-readable status of this + * state. + * @member {object} [previousState] Previous container instance state. + * @member {string} [previousState.state] The state of this container + * @member {date} [previousState.startTime] Date/time when the container + * state started. + * @member {string} [previousState.exitCode] The container exit code. + * @member {date} [previousState.finishTime] Date/time when the container + * state finished. + * @member {string} [previousState.detailStatus] Human-readable status of + * this state. + * @member {array} [events] The events of this container instance. + */ + constructor() { + } + + /** + * Defines the metadata of ContainerInstanceView + * + * @returns {object} metadata of ContainerInstanceView + * + */ + mapper() { + return { + required: false, + serializedName: 'ContainerInstanceView', + type: { + name: 'Composite', + className: 'ContainerInstanceView', + modelProperties: { + restartCount: { + required: false, + serializedName: 'restartCount', + type: { + name: 'Number' + } + }, + currentState: { + required: false, + serializedName: 'currentState', + type: { + name: 'Composite', + className: 'ContainerState' + } + }, + previousState: { + required: false, + serializedName: 'previousState', + type: { + name: 'Composite', + className: 'ContainerState' + } + }, + events: { + required: false, + serializedName: 'events', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ContainerEventElementType', + type: { + name: 'Composite', + className: 'ContainerEvent' + } + } + } + } + } + } + }; + } +} + +module.exports = ContainerInstanceView; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/containerLabel.js b/lib/services/serviceFabricMeshManagement/lib/models/containerLabel.js new file mode 100644 index 0000000000..c58a8e0983 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/containerLabel.js @@ -0,0 +1,60 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Describes a container label. + * + */ +class ContainerLabel { + /** + * Create a ContainerLabel. + * @member {string} name The name of the container label. + * @member {string} value The value of the container label. + */ + constructor() { + } + + /** + * Defines the metadata of ContainerLabel + * + * @returns {object} metadata of ContainerLabel + * + */ + mapper() { + return { + required: false, + serializedName: 'ContainerLabel', + type: { + name: 'Composite', + className: 'ContainerLabel', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + value: { + required: true, + serializedName: 'value', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ContainerLabel; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/containerLogs.js b/lib/services/serviceFabricMeshManagement/lib/models/containerLogs.js new file mode 100644 index 0000000000..68dbcd3e09 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/containerLogs.js @@ -0,0 +1,52 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The logs of the container. + * + */ +class ContainerLogs { + /** + * Create a ContainerLogs. + * @member {string} [content] content of the log. + */ + constructor() { + } + + /** + * Defines the metadata of ContainerLogs + * + * @returns {object} metadata of ContainerLogs + * + */ + mapper() { + return { + required: false, + serializedName: 'ContainerLogs', + type: { + name: 'Composite', + className: 'ContainerLogs', + modelProperties: { + content: { + required: false, + serializedName: 'content', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ContainerLogs; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/containerState.js b/lib/services/serviceFabricMeshManagement/lib/models/containerState.js new file mode 100644 index 0000000000..88c924ee34 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/containerState.js @@ -0,0 +1,84 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The container state. + * + */ +class ContainerState { + /** + * Create a ContainerState. + * @member {string} [state] The state of this container + * @member {date} [startTime] Date/time when the container state started. + * @member {string} [exitCode] The container exit code. + * @member {date} [finishTime] Date/time when the container state finished. + * @member {string} [detailStatus] Human-readable status of this state. + */ + constructor() { + } + + /** + * Defines the metadata of ContainerState + * + * @returns {object} metadata of ContainerState + * + */ + mapper() { + return { + required: false, + serializedName: 'ContainerState', + type: { + name: 'Composite', + className: 'ContainerState', + modelProperties: { + state: { + required: false, + serializedName: 'state', + type: { + name: 'String' + } + }, + startTime: { + required: false, + serializedName: 'startTime', + type: { + name: 'DateTime' + } + }, + exitCode: { + required: false, + serializedName: 'exitCode', + type: { + name: 'String' + } + }, + finishTime: { + required: false, + serializedName: 'finishTime', + type: { + name: 'DateTime' + } + }, + detailStatus: { + required: false, + serializedName: 'detailStatus', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ContainerState; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/containerVolume.js b/lib/services/serviceFabricMeshManagement/lib/models/containerVolume.js new file mode 100644 index 0000000000..e1d36eba43 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/containerVolume.js @@ -0,0 +1,70 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Describes how a volume is attached to a container. + * + */ +class ContainerVolume { + /** + * Create a ContainerVolume. + * @member {string} name Name of the volume. + * @member {boolean} [readOnly] The flag indicating whether the volume is + * read only. Default is 'false'. + * @member {string} destinationPath The path within the container at which + * the volume should be mounted. Only valid path characters are allowed. + */ + constructor() { + } + + /** + * Defines the metadata of ContainerVolume + * + * @returns {object} metadata of ContainerVolume + * + */ + mapper() { + return { + required: false, + serializedName: 'ContainerVolume', + type: { + name: 'Composite', + className: 'ContainerVolume', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + readOnly: { + required: false, + serializedName: 'readOnly', + type: { + name: 'Boolean' + } + }, + destinationPath: { + required: true, + serializedName: 'destinationPath', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ContainerVolume; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/diagnosticsDescription.js b/lib/services/serviceFabricMeshManagement/lib/models/diagnosticsDescription.js new file mode 100644 index 0000000000..843c60b3b0 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/diagnosticsDescription.js @@ -0,0 +1,92 @@ +/* + * 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'); + +/** + * Describes the diagnostics options available + * + */ +class DiagnosticsDescription { + /** + * Create a DiagnosticsDescription. + * @member {array} [sinks] List of supported sinks that can be referenced. + * @member {boolean} [enabled] Status of whether or not sinks are enabled. + * @member {array} [defaultSinkRefs] The sinks to be used if diagnostics is + * enabled. Sink choices can be overridden at the service and code package + * level. + */ + constructor() { + } + + /** + * Defines the metadata of DiagnosticsDescription + * + * @returns {object} metadata of DiagnosticsDescription + * + */ + mapper() { + return { + required: false, + serializedName: 'DiagnosticsDescription', + type: { + name: 'Composite', + className: 'DiagnosticsDescription', + modelProperties: { + sinks: { + required: false, + serializedName: 'sinks', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DiagnosticsSinkPropertiesElementType', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'kind', + clientName: 'kind' + }, + uberParent: 'DiagnosticsSinkProperties', + className: 'DiagnosticsSinkProperties' + } + } + } + }, + enabled: { + required: false, + serializedName: 'enabled', + type: { + name: 'Boolean' + } + }, + defaultSinkRefs: { + required: false, + serializedName: 'defaultSinkRefs', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = DiagnosticsDescription; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/diagnosticsRef.js b/lib/services/serviceFabricMeshManagement/lib/models/diagnosticsRef.js new file mode 100644 index 0000000000..9eecc2c1ad --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/diagnosticsRef.js @@ -0,0 +1,68 @@ +/* + * 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'; + +/** + * Reference to sinks in DiagnosticsDescription. + * + */ +class DiagnosticsRef { + /** + * Create a DiagnosticsRef. + * @member {boolean} [enabled] Status of whether or not sinks are enabled. + * @member {array} [sinkRefs] List of sinks to be used if enabled. References + * the list of sinks in DiagnosticsDescription. + */ + constructor() { + } + + /** + * Defines the metadata of DiagnosticsRef + * + * @returns {object} metadata of DiagnosticsRef + * + */ + mapper() { + return { + required: false, + serializedName: 'DiagnosticsRef', + type: { + name: 'Composite', + className: 'DiagnosticsRef', + modelProperties: { + enabled: { + required: false, + serializedName: 'enabled', + type: { + name: 'Boolean' + } + }, + sinkRefs: { + required: false, + serializedName: 'sinkRefs', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = DiagnosticsRef; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/diagnosticsSinkProperties.js b/lib/services/serviceFabricMeshManagement/lib/models/diagnosticsSinkProperties.js new file mode 100644 index 0000000000..ceeca226a5 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/diagnosticsSinkProperties.js @@ -0,0 +1,75 @@ +/* + * 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'; + +/** + * Properties of a DiagnosticsSink. + * + */ +class DiagnosticsSinkProperties { + /** + * Create a DiagnosticsSinkProperties. + * @member {string} [name] Name of the sink. This value is referenced by + * DiagnosticsReferenceDescription + * @member {string} [description] A description of the sink. + * @member {string} kind Polymorphic Discriminator + */ + constructor() { + } + + /** + * Defines the metadata of DiagnosticsSinkProperties + * + * @returns {object} metadata of DiagnosticsSinkProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'DiagnosticsSinkProperties', + type: { + name: 'Composite', + polymorphicDiscriminator: { + serializedName: 'kind', + clientName: 'kind' + }, + uberParent: 'DiagnosticsSinkProperties', + className: 'DiagnosticsSinkProperties', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'description', + type: { + name: 'String' + } + }, + kind: { + required: true, + serializedName: 'kind', + isPolymorphicDiscriminator: true, + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DiagnosticsSinkProperties; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/endpointProperties.js b/lib/services/serviceFabricMeshManagement/lib/models/endpointProperties.js new file mode 100644 index 0000000000..1e8205744b --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/endpointProperties.js @@ -0,0 +1,60 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Describes a container endpoint. + * + */ +class EndpointProperties { + /** + * Create a EndpointProperties. + * @member {string} name The name of the endpoint. + * @member {number} [port] Port used by the container. + */ + constructor() { + } + + /** + * Defines the metadata of EndpointProperties + * + * @returns {object} metadata of EndpointProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'EndpointProperties', + type: { + name: 'Composite', + className: 'EndpointProperties', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + port: { + required: false, + serializedName: 'port', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = EndpointProperties; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/environmentVariable.js b/lib/services/serviceFabricMeshManagement/lib/models/environmentVariable.js new file mode 100644 index 0000000000..7581ab7c63 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/environmentVariable.js @@ -0,0 +1,60 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Describes an environment variable for the container. + * + */ +class EnvironmentVariable { + /** + * Create a EnvironmentVariable. + * @member {string} [name] The name of the environment variable. + * @member {string} [value] The value of the environment variable. + */ + constructor() { + } + + /** + * Defines the metadata of EnvironmentVariable + * + * @returns {object} metadata of EnvironmentVariable + * + */ + mapper() { + return { + required: false, + serializedName: 'EnvironmentVariable', + type: { + name: 'Composite', + className: 'EnvironmentVariable', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + value: { + required: false, + serializedName: 'value', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = EnvironmentVariable; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/errorModel.js b/lib/services/serviceFabricMeshManagement/lib/models/errorModel.js new file mode 100644 index 0000000000..edfcafabc8 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/errorModel.js @@ -0,0 +1,60 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The error details. + * + */ +class ErrorModel { + /** + * Create a ErrorModel. + * @member {string} [code] The error code. + * @member {string} [message] The error message. + */ + constructor() { + } + + /** + * Defines the metadata of ErrorModel + * + * @returns {object} metadata of ErrorModel + * + */ + mapper() { + return { + required: false, + serializedName: 'ErrorModel', + type: { + name: 'Composite', + className: 'ErrorModel', + modelProperties: { + code: { + required: false, + serializedName: 'code', + type: { + name: 'String' + } + }, + message: { + required: false, + serializedName: 'message', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ErrorModel; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/imageRegistryCredential.js b/lib/services/serviceFabricMeshManagement/lib/models/imageRegistryCredential.js new file mode 100644 index 0000000000..f4d7693a3c --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/imageRegistryCredential.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'; + +/** + * Image registry credential. + * + */ +class ImageRegistryCredential { + /** + * Create a ImageRegistryCredential. + * @member {string} server Docker image registry server, without protocol + * such as `http` and `https`. + * @member {string} username The username for the private registry. + * @member {string} [password] The password for the private registry. + */ + constructor() { + } + + /** + * Defines the metadata of ImageRegistryCredential + * + * @returns {object} metadata of ImageRegistryCredential + * + */ + mapper() { + return { + required: false, + serializedName: 'ImageRegistryCredential', + type: { + name: 'Composite', + className: 'ImageRegistryCredential', + modelProperties: { + server: { + required: true, + serializedName: 'server', + type: { + name: 'String' + } + }, + username: { + required: true, + serializedName: 'username', + type: { + name: 'String' + } + }, + password: { + required: false, + serializedName: 'password', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ImageRegistryCredential; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/index.d.ts b/lib/services/serviceFabricMeshManagement/lib/models/index.d.ts new file mode 100644 index 0000000000..aa3276ec3a --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/index.d.ts @@ -0,0 +1,968 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import { BaseResource } from 'ms-rest-azure'; +import { CloudError } from 'ms-rest-azure'; +import * as moment from 'moment'; + +export { BaseResource } from 'ms-rest-azure'; +export { CloudError } from 'ms-rest-azure'; + + +/** + * @class + * Initializes a new instance of the Resource class. + * @constructor + * The resource model definition for Azure Resource Manager resource. + * + * @member {string} [id] Fully qualified identifier for the resource. Ex - + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + * @member {string} [name] The name of the resource + * @member {string} [type] The type of the resource. Ex- + * Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + * @member {string} [location] The geo-location where the resource lives + */ +export interface Resource extends BaseResource { + readonly id?: string; + readonly name?: string; + readonly type?: string; + location?: string; +} + +/** + * @class + * Initializes a new instance of the ProxyResource class. + * @constructor + * The resource model definition for Azure Resource Manager proxy resource. It + * will have everything other than required location and tags. + * + */ +export interface ProxyResource extends Resource { +} + +/** + * @class + * Initializes a new instance of the ManagedProxyResource class. + * @constructor + * The resource model definition for Azure Resource Manager proxy resource. It + * will have everything other than required location and tags. This proxy + * resource is explicitly created or updated by including it in the parent + * resource. + * + * @member {string} [id] Fully qualified identifier for the resource. Ex - + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + * @member {string} [name] The name of the resource + * @member {string} [type] The type of the resource. Ex- + * Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + */ +export interface ManagedProxyResource extends BaseResource { + readonly id?: string; + name?: string; + readonly type?: string; +} + +/** + * @class + * Initializes a new instance of the TrackedResource class. + * @constructor + * The resource model definition for Azure Resource Manager tracked top-level + * resource. + * + * @member {object} [tags] Resource tags. + */ +export interface TrackedResource extends Resource { + tags?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the ProvisionedResourceProperties class. + * @constructor + * Describes common properties of a provisioned resource. + * + * @member {string} [provisioningState] State of the resource. + */ +export interface ProvisionedResourceProperties { + readonly provisioningState?: string; +} + +/** + * @class + * Initializes a new instance of the Layer4IngressConfig class. + * @constructor + * Describes the layer4 configuration for public connectivity for this network. + * + * @member {string} [name] Layer4 ingress config name. + * @member {number} [publicPort] Specifies the public port at which the service + * endpoint below needs to be exposed. + * @member {string} [applicationName] The application name which contains the + * service to be exposed. + * @member {string} [serviceName] The service whose endpoint needs to be + * exposed at the public port. + * @member {string} [endpointName] The service endpoint that needs to be + * exposed. + */ +export interface Layer4IngressConfig { + name?: string; + publicPort?: number; + applicationName?: string; + serviceName?: string; + endpointName?: string; +} + +/** + * @class + * Initializes a new instance of the IngressConfig class. + * @constructor + * Describes public connectivity configuration for the network. + * + * @member {string} [qosLevel] The QoS tier for ingress. Possible values + * include: 'Bronze' + * @member {array} [layer4] Configuration for layer4 public connectivity for + * this network. + * @member {string} [publicIPAddress] The public IP address for reaching this + * network. + */ +export interface IngressConfig { + qosLevel?: string; + layer4?: Layer4IngressConfig[]; + readonly publicIPAddress?: string; +} + +/** + * @class + * Initializes a new instance of the NetworkResourceDescription class. + * @constructor + * This type describes a network resource. + * + * @member {string} [provisioningState] State of the resource. + * @member {string} [description] User readable description of the network. + * @member {string} addressPrefix the address prefix for this network. + * @member {object} [ingressConfig] Configuration for public connectivity for + * this network. + * @member {string} [ingressConfig.qosLevel] The QoS tier for ingress. Possible + * values include: 'Bronze' + * @member {array} [ingressConfig.layer4] Configuration for layer4 public + * connectivity for this network. + * @member {string} [ingressConfig.publicIPAddress] The public IP address for + * reaching this network. + */ +export interface NetworkResourceDescription extends TrackedResource { + readonly provisioningState?: string; + description?: string; + addressPrefix: string; + ingressConfig?: IngressConfig; +} + +/** + * @class + * Initializes a new instance of the NetworkProperties class. + * @constructor + * Describes a network. + * + * @member {string} [description] User readable description of the network. + * @member {string} addressPrefix the address prefix for this network. + * @member {object} [ingressConfig] Configuration for public connectivity for + * this network. + * @member {string} [ingressConfig.qosLevel] The QoS tier for ingress. Possible + * values include: 'Bronze' + * @member {array} [ingressConfig.layer4] Configuration for layer4 public + * connectivity for this network. + * @member {string} [ingressConfig.publicIPAddress] The public IP address for + * reaching this network. + */ +export interface NetworkProperties { + description?: string; + addressPrefix: string; + ingressConfig?: IngressConfig; +} + +/** + * @class + * Initializes a new instance of the VolumeProviderParametersAzureFile class. + * @constructor + * This type describes a volume provided by an Azure Files file share. + * + * @member {string} accountName Name of the Azure storage account for the File + * Share. + * @member {string} [accountKey] Access key of the Azure storage account for + * the File Share. + * @member {string} shareName Name of the Azure Files file share that provides + * storage for the volume. + */ +export interface VolumeProviderParametersAzureFile { + accountName: string; + accountKey?: string; + shareName: string; +} + +/** + * @class + * Initializes a new instance of the VolumeResourceDescription class. + * @constructor + * This type describes a volume resource. + * + * @member {string} [provisioningState] State of the resource. + * @member {string} [description] User readable description of the volume. + * @member {object} [azureFileParameters] This type describes a volume provided + * by an Azure Files file share. + * @member {string} [azureFileParameters.accountName] Name of the Azure storage + * account for the File Share. + * @member {string} [azureFileParameters.accountKey] Access key of the Azure + * storage account for the File Share. + * @member {string} [azureFileParameters.shareName] Name of the Azure Files + * file share that provides storage for the volume. + */ +export interface VolumeResourceDescription extends TrackedResource { + readonly provisioningState?: string; + description?: string; + azureFileParameters?: VolumeProviderParametersAzureFile; +} + +/** + * @class + * Initializes a new instance of the VolumeProperties class. + * @constructor + * This type describes properties of a volume resource. + * + * @member {string} [description] User readable description of the volume. + * @member {object} [azureFileParameters] This type describes a volume provided + * by an Azure Files file share. + * @member {string} [azureFileParameters.accountName] Name of the Azure storage + * account for the File Share. + * @member {string} [azureFileParameters.accountKey] Access key of the Azure + * storage account for the File Share. + * @member {string} [azureFileParameters.shareName] Name of the Azure Files + * file share that provides storage for the volume. + */ +export interface VolumeProperties { + description?: string; + azureFileParameters?: VolumeProviderParametersAzureFile; +} + +/** + * @class + * Initializes a new instance of the ServiceResourceDescription class. + * @constructor + * This type describes a service resource. + * + * @member {string} osType The Operating system type required by the code in + * service. + * . Possible values include: 'Linux', 'Windows' + * @member {array} codePackages Describes the set of code packages that forms + * the service. A code package describes the container and the properties for + * running it. All the code packages are started together on the same host and + * share the same context (network, process etc.). + * @member {array} [networkRefs] The names of the private networks that this + * service needs to be part of. + * @member {object} [diagnostics] Reference to sinks in DiagnosticsDescription. + * @member {boolean} [diagnostics.enabled] Status of whether or not sinks are + * enabled. + * @member {array} [diagnostics.sinkRefs] List of sinks to be used if enabled. + * References the list of sinks in DiagnosticsDescription. + * @member {string} [description] User readable description of the service. + * @member {number} [replicaCount] The number of replicas of the service to + * create. Defaults to 1 if not specified. + * @member {string} [healthState] The health state of a resource such as + * Application, Service, or Network. Possible values include: 'Invalid', 'Ok', + * 'Warning', 'Error', 'Unknown' + * @member {string} [status] Represents the status of the service. Possible + * values include: 'Unknown', 'Active', 'Upgrading', 'Deleting', 'Creating', + * 'Failed' + */ +export interface ServiceResourceDescription extends ManagedProxyResource { + osType: string; + codePackages: ContainerCodePackageProperties[]; + networkRefs?: NetworkRef[]; + diagnostics?: DiagnosticsRef; + description?: string; + replicaCount?: number; + healthState?: string; + readonly status?: string; +} + +/** + * @class + * Initializes a new instance of the DiagnosticsSinkProperties class. + * @constructor + * Properties of a DiagnosticsSink. + * + * @member {string} [name] Name of the sink. This value is referenced by + * DiagnosticsReferenceDescription + * @member {string} [description] A description of the sink. + * @member {string} kind Polymorphic Discriminator + */ +export interface DiagnosticsSinkProperties { + name?: string; + description?: string; + kind: string; +} + +/** + * @class + * Initializes a new instance of the DiagnosticsDescription class. + * @constructor + * Describes the diagnostics options available + * + * @member {array} [sinks] List of supported sinks that can be referenced. + * @member {boolean} [enabled] Status of whether or not sinks are enabled. + * @member {array} [defaultSinkRefs] The sinks to be used if diagnostics is + * enabled. Sink choices can be overridden at the service and code package + * level. + */ +export interface DiagnosticsDescription { + sinks?: DiagnosticsSinkProperties[]; + enabled?: boolean; + defaultSinkRefs?: string[]; +} + +/** + * @class + * Initializes a new instance of the ApplicationResourceDescription class. + * @constructor + * This type describes an application resource. + * + * @member {string} [provisioningState] State of the resource. + * @member {string} [description] User readable description of the application. + * @member {string} [debugParams] Internal use. + * @member {array} [services] describes the services in the application. + * @member {string} [healthState] Describes the health state of an application + * resource. Possible values include: 'Invalid', 'Ok', 'Warning', 'Error', + * 'Unknown' + * @member {string} [unhealthyEvaluation] When the application's health state + * is not 'Ok', this additional details from service fabric Health Manager for + * the user to know why the application is marked unhealthy. + * @member {string} [status] Status of the application resource. Possible + * values include: 'Invalid', 'Ready', 'Upgrading', 'Creating', 'Deleting', + * 'Failed' + * @member {string} [statusDetails] Gives additional information about the + * current status of the application deployment. + * @member {array} [serviceNames] Names of the services in the application. + * @member {object} [diagnostics] Describes the diagnostics definition and + * usage for an application resource. + * @member {array} [diagnostics.sinks] List of supported sinks that can be + * referenced. + * @member {boolean} [diagnostics.enabled] Status of whether or not sinks are + * enabled. + * @member {array} [diagnostics.defaultSinkRefs] The sinks to be used if + * diagnostics is enabled. Sink choices can be overridden at the service and + * code package level. + */ +export interface ApplicationResourceDescription extends TrackedResource { + readonly provisioningState?: string; + description?: string; + debugParams?: string; + services?: ServiceResourceDescription[]; + readonly healthState?: string; + readonly unhealthyEvaluation?: string; + readonly status?: string; + readonly statusDetails?: string; + readonly serviceNames?: string[]; + diagnostics?: DiagnosticsDescription; +} + +/** + * @class + * Initializes a new instance of the ApplicationProperties class. + * @constructor + * This type describes properties of an application resource. + * + * @member {string} [description] User readable description of the application. + * @member {string} [debugParams] Internal use. + * @member {array} [services] describes the services in the application. + * @member {string} [healthState] Describes the health state of an application + * resource. Possible values include: 'Invalid', 'Ok', 'Warning', 'Error', + * 'Unknown' + * @member {string} [unhealthyEvaluation] When the application's health state + * is not 'Ok', this additional details from service fabric Health Manager for + * the user to know why the application is marked unhealthy. + * @member {string} [status] Status of the application resource. Possible + * values include: 'Invalid', 'Ready', 'Upgrading', 'Creating', 'Deleting', + * 'Failed' + * @member {string} [statusDetails] Gives additional information about the + * current status of the application deployment. + * @member {array} [serviceNames] Names of the services in the application. + * @member {object} [diagnostics] Describes the diagnostics definition and + * usage for an application resource. + * @member {array} [diagnostics.sinks] List of supported sinks that can be + * referenced. + * @member {boolean} [diagnostics.enabled] Status of whether or not sinks are + * enabled. + * @member {array} [diagnostics.defaultSinkRefs] The sinks to be used if + * diagnostics is enabled. Sink choices can be overridden at the service and + * code package level. + */ +export interface ApplicationProperties { + description?: string; + debugParams?: string; + services?: ServiceResourceDescription[]; + readonly healthState?: string; + readonly unhealthyEvaluation?: string; + readonly status?: string; + readonly statusDetails?: string; + readonly serviceNames?: string[]; + diagnostics?: DiagnosticsDescription; +} + +/** + * @class + * Initializes a new instance of the ContainerState class. + * @constructor + * The container state. + * + * @member {string} [state] The state of this container + * @member {date} [startTime] Date/time when the container state started. + * @member {string} [exitCode] The container exit code. + * @member {date} [finishTime] Date/time when the container state finished. + * @member {string} [detailStatus] Human-readable status of this state. + */ +export interface ContainerState { + state?: string; + startTime?: Date; + exitCode?: string; + finishTime?: Date; + detailStatus?: string; +} + +/** + * @class + * Initializes a new instance of the ContainerEvent class. + * @constructor + * A container event. + * + * @member {string} [name] The name of the container event. + * @member {number} [count] The count of the event. + * @member {string} [firstTimestamp] Date/time of the first event. + * @member {string} [lastTimestamp] Date/time of the last event. + * @member {string} [message] The event message + * @member {string} [type] The event type. + */ +export interface ContainerEvent { + name?: string; + count?: number; + firstTimestamp?: string; + lastTimestamp?: string; + message?: string; + type?: string; +} + +/** + * @class + * Initializes a new instance of the ContainerInstanceView class. + * @constructor + * Runtime information of a container instance. + * + * @member {number} [restartCount] The number of times the container has been + * restarted. + * @member {object} [currentState] Current container instance state. + * @member {string} [currentState.state] The state of this container + * @member {date} [currentState.startTime] Date/time when the container state + * started. + * @member {string} [currentState.exitCode] The container exit code. + * @member {date} [currentState.finishTime] Date/time when the container state + * finished. + * @member {string} [currentState.detailStatus] Human-readable status of this + * state. + * @member {object} [previousState] Previous container instance state. + * @member {string} [previousState.state] The state of this container + * @member {date} [previousState.startTime] Date/time when the container state + * started. + * @member {string} [previousState.exitCode] The container exit code. + * @member {date} [previousState.finishTime] Date/time when the container state + * finished. + * @member {string} [previousState.detailStatus] Human-readable status of this + * state. + * @member {array} [events] The events of this container instance. + */ +export interface ContainerInstanceView { + restartCount?: number; + currentState?: ContainerState; + previousState?: ContainerState; + events?: ContainerEvent[]; +} + +/** + * @class + * Initializes a new instance of the ContainerLabel class. + * @constructor + * Describes a container label. + * + * @member {string} name The name of the container label. + * @member {string} value The value of the container label. + */ +export interface ContainerLabel { + name: string; + value: string; +} + +/** + * @class + * Initializes a new instance of the ContainerLogs class. + * @constructor + * The logs of the container. + * + * @member {string} [content] content of the log. + */ +export interface ContainerLogs { + content?: string; +} + +/** + * @class + * Initializes a new instance of the ImageRegistryCredential class. + * @constructor + * Image registry credential. + * + * @member {string} server Docker image registry server, without protocol such + * as `http` and `https`. + * @member {string} username The username for the private registry. + * @member {string} [password] The password for the private registry. + */ +export interface ImageRegistryCredential { + server: string; + username: string; + password?: string; +} + +/** + * @class + * Initializes a new instance of the ResourceLimits class. + * @constructor + * This type describes the resource limits for a given container. It describes + * the most amount of resources a container is allowed to use before being + * restarted. + * + * @member {number} [memoryInGB] The memory limit in GB. + * @member {number} [cpu] CPU limits in cores. At present, only full cores are + * supported. + */ +export interface ResourceLimits { + memoryInGB?: number; + cpu?: number; +} + +/** + * @class + * Initializes a new instance of the ResourceRequests class. + * @constructor + * This type describes the requested resources for a given container. It + * describes the least amount of resources required for the container. A + * container can consume more than requested resources up to the specified + * limits before being restarted. Currently, the requested resources are + * treated as limits. + * + * + * @member {number} memoryInGB The memory request in GB for this container. + * @member {number} cpu Requested number of CPU cores. At present, only full + * cores are supported. + */ +export interface ResourceRequests { + memoryInGB: number; + cpu: number; +} + +/** + * @class + * Initializes a new instance of the ResourceRequirements class. + * @constructor + * This type describes the resource requirements for a container or a service. + * + * @member {object} requests Describes the requested resources for a given + * container. + * @member {number} [requests.memoryInGB] The memory request in GB for this + * container. + * @member {number} [requests.cpu] Requested number of CPU cores. At present, + * only full cores are supported. + * @member {object} [limits] Describes the maximum limits on the resources for + * a given container. + * @member {number} [limits.memoryInGB] The memory limit in GB. + * @member {number} [limits.cpu] CPU limits in cores. At present, only full + * cores are supported. + */ +export interface ResourceRequirements { + requests: ResourceRequests; + limits?: ResourceLimits; +} + +/** + * @class + * Initializes a new instance of the AvailableOperationDisplay class. + * @constructor + * An operation available at the listed Azure resource provider. + * + * @member {string} [provider] Name of the operation provider. + * @member {string} [resource] Name of the resource on which the operation is + * available. + * @member {string} [operation] Name of the available operation. + * @member {string} [description] Description of the available operation. + */ +export interface AvailableOperationDisplay { + provider?: string; + resource?: string; + operation?: string; + description?: string; +} + +/** + * @class + * Initializes a new instance of the OperationResult class. + * @constructor + * List of operations available at the listed Azure resource provider. + * + * @member {string} [name] The name of the operation. + * @member {object} [display] The object that represents the operation. + * @member {string} [display.provider] Name of the operation provider. + * @member {string} [display.resource] Name of the resource on which the + * operation is available. + * @member {string} [display.operation] Name of the available operation. + * @member {string} [display.description] Description of the available + * operation. + * @member {string} [origin] Origin result + * @member {string} [nextLink] The URL to use for getting the next set of + * results. + */ +export interface OperationResult { + name?: string; + display?: AvailableOperationDisplay; + origin?: string; + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the ErrorModel class. + * @constructor + * The error details. + * + * @member {string} [code] The error code. + * @member {string} [message] The error message. + */ +export interface ErrorModel { + code?: string; + message?: string; +} + +/** + * @class + * Initializes a new instance of the EnvironmentVariable class. + * @constructor + * Describes an environment variable for the container. + * + * @member {string} [name] The name of the environment variable. + * @member {string} [value] The value of the environment variable. + */ +export interface EnvironmentVariable { + name?: string; + value?: string; +} + +/** + * @class + * Initializes a new instance of the Setting class. + * @constructor + * Describes a setting for the container. + * + * @member {string} [name] The name of the setting. + * @member {string} [value] The value of the setting. + */ +export interface Setting { + name?: string; + value?: string; +} + +/** + * @class + * Initializes a new instance of the EndpointProperties class. + * @constructor + * Describes a container endpoint. + * + * @member {string} name The name of the endpoint. + * @member {number} [port] Port used by the container. + */ +export interface EndpointProperties { + name: string; + port?: number; +} + +/** + * @class + * Initializes a new instance of the ContainerVolume class. + * @constructor + * Describes how a volume is attached to a container. + * + * @member {string} name Name of the volume. + * @member {boolean} [readOnly] The flag indicating whether the volume is read + * only. Default is 'false'. + * @member {string} destinationPath The path within the container at which the + * volume should be mounted. Only valid path characters are allowed. + */ +export interface ContainerVolume { + name: string; + readOnly?: boolean; + destinationPath: string; +} + +/** + * @class + * Initializes a new instance of the DiagnosticsRef class. + * @constructor + * Reference to sinks in DiagnosticsDescription. + * + * @member {boolean} [enabled] Status of whether or not sinks are enabled. + * @member {array} [sinkRefs] List of sinks to be used if enabled. References + * the list of sinks in DiagnosticsDescription. + */ +export interface DiagnosticsRef { + enabled?: boolean; + sinkRefs?: string[]; +} + +/** + * @class + * Initializes a new instance of the ContainerCodePackageProperties class. + * @constructor + * Describes a container and its runtime properties. + * + * @member {string} name The name of the code package. + * @member {string} image The Container image to use. + * @member {object} [imageRegistryCredential] Image registry credential. + * @member {string} [imageRegistryCredential.server] Docker image registry + * server, without protocol such as `http` and `https`. + * @member {string} [imageRegistryCredential.username] The username for the + * private registry. + * @member {string} [imageRegistryCredential.password] The password for the + * private registry. + * @member {string} [entrypoint] Override for the default entry point in the + * container. + * @member {array} [commands] Command array to execute within the container in + * exec form. + * @member {array} [environmentVariables] The environment variables to set in + * this container + * @member {array} [settings] The settings to set in this container. The + * setting file path can be fetched from environment variable + * "Fabric_SettingPath". The path for Windows container is "C:\\secrets". The + * path for Linux container is "/var/secrets". + * @member {array} [labels] The labels to set in this container. + * @member {array} [endpoints] The endpoints exposed by this container. + * @member {object} resources This type describes the resource requirements for + * a container or a service. + * @member {object} [resources.requests] Describes the requested resources for + * a given container. + * @member {number} [resources.requests.memoryInGB] The memory request in GB + * for this container. + * @member {number} [resources.requests.cpu] Requested number of CPU cores. At + * present, only full cores are supported. + * @member {object} [resources.limits] Describes the maximum limits on the + * resources for a given container. + * @member {number} [resources.limits.memoryInGB] The memory limit in GB. + * @member {number} [resources.limits.cpu] CPU limits in cores. At present, + * only full cores are supported. + * @member {array} [volumeRefs] The volumes to be attached to the container. + * @member {object} [instanceView] Runtime information of a container instance. + * @member {number} [instanceView.restartCount] The number of times the + * container has been restarted. + * @member {object} [instanceView.currentState] Current container instance + * state. + * @member {string} [instanceView.currentState.state] The state of this + * container + * @member {date} [instanceView.currentState.startTime] Date/time when the + * container state started. + * @member {string} [instanceView.currentState.exitCode] The container exit + * code. + * @member {date} [instanceView.currentState.finishTime] Date/time when the + * container state finished. + * @member {string} [instanceView.currentState.detailStatus] Human-readable + * status of this state. + * @member {object} [instanceView.previousState] Previous container instance + * state. + * @member {string} [instanceView.previousState.state] The state of this + * container + * @member {date} [instanceView.previousState.startTime] Date/time when the + * container state started. + * @member {string} [instanceView.previousState.exitCode] The container exit + * code. + * @member {date} [instanceView.previousState.finishTime] Date/time when the + * container state finished. + * @member {string} [instanceView.previousState.detailStatus] Human-readable + * status of this state. + * @member {array} [instanceView.events] The events of this container instance. + * @member {object} [diagnostics] Reference to sinks in DiagnosticsDescription. + * @member {boolean} [diagnostics.enabled] Status of whether or not sinks are + * enabled. + * @member {array} [diagnostics.sinkRefs] List of sinks to be used if enabled. + * References the list of sinks in DiagnosticsDescription. + */ +export interface ContainerCodePackageProperties { + name: string; + image: string; + imageRegistryCredential?: ImageRegistryCredential; + entrypoint?: string; + commands?: string[]; + environmentVariables?: EnvironmentVariable[]; + settings?: Setting[]; + labels?: ContainerLabel[]; + endpoints?: EndpointProperties[]; + resources: ResourceRequirements; + volumeRefs?: ContainerVolume[]; + readonly instanceView?: ContainerInstanceView; + diagnostics?: DiagnosticsRef; +} + +/** + * @class + * Initializes a new instance of the ServiceReplicaProperties class. + * @constructor + * Describes the properties of a service replica. + * + * @member {string} osType The Operating system type required by the code in + * service. + * . Possible values include: 'Linux', 'Windows' + * @member {array} codePackages Describes the set of code packages that forms + * the service. A code package describes the container and the properties for + * running it. All the code packages are started together on the same host and + * share the same context (network, process etc.). + * @member {array} [networkRefs] The names of the private networks that this + * service needs to be part of. + * @member {object} [diagnostics] Reference to sinks in DiagnosticsDescription. + * @member {boolean} [diagnostics.enabled] Status of whether or not sinks are + * enabled. + * @member {array} [diagnostics.sinkRefs] List of sinks to be used if enabled. + * References the list of sinks in DiagnosticsDescription. + */ +export interface ServiceReplicaProperties { + osType: string; + codePackages: ContainerCodePackageProperties[]; + networkRefs?: NetworkRef[]; + diagnostics?: DiagnosticsRef; +} + +/** + * @class + * Initializes a new instance of the ServiceReplicaDescription class. + * @constructor + * This type describes a replica of a service resource. + * + * @member {string} [replicaName] Name of the replica. + */ +export interface ServiceReplicaDescription extends ServiceReplicaProperties { + replicaName?: string; +} + +/** + * @class + * Initializes a new instance of the NetworkRef class. + * @constructor + * Describes a network reference in a service. + * + * @member {string} [name] Name of the network. + */ +export interface NetworkRef { + name?: string; +} + +/** + * @class + * Initializes a new instance of the AzureInternalMonitoringPipelineSinkDescription class. + * @constructor + * Diagnostics settings for Geneva. + * + * @member {string} [accountName] Azure Internal monitoring pipeline account. + * @member {string} [namespace] Azure Internal monitoring pipeline account + * namespace. + * @member {string} [maConfigUrl] Azure Internal monitoring agent + * configuration. + * @member {object} [fluentdConfigUrl] Azure Internal monitoring agent fluentd + * configuration. + * @member {string} [autoKeyConfigUrl] Azure Internal monitoring pipeline + * autokey associated with the certificate. + */ +export interface AzureInternalMonitoringPipelineSinkDescription extends DiagnosticsSinkProperties { + accountName?: string; + namespace?: string; + maConfigUrl?: string; + fluentdConfigUrl?: any; + autoKeyConfigUrl?: string; +} + + +/** + * @class + * Initializes a new instance of the ApplicationResourceDescriptionList class. + * @constructor + * A pageable list of application resources. + * + * @member {string} [nextLink] URI to fetch the next page of the list. + */ +export interface ApplicationResourceDescriptionList extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the ServiceList class. + * @constructor + * A pageable list of all services in an application. + * + * + * @member {string} [nextLink] URI to fetch the next page of the list. + */ +export interface ServiceList extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the ServiceReplicaList class. + * @constructor + * A pageable list of replicas of a service resource. + * + * + * @member {string} [nextLink] URI to fetch the next page of the list. + */ +export interface ServiceReplicaList extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the OperationListResult class. + * @constructor + * Describes the result of the request to list Service Fabric operations. + * + * @member {string} [nextLink] URL to get the next set of operation list + * results if there are any. + */ +export interface OperationListResult extends Array { + readonly nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the NetworkResourceDescriptionList class. + * @constructor + * A pageable list of network resources. + * + * @member {string} [nextLink] URI to fetch the next page of the list. + */ +export interface NetworkResourceDescriptionList extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the VolumeResourceDescriptionList class. + * @constructor + * A pageable list of volume resources. + * + * @member {string} [nextLink] URI to fetch the next page of the list. + */ +export interface VolumeResourceDescriptionList extends Array { + nextLink?: string; +} diff --git a/lib/services/serviceFabricMeshManagement/lib/models/index.js b/lib/services/serviceFabricMeshManagement/lib/models/index.js new file mode 100644 index 0000000000..4f24b4e0aa --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/index.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. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +var msRestAzure = require('ms-rest-azure'); + +exports.BaseResource = msRestAzure.BaseResource; +exports.CloudError = msRestAzure.CloudError; +exports.Resource = require('./resource'); +exports.ProxyResource = require('./proxyResource'); +exports.ManagedProxyResource = require('./managedProxyResource'); +exports.TrackedResource = require('./trackedResource'); +exports.ProvisionedResourceProperties = require('./provisionedResourceProperties'); +exports.Layer4IngressConfig = require('./layer4IngressConfig'); +exports.IngressConfig = require('./ingressConfig'); +exports.NetworkResourceDescription = require('./networkResourceDescription'); +exports.NetworkProperties = require('./networkProperties'); +exports.VolumeProviderParametersAzureFile = require('./volumeProviderParametersAzureFile'); +exports.VolumeResourceDescription = require('./volumeResourceDescription'); +exports.VolumeProperties = require('./volumeProperties'); +exports.ServiceResourceDescription = require('./serviceResourceDescription'); +exports.DiagnosticsSinkProperties = require('./diagnosticsSinkProperties'); +exports.DiagnosticsDescription = require('./diagnosticsDescription'); +exports.ApplicationResourceDescription = require('./applicationResourceDescription'); +exports.ApplicationProperties = require('./applicationProperties'); +exports.ContainerState = require('./containerState'); +exports.ContainerEvent = require('./containerEvent'); +exports.ContainerInstanceView = require('./containerInstanceView'); +exports.ContainerLabel = require('./containerLabel'); +exports.ContainerLogs = require('./containerLogs'); +exports.ImageRegistryCredential = require('./imageRegistryCredential'); +exports.ResourceLimits = require('./resourceLimits'); +exports.ResourceRequests = require('./resourceRequests'); +exports.ResourceRequirements = require('./resourceRequirements'); +exports.AvailableOperationDisplay = require('./availableOperationDisplay'); +exports.OperationResult = require('./operationResult'); +exports.ErrorModel = require('./errorModel'); +exports.EnvironmentVariable = require('./environmentVariable'); +exports.Setting = require('./setting'); +exports.EndpointProperties = require('./endpointProperties'); +exports.ContainerVolume = require('./containerVolume'); +exports.DiagnosticsRef = require('./diagnosticsRef'); +exports.ContainerCodePackageProperties = require('./containerCodePackageProperties'); +exports.ServiceReplicaProperties = require('./serviceReplicaProperties'); +exports.ServiceReplicaDescription = require('./serviceReplicaDescription'); +exports.NetworkRef = require('./networkRef'); +exports.AzureInternalMonitoringPipelineSinkDescription = require('./azureInternalMonitoringPipelineSinkDescription'); +exports.ApplicationResourceDescriptionList = require('./applicationResourceDescriptionList'); +exports.ServiceList = require('./serviceList'); +exports.ServiceReplicaList = require('./serviceReplicaList'); +exports.OperationListResult = require('./operationListResult'); +exports.NetworkResourceDescriptionList = require('./networkResourceDescriptionList'); +exports.VolumeResourceDescriptionList = require('./volumeResourceDescriptionList'); +exports.discriminators = { + 'DiagnosticsSinkProperties' : exports.DiagnosticsSinkProperties, + 'DiagnosticsSinkProperties.AzureInternalMonitoringPipeline' : exports.AzureInternalMonitoringPipelineSinkDescription +}; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/ingressConfig.js b/lib/services/serviceFabricMeshManagement/lib/models/ingressConfig.js new file mode 100644 index 0000000000..1d8fba7491 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/ingressConfig.js @@ -0,0 +1,82 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Describes public connectivity configuration for the network. + * + */ +class IngressConfig { + /** + * Create a IngressConfig. + * @member {string} [qosLevel] The QoS tier for ingress. Possible values + * include: 'Bronze' + * @member {array} [layer4] Configuration for layer4 public connectivity for + * this network. + * @member {string} [publicIPAddress] The public IP address for reaching this + * network. + */ + constructor() { + } + + /** + * Defines the metadata of IngressConfig + * + * @returns {object} metadata of IngressConfig + * + */ + mapper() { + return { + required: false, + serializedName: 'IngressConfig', + type: { + name: 'Composite', + className: 'IngressConfig', + modelProperties: { + qosLevel: { + required: false, + serializedName: 'qosLevel', + type: { + name: 'String' + } + }, + layer4: { + required: false, + serializedName: 'layer4', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'Layer4IngressConfigElementType', + type: { + name: 'Composite', + className: 'Layer4IngressConfig' + } + } + } + }, + publicIPAddress: { + required: false, + readOnly: true, + serializedName: 'publicIPAddress', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = IngressConfig; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/layer4IngressConfig.js b/lib/services/serviceFabricMeshManagement/lib/models/layer4IngressConfig.js new file mode 100644 index 0000000000..3ae4317de8 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/layer4IngressConfig.js @@ -0,0 +1,88 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Describes the layer4 configuration for public connectivity for this network. + * + */ +class Layer4IngressConfig { + /** + * Create a Layer4IngressConfig. + * @member {string} [name] Layer4 ingress config name. + * @member {number} [publicPort] Specifies the public port at which the + * service endpoint below needs to be exposed. + * @member {string} [applicationName] The application name which contains the + * service to be exposed. + * @member {string} [serviceName] The service whose endpoint needs to be + * exposed at the public port. + * @member {string} [endpointName] The service endpoint that needs to be + * exposed. + */ + constructor() { + } + + /** + * Defines the metadata of Layer4IngressConfig + * + * @returns {object} metadata of Layer4IngressConfig + * + */ + mapper() { + return { + required: false, + serializedName: 'Layer4IngressConfig', + type: { + name: 'Composite', + className: 'Layer4IngressConfig', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + publicPort: { + required: false, + serializedName: 'publicPort', + type: { + name: 'Number' + } + }, + applicationName: { + required: false, + serializedName: 'applicationName', + type: { + name: 'String' + } + }, + serviceName: { + required: false, + serializedName: 'serviceName', + type: { + name: 'String' + } + }, + endpointName: { + required: false, + serializedName: 'endpointName', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Layer4IngressConfig; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/managedProxyResource.js b/lib/services/serviceFabricMeshManagement/lib/models/managedProxyResource.js new file mode 100644 index 0000000000..e56381258e --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/managedProxyResource.js @@ -0,0 +1,79 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The resource model definition for Azure Resource Manager proxy resource. It + * will have everything other than required location and tags. This proxy + * resource is explicitly created or updated by including it in the parent + * resource. + * + * @extends models['BaseResource'] + */ +class ManagedProxyResource extends models['BaseResource'] { + /** + * Create a ManagedProxyResource. + * @member {string} [id] Fully qualified identifier for the resource. Ex - + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + * @member {string} [name] The name of the resource + * @member {string} [type] The type of the resource. Ex- + * Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ManagedProxyResource + * + * @returns {object} metadata of ManagedProxyResource + * + */ + mapper() { + return { + required: false, + serializedName: 'ManagedProxyResource', + type: { + name: 'Composite', + className: 'ManagedProxyResource', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ManagedProxyResource; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/networkProperties.js b/lib/services/serviceFabricMeshManagement/lib/models/networkProperties.js new file mode 100644 index 0000000000..d29bbb7050 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/networkProperties.js @@ -0,0 +1,78 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Describes a network. + * + */ +class NetworkProperties { + /** + * Create a NetworkProperties. + * @member {string} [description] User readable description of the network. + * @member {string} addressPrefix the address prefix for this network. + * @member {object} [ingressConfig] Configuration for public connectivity for + * this network. + * @member {string} [ingressConfig.qosLevel] The QoS tier for ingress. + * Possible values include: 'Bronze' + * @member {array} [ingressConfig.layer4] Configuration for layer4 public + * connectivity for this network. + * @member {string} [ingressConfig.publicIPAddress] The public IP address for + * reaching this network. + */ + constructor() { + } + + /** + * Defines the metadata of NetworkProperties + * + * @returns {object} metadata of NetworkProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'NetworkProperties', + type: { + name: 'Composite', + className: 'NetworkProperties', + modelProperties: { + description: { + required: false, + serializedName: 'description', + type: { + name: 'String' + } + }, + addressPrefix: { + required: true, + serializedName: 'addressPrefix', + type: { + name: 'String' + } + }, + ingressConfig: { + required: false, + serializedName: 'ingressConfig', + type: { + name: 'Composite', + className: 'IngressConfig' + } + } + } + } + }; + } +} + +module.exports = NetworkProperties; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/networkRef.js b/lib/services/serviceFabricMeshManagement/lib/models/networkRef.js new file mode 100644 index 0000000000..3294cee7c4 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/networkRef.js @@ -0,0 +1,52 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Describes a network reference in a service. + * + */ +class NetworkRef { + /** + * Create a NetworkRef. + * @member {string} [name] Name of the network. + */ + constructor() { + } + + /** + * Defines the metadata of NetworkRef + * + * @returns {object} metadata of NetworkRef + * + */ + mapper() { + return { + required: false, + serializedName: 'NetworkRef', + type: { + name: 'Composite', + className: 'NetworkRef', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = NetworkRef; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/networkResourceDescription.js b/lib/services/serviceFabricMeshManagement/lib/models/networkResourceDescription.js new file mode 100644 index 0000000000..2e50f60611 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/networkResourceDescription.js @@ -0,0 +1,134 @@ +/* + * 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'); + +/** + * This type describes a network resource. + * + * @extends models['TrackedResource'] + */ +class NetworkResourceDescription extends models['TrackedResource'] { + /** + * Create a NetworkResourceDescription. + * @member {string} [provisioningState] State of the resource. + * @member {string} [description] User readable description of the network. + * @member {string} addressPrefix the address prefix for this network. + * @member {object} [ingressConfig] Configuration for public connectivity for + * this network. + * @member {string} [ingressConfig.qosLevel] The QoS tier for ingress. + * Possible values include: 'Bronze' + * @member {array} [ingressConfig.layer4] Configuration for layer4 public + * connectivity for this network. + * @member {string} [ingressConfig.publicIPAddress] The public IP address for + * reaching this network. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of NetworkResourceDescription + * + * @returns {object} metadata of NetworkResourceDescription + * + */ + mapper() { + return { + required: false, + serializedName: 'NetworkResourceDescription', + type: { + name: 'Composite', + className: 'NetworkResourceDescription', + 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' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + addressPrefix: { + required: true, + serializedName: 'properties.addressPrefix', + type: { + name: 'String' + } + }, + ingressConfig: { + required: false, + serializedName: 'properties.ingressConfig', + type: { + name: 'Composite', + className: 'IngressConfig' + } + } + } + } + }; + } +} + +module.exports = NetworkResourceDescription; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/networkResourceDescriptionList.js b/lib/services/serviceFabricMeshManagement/lib/models/networkResourceDescriptionList.js new file mode 100644 index 0000000000..f3d0898c65 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/networkResourceDescriptionList.js @@ -0,0 +1,67 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * A pageable list of network resources. + */ +class NetworkResourceDescriptionList extends Array { + /** + * Create a NetworkResourceDescriptionList. + * @member {string} [nextLink] URI to fetch the next page of the list. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of NetworkResourceDescriptionList + * + * @returns {object} metadata of NetworkResourceDescriptionList + * + */ + mapper() { + return { + required: false, + serializedName: 'NetworkResourceDescriptionList', + type: { + name: 'Composite', + className: 'NetworkResourceDescriptionList', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'NetworkResourceDescriptionElementType', + type: { + name: 'Composite', + className: 'NetworkResourceDescription' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = NetworkResourceDescriptionList; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/operationListResult.js b/lib/services/serviceFabricMeshManagement/lib/models/operationListResult.js new file mode 100644 index 0000000000..38f45dd3af --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/operationListResult.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'; + +/** + * Describes the result of the request to list Service Fabric operations. + */ +class OperationListResult extends Array { + /** + * Create a OperationListResult. + * @member {string} [nextLink] URL to get the next set of operation list + * results if there are any. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of OperationListResult + * + * @returns {object} metadata of OperationListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationListResult', + type: { + name: 'Composite', + className: 'OperationListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'OperationResultElementType', + type: { + name: 'Composite', + className: 'OperationResult' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OperationListResult; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/operationResult.js b/lib/services/serviceFabricMeshManagement/lib/models/operationResult.js new file mode 100644 index 0000000000..f83ce1c632 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/operationResult.js @@ -0,0 +1,86 @@ +/* + * 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'); + +/** + * List of operations available at the listed Azure resource provider. + * + */ +class OperationResult { + /** + * Create a OperationResult. + * @member {string} [name] The name of the operation. + * @member {object} [display] The object that represents the operation. + * @member {string} [display.provider] Name of the operation provider. + * @member {string} [display.resource] Name of the resource on which the + * operation is available. + * @member {string} [display.operation] Name of the available operation. + * @member {string} [display.description] Description of the available + * operation. + * @member {string} [origin] Origin result + * @member {string} [nextLink] The URL to use for getting the next set of + * results. + */ + constructor() { + } + + /** + * Defines the metadata of OperationResult + * + * @returns {object} metadata of OperationResult + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationResult', + type: { + name: 'Composite', + className: 'OperationResult', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + display: { + required: false, + serializedName: 'display', + type: { + name: 'Composite', + className: 'AvailableOperationDisplay' + } + }, + origin: { + required: false, + serializedName: 'origin', + type: { + name: 'String' + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OperationResult; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/provisionedResourceProperties.js b/lib/services/serviceFabricMeshManagement/lib/models/provisionedResourceProperties.js new file mode 100644 index 0000000000..b03015e985 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/provisionedResourceProperties.js @@ -0,0 +1,53 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Describes common properties of a provisioned resource. + * + */ +class ProvisionedResourceProperties { + /** + * Create a ProvisionedResourceProperties. + * @member {string} [provisioningState] State of the resource. + */ + constructor() { + } + + /** + * Defines the metadata of ProvisionedResourceProperties + * + * @returns {object} metadata of ProvisionedResourceProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'ProvisionedResourceProperties', + type: { + name: 'Composite', + className: 'ProvisionedResourceProperties', + modelProperties: { + provisioningState: { + required: false, + readOnly: true, + serializedName: 'provisioningState', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ProvisionedResourceProperties; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/proxyResource.js b/lib/services/serviceFabricMeshManagement/lib/models/proxyResource.js new file mode 100644 index 0000000000..9be7a2b299 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/proxyResource.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'); + +/** + * The resource model definition for Azure Resource Manager proxy resource. It + * will have everything other than required location and tags. + * + * @extends models['Resource'] + */ +class ProxyResource extends models['Resource'] { + /** + * Create a ProxyResource. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ProxyResource + * + * @returns {object} metadata of ProxyResource + * + */ + mapper() { + return { + required: false, + serializedName: 'ProxyResource', + type: { + name: 'Composite', + className: 'ProxyResource', + 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' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ProxyResource; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/resource.js b/lib/services/serviceFabricMeshManagement/lib/models/resource.js new file mode 100644 index 0000000000..d72ebd4406 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/resource.js @@ -0,0 +1,85 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The resource model definition for Azure Resource Manager resource. + * + * @extends models['BaseResource'] + */ +class Resource extends models['BaseResource'] { + /** + * Create a Resource. + * @member {string} [id] Fully qualified identifier for the resource. Ex - + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + * @member {string} [name] The name of the resource + * @member {string} [type] The type of the resource. Ex- + * Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + * @member {string} [location] The geo-location where the resource lives + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Resource + * + * @returns {object} metadata of Resource + * + */ + mapper() { + return { + required: false, + serializedName: 'Resource', + type: { + name: 'Composite', + className: 'Resource', + 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' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Resource; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/resourceLimits.js b/lib/services/serviceFabricMeshManagement/lib/models/resourceLimits.js new file mode 100644 index 0000000000..3fffe2627e --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/resourceLimits.js @@ -0,0 +1,63 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * This type describes the resource limits for a given container. It describes + * the most amount of resources a container is allowed to use before being + * restarted. + * + */ +class ResourceLimits { + /** + * Create a ResourceLimits. + * @member {number} [memoryInGB] The memory limit in GB. + * @member {number} [cpu] CPU limits in cores. At present, only full cores + * are supported. + */ + constructor() { + } + + /** + * Defines the metadata of ResourceLimits + * + * @returns {object} metadata of ResourceLimits + * + */ + mapper() { + return { + required: false, + serializedName: 'ResourceLimits', + type: { + name: 'Composite', + className: 'ResourceLimits', + modelProperties: { + memoryInGB: { + required: false, + serializedName: 'memoryInGB', + type: { + name: 'Number' + } + }, + cpu: { + required: false, + serializedName: 'cpu', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = ResourceLimits; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/resourceRequests.js b/lib/services/serviceFabricMeshManagement/lib/models/resourceRequests.js new file mode 100644 index 0000000000..d72c2af315 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/resourceRequests.js @@ -0,0 +1,66 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * This type describes the requested resources for a given container. It + * describes the least amount of resources required for the container. A + * container can consume more than requested resources up to the specified + * limits before being restarted. Currently, the requested resources are + * treated as limits. + * + * + */ +class ResourceRequests { + /** + * Create a ResourceRequests. + * @member {number} memoryInGB The memory request in GB for this container. + * @member {number} cpu Requested number of CPU cores. At present, only full + * cores are supported. + */ + constructor() { + } + + /** + * Defines the metadata of ResourceRequests + * + * @returns {object} metadata of ResourceRequests + * + */ + mapper() { + return { + required: false, + serializedName: 'ResourceRequests', + type: { + name: 'Composite', + className: 'ResourceRequests', + modelProperties: { + memoryInGB: { + required: true, + serializedName: 'memoryInGB', + type: { + name: 'Number' + } + }, + cpu: { + required: true, + serializedName: 'cpu', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = ResourceRequests; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/resourceRequirements.js b/lib/services/serviceFabricMeshManagement/lib/models/resourceRequirements.js new file mode 100644 index 0000000000..786fcc86d7 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/resourceRequirements.js @@ -0,0 +1,73 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * This type describes the resource requirements for a container or a service. + * + */ +class ResourceRequirements { + /** + * Create a ResourceRequirements. + * @member {object} requests Describes the requested resources for a given + * container. + * @member {number} [requests.memoryInGB] The memory request in GB for this + * container. + * @member {number} [requests.cpu] Requested number of CPU cores. At present, + * only full cores are supported. + * @member {object} [limits] Describes the maximum limits on the resources + * for a given container. + * @member {number} [limits.memoryInGB] The memory limit in GB. + * @member {number} [limits.cpu] CPU limits in cores. At present, only full + * cores are supported. + */ + constructor() { + } + + /** + * Defines the metadata of ResourceRequirements + * + * @returns {object} metadata of ResourceRequirements + * + */ + mapper() { + return { + required: false, + serializedName: 'ResourceRequirements', + type: { + name: 'Composite', + className: 'ResourceRequirements', + modelProperties: { + requests: { + required: true, + serializedName: 'requests', + type: { + name: 'Composite', + className: 'ResourceRequests' + } + }, + limits: { + required: false, + serializedName: 'limits', + type: { + name: 'Composite', + className: 'ResourceLimits' + } + } + } + } + }; + } +} + +module.exports = ResourceRequirements; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/serviceList.js b/lib/services/serviceFabricMeshManagement/lib/models/serviceList.js new file mode 100644 index 0000000000..65f38eb4f6 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/serviceList.js @@ -0,0 +1,68 @@ +/* + * 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'; + +/** + * A pageable list of all services in an application. + * + */ +class ServiceList extends Array { + /** + * Create a ServiceList. + * @member {string} [nextLink] URI to fetch the next page of the list. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ServiceList + * + * @returns {object} metadata of ServiceList + * + */ + mapper() { + return { + required: false, + serializedName: 'ServiceList', + type: { + name: 'Composite', + className: 'ServiceList', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ServiceResourceDescriptionElementType', + type: { + name: 'Composite', + className: 'ServiceResourceDescription' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ServiceList; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/serviceReplicaDescription.js b/lib/services/serviceFabricMeshManagement/lib/models/serviceReplicaDescription.js new file mode 100644 index 0000000000..975722b462 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/serviceReplicaDescription.js @@ -0,0 +1,101 @@ +/* + * 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'); + +/** + * This type describes a replica of a service resource. + * + * @extends models['ServiceReplicaProperties'] + */ +class ServiceReplicaDescription extends models['ServiceReplicaProperties'] { + /** + * Create a ServiceReplicaDescription. + * @member {string} [replicaName] Name of the replica. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ServiceReplicaDescription + * + * @returns {object} metadata of ServiceReplicaDescription + * + */ + mapper() { + return { + required: false, + serializedName: 'ServiceReplicaDescription', + type: { + name: 'Composite', + className: 'ServiceReplicaDescription', + modelProperties: { + osType: { + required: true, + serializedName: 'osType', + type: { + name: 'String' + } + }, + codePackages: { + required: true, + serializedName: 'codePackages', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ContainerCodePackagePropertiesElementType', + type: { + name: 'Composite', + className: 'ContainerCodePackageProperties' + } + } + } + }, + networkRefs: { + required: false, + serializedName: 'networkRefs', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'NetworkRefElementType', + type: { + name: 'Composite', + className: 'NetworkRef' + } + } + } + }, + diagnostics: { + required: false, + serializedName: 'diagnostics', + type: { + name: 'Composite', + className: 'DiagnosticsRef' + } + }, + replicaName: { + required: false, + serializedName: 'replicaName', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ServiceReplicaDescription; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/serviceReplicaList.js b/lib/services/serviceFabricMeshManagement/lib/models/serviceReplicaList.js new file mode 100644 index 0000000000..0bc6aff35d --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/serviceReplicaList.js @@ -0,0 +1,68 @@ +/* + * 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'; + +/** + * A pageable list of replicas of a service resource. + * + */ +class ServiceReplicaList extends Array { + /** + * Create a ServiceReplicaList. + * @member {string} [nextLink] URI to fetch the next page of the list. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ServiceReplicaList + * + * @returns {object} metadata of ServiceReplicaList + * + */ + mapper() { + return { + required: false, + serializedName: 'ServiceReplicaList', + type: { + name: 'Composite', + className: 'ServiceReplicaList', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ServiceReplicaDescriptionElementType', + type: { + name: 'Composite', + className: 'ServiceReplicaDescription' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ServiceReplicaList; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/serviceReplicaProperties.js b/lib/services/serviceFabricMeshManagement/lib/models/serviceReplicaProperties.js new file mode 100644 index 0000000000..a89dff440d --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/serviceReplicaProperties.js @@ -0,0 +1,106 @@ +/* + * 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'); + +/** + * Describes the properties of a service replica. + * + */ +class ServiceReplicaProperties { + /** + * Create a ServiceReplicaProperties. + * @member {string} osType The Operating system type required by the code in + * service. + * . Possible values include: 'Linux', 'Windows' + * @member {array} codePackages Describes the set of code packages that forms + * the service. A code package describes the container and the properties for + * running it. All the code packages are started together on the same host + * and share the same context (network, process etc.). + * @member {array} [networkRefs] The names of the private networks that this + * service needs to be part of. + * @member {object} [diagnostics] Reference to sinks in + * DiagnosticsDescription. + * @member {boolean} [diagnostics.enabled] Status of whether or not sinks are + * enabled. + * @member {array} [diagnostics.sinkRefs] List of sinks to be used if + * enabled. References the list of sinks in DiagnosticsDescription. + */ + constructor() { + } + + /** + * Defines the metadata of ServiceReplicaProperties + * + * @returns {object} metadata of ServiceReplicaProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'ServiceReplicaProperties', + type: { + name: 'Composite', + className: 'ServiceReplicaProperties', + modelProperties: { + osType: { + required: true, + serializedName: 'osType', + type: { + name: 'String' + } + }, + codePackages: { + required: true, + serializedName: 'codePackages', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ContainerCodePackagePropertiesElementType', + type: { + name: 'Composite', + className: 'ContainerCodePackageProperties' + } + } + } + }, + networkRefs: { + required: false, + serializedName: 'networkRefs', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'NetworkRefElementType', + type: { + name: 'Composite', + className: 'NetworkRef' + } + } + } + }, + diagnostics: { + required: false, + serializedName: 'diagnostics', + type: { + name: 'Composite', + className: 'DiagnosticsRef' + } + } + } + } + }; + } +} + +module.exports = ServiceReplicaProperties; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/serviceResourceDescription.js b/lib/services/serviceFabricMeshManagement/lib/models/serviceResourceDescription.js new file mode 100644 index 0000000000..a0f7466792 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/serviceResourceDescription.js @@ -0,0 +1,169 @@ +/* + * 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'); + +/** + * This type describes a service resource. + * + * @extends models['ManagedProxyResource'] + */ +class ServiceResourceDescription extends models['ManagedProxyResource'] { + /** + * Create a ServiceResourceDescription. + * @member {string} osType The Operating system type required by the code in + * service. + * . Possible values include: 'Linux', 'Windows' + * @member {array} codePackages Describes the set of code packages that forms + * the service. A code package describes the container and the properties for + * running it. All the code packages are started together on the same host + * and share the same context (network, process etc.). + * @member {array} [networkRefs] The names of the private networks that this + * service needs to be part of. + * @member {object} [diagnostics] Reference to sinks in + * DiagnosticsDescription. + * @member {boolean} [diagnostics.enabled] Status of whether or not sinks are + * enabled. + * @member {array} [diagnostics.sinkRefs] List of sinks to be used if + * enabled. References the list of sinks in DiagnosticsDescription. + * @member {string} [description] User readable description of the service. + * @member {number} [replicaCount] The number of replicas of the service to + * create. Defaults to 1 if not specified. + * @member {string} [healthState] The health state of a resource such as + * Application, Service, or Network. Possible values include: 'Invalid', + * 'Ok', 'Warning', 'Error', 'Unknown' + * @member {string} [status] Represents the status of the service. Possible + * values include: 'Unknown', 'Active', 'Upgrading', 'Deleting', 'Creating', + * 'Failed' + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ServiceResourceDescription + * + * @returns {object} metadata of ServiceResourceDescription + * + */ + mapper() { + return { + required: false, + serializedName: 'ServiceResourceDescription', + type: { + name: 'Composite', + className: 'ServiceResourceDescription', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + osType: { + required: true, + serializedName: 'properties.osType', + type: { + name: 'String' + } + }, + codePackages: { + required: true, + serializedName: 'properties.codePackages', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ContainerCodePackagePropertiesElementType', + type: { + name: 'Composite', + className: 'ContainerCodePackageProperties' + } + } + } + }, + networkRefs: { + required: false, + serializedName: 'properties.networkRefs', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'NetworkRefElementType', + type: { + name: 'Composite', + className: 'NetworkRef' + } + } + } + }, + diagnostics: { + required: false, + serializedName: 'properties.diagnostics', + type: { + name: 'Composite', + className: 'DiagnosticsRef' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + replicaCount: { + required: false, + serializedName: 'properties.replicaCount', + type: { + name: 'Number' + } + }, + healthState: { + required: false, + serializedName: 'properties.healthState', + type: { + name: 'String' + } + }, + status: { + required: false, + readOnly: true, + serializedName: 'properties.status', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ServiceResourceDescription; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/setting.js b/lib/services/serviceFabricMeshManagement/lib/models/setting.js new file mode 100644 index 0000000000..08c2599bd0 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/setting.js @@ -0,0 +1,60 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Describes a setting for the container. + * + */ +class Setting { + /** + * Create a Setting. + * @member {string} [name] The name of the setting. + * @member {string} [value] The value of the setting. + */ + constructor() { + } + + /** + * Defines the metadata of Setting + * + * @returns {object} metadata of Setting + * + */ + mapper() { + return { + required: false, + serializedName: 'Setting', + type: { + name: 'Composite', + className: 'Setting', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + value: { + required: false, + serializedName: 'value', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Setting; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/trackedResource.js b/lib/services/serviceFabricMeshManagement/lib/models/trackedResource.js new file mode 100644 index 0000000000..79f9d74156 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/trackedResource.js @@ -0,0 +1,95 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The resource model definition for Azure Resource Manager tracked top-level + * resource. + * + * @extends models['Resource'] + */ +class TrackedResource extends models['Resource'] { + /** + * Create a TrackedResource. + * @member {object} [tags] Resource tags. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of TrackedResource + * + * @returns {object} metadata of TrackedResource + * + */ + mapper() { + return { + required: false, + serializedName: 'TrackedResource', + type: { + name: 'Composite', + className: 'TrackedResource', + 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' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = TrackedResource; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/volumeProperties.js b/lib/services/serviceFabricMeshManagement/lib/models/volumeProperties.js new file mode 100644 index 0000000000..009441cbca --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/volumeProperties.js @@ -0,0 +1,79 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * This type describes properties of a volume resource. + * + */ +class VolumeProperties { + /** + * Create a VolumeProperties. + * @member {string} [description] User readable description of the volume. + * @member {object} [azureFileParameters] This type describes a volume + * provided by an Azure Files file share. + * @member {string} [azureFileParameters.accountName] Name of the Azure + * storage account for the File Share. + * @member {string} [azureFileParameters.accountKey] Access key of the Azure + * storage account for the File Share. + * @member {string} [azureFileParameters.shareName] Name of the Azure Files + * file share that provides storage for the volume. + */ + constructor() { + } + + /** + * Defines the metadata of VolumeProperties + * + * @returns {object} metadata of VolumeProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'VolumeProperties', + type: { + name: 'Composite', + className: 'VolumeProperties', + modelProperties: { + description: { + required: false, + serializedName: 'description', + type: { + name: 'String' + } + }, + provider: { + required: true, + isConstant: true, + serializedName: 'provider', + defaultValue: 'SFAzureFile', + type: { + name: 'String' + } + }, + azureFileParameters: { + required: false, + serializedName: 'azureFileParameters', + type: { + name: 'Composite', + className: 'VolumeProviderParametersAzureFile' + } + } + } + } + }; + } +} + +module.exports = VolumeProperties; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/volumeProviderParametersAzureFile.js b/lib/services/serviceFabricMeshManagement/lib/models/volumeProviderParametersAzureFile.js new file mode 100644 index 0000000000..fb692bc7be --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/volumeProviderParametersAzureFile.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'; + +/** + * This type describes a volume provided by an Azure Files file share. + * + */ +class VolumeProviderParametersAzureFile { + /** + * Create a VolumeProviderParametersAzureFile. + * @member {string} accountName Name of the Azure storage account for the + * File Share. + * @member {string} [accountKey] Access key of the Azure storage account for + * the File Share. + * @member {string} shareName Name of the Azure Files file share that + * provides storage for the volume. + */ + constructor() { + } + + /** + * Defines the metadata of VolumeProviderParametersAzureFile + * + * @returns {object} metadata of VolumeProviderParametersAzureFile + * + */ + mapper() { + return { + required: false, + serializedName: 'VolumeProviderParametersAzureFile', + type: { + name: 'Composite', + className: 'VolumeProviderParametersAzureFile', + modelProperties: { + accountName: { + required: true, + serializedName: 'accountName', + type: { + name: 'String' + } + }, + accountKey: { + required: false, + serializedName: 'accountKey', + type: { + name: 'String' + } + }, + shareName: { + required: true, + serializedName: 'shareName', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VolumeProviderParametersAzureFile; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/volumeResourceDescription.js b/lib/services/serviceFabricMeshManagement/lib/models/volumeResourceDescription.js new file mode 100644 index 0000000000..30967aed94 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/volumeResourceDescription.js @@ -0,0 +1,135 @@ +/* + * 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'); + +/** + * This type describes a volume resource. + * + * @extends models['TrackedResource'] + */ +class VolumeResourceDescription extends models['TrackedResource'] { + /** + * Create a VolumeResourceDescription. + * @member {string} [provisioningState] State of the resource. + * @member {string} [description] User readable description of the volume. + * @member {object} [azureFileParameters] This type describes a volume + * provided by an Azure Files file share. + * @member {string} [azureFileParameters.accountName] Name of the Azure + * storage account for the File Share. + * @member {string} [azureFileParameters.accountKey] Access key of the Azure + * storage account for the File Share. + * @member {string} [azureFileParameters.shareName] Name of the Azure Files + * file share that provides storage for the volume. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of VolumeResourceDescription + * + * @returns {object} metadata of VolumeResourceDescription + * + */ + mapper() { + return { + required: false, + serializedName: 'VolumeResourceDescription', + type: { + name: 'Composite', + className: 'VolumeResourceDescription', + 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' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + provider: { + required: true, + isConstant: true, + serializedName: 'properties.provider', + defaultValue: 'SFAzureFile', + type: { + name: 'String' + } + }, + azureFileParameters: { + required: false, + serializedName: 'properties.azureFileParameters', + type: { + name: 'Composite', + className: 'VolumeProviderParametersAzureFile' + } + } + } + } + }; + } +} + +module.exports = VolumeResourceDescription; diff --git a/lib/services/serviceFabricMeshManagement/lib/models/volumeResourceDescriptionList.js b/lib/services/serviceFabricMeshManagement/lib/models/volumeResourceDescriptionList.js new file mode 100644 index 0000000000..1522d5f26e --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/models/volumeResourceDescriptionList.js @@ -0,0 +1,67 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * A pageable list of volume resources. + */ +class VolumeResourceDescriptionList extends Array { + /** + * Create a VolumeResourceDescriptionList. + * @member {string} [nextLink] URI to fetch the next page of the list. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of VolumeResourceDescriptionList + * + * @returns {object} metadata of VolumeResourceDescriptionList + * + */ + mapper() { + return { + required: false, + serializedName: 'VolumeResourceDescriptionList', + type: { + name: 'Composite', + className: 'VolumeResourceDescriptionList', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'VolumeResourceDescriptionElementType', + type: { + name: 'Composite', + className: 'VolumeResourceDescription' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VolumeResourceDescriptionList; diff --git a/lib/services/serviceFabricMeshManagement/lib/operations/application.js b/lib/services/serviceFabricMeshManagement/lib/operations/application.js new file mode 100644 index 0000000000..d08c846bca --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/operations/application.js @@ -0,0 +1,1770 @@ +/* + * 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; + +/** + * @summary Creates or updates an application resource. + * + * Creates an application resource with the specified name and description. If + * an application with the same name already exists, then its description is + * updated to the one indicated in this request. + * + * Use network resources to provide public connectivity to the services of an + * application. + * + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} applicationName The identity of the application. + * + * @param {object} applicationResourceDescription Description for creating an + * application resource. + * + * @param {string} [applicationResourceDescription.description] User readable + * description of the application. + * + * @param {string} [applicationResourceDescription.debugParams] Internal use. + * + * @param {array} [applicationResourceDescription.services] describes the + * services in the application. + * + * @param {object} [applicationResourceDescription.diagnostics] Describes the + * diagnostics definition and usage for an application resource. + * + * @param {array} [applicationResourceDescription.diagnostics.sinks] List of + * supported sinks that can be referenced. + * + * @param {boolean} [applicationResourceDescription.diagnostics.enabled] Status + * of whether or not sinks are enabled. + * + * @param {array} [applicationResourceDescription.diagnostics.defaultSinkRefs] + * The sinks to be used if diagnostics is enabled. Sink choices can be + * overridden at the service and code package level. + * + * @param {object} [applicationResourceDescription.tags] Resource tags. + * + * @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 ApplicationResourceDescription} 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 _create(resourceGroupName, applicationName, applicationResourceDescription, 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 (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (applicationName === null || applicationName === undefined || typeof applicationName.valueOf() !== 'string') { + throw new Error('applicationName cannot be null or undefined and it must be of type string.'); + } + if (applicationResourceDescription === null || applicationResourceDescription === undefined) { + throw new Error('applicationResourceDescription cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/applications/{applicationName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{applicationName}', applicationName); + 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 (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 (applicationResourceDescription !== null && applicationResourceDescription !== undefined) { + let requestModelMapper = new client.models['ApplicationResourceDescription']().mapper(); + requestModel = client.serialize(requestModelMapper, applicationResourceDescription, 'applicationResourceDescription'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(applicationResourceDescription, 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['ErrorModel']().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['ApplicationResourceDescription']().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['ApplicationResourceDescription']().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); + }); +} + +/** + * @summary Gets the application resource. + * + * Gets the information about the application resource with a given name. The + * information includes the information about the application's services and + * other runtime properties. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} applicationName The identity of the application. + * + * @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 ApplicationResourceDescription} 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, applicationName, 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 (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (applicationName === null || applicationName === undefined || typeof applicationName.valueOf() !== 'string') { + throw new Error('applicationName 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.ServiceFabricMesh/applications/{applicationName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{applicationName}', applicationName); + 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['ErrorModel']().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['ApplicationResourceDescription']().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); + }); +} + +/** + * @summary Deletes the application resource. + * + * Deletes the application resource identified by the name. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} applicationName The identity of the application. + * + * @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, applicationName, 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 (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (applicationName === null || applicationName === undefined || typeof applicationName.valueOf() !== 'string') { + throw new Error('applicationName 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.ServiceFabricMesh/applications/{applicationName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{applicationName}', applicationName); + 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 (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 && 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['ErrorModel']().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); + }); +} + +/** + * @summary Gets all the application resources in a given resource group. + * + * Gets the information about all application resources in a given resource + * group. The information includes the information about the application's + * services and other runtime properties. + * + * @param {string} resourceGroupName Azure resource group name + * + * @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 ApplicationResourceDescriptionList} 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 _listByResourceGroup(resourceGroupName, 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 (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (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.ServiceFabricMesh/applications'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + 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['ErrorModel']().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['ApplicationResourceDescriptionList']().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); + }); +} + +/** + * @summary Gets all the application resources in a given subscription. + * + * Gets the information about all application resources in a given + * subscription. The information includes the information about the + * application's services and other runtime properties. + * + * @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 ApplicationResourceDescriptionList} 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 _listBySubscription(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 (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}/providers/Microsoft.ServiceFabricMesh/applications'; + 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['ErrorModel']().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['ApplicationResourceDescriptionList']().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); + }); +} + +/** + * @summary Gets all the application resources in a given resource group. + * + * Gets the information about all application resources in a given resource + * group. The information includes the information about the application's + * services and other runtime properties. + * + * @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 ApplicationResourceDescriptionList} 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 _listByResourceGroupNext(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['ErrorModel']().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['ApplicationResourceDescriptionList']().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); + }); +} + +/** + * @summary Gets all the application resources in a given subscription. + * + * Gets the information about all application resources in a given + * subscription. The information includes the information about the + * application's services and other runtime properties. + * + * @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 ApplicationResourceDescriptionList} 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 _listBySubscriptionNext(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['ErrorModel']().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['ApplicationResourceDescriptionList']().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 Application. */ +class Application { + /** + * Create a Application. + * @param {ServiceFabricMeshManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._create = _create; + this._get = _get; + this._deleteMethod = _deleteMethod; + this._listByResourceGroup = _listByResourceGroup; + this._listBySubscription = _listBySubscription; + this._listByResourceGroupNext = _listByResourceGroupNext; + this._listBySubscriptionNext = _listBySubscriptionNext; + } + + /** + * @summary Creates or updates an application resource. + * + * Creates an application resource with the specified name and description. If + * an application with the same name already exists, then its description is + * updated to the one indicated in this request. + * + * Use network resources to provide public connectivity to the services of an + * application. + * + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} applicationName The identity of the application. + * + * @param {object} applicationResourceDescription Description for creating an + * application resource. + * + * @param {string} [applicationResourceDescription.description] User readable + * description of the application. + * + * @param {string} [applicationResourceDescription.debugParams] Internal use. + * + * @param {array} [applicationResourceDescription.services] describes the + * services in the application. + * + * @param {object} [applicationResourceDescription.diagnostics] Describes the + * diagnostics definition and usage for an application resource. + * + * @param {array} [applicationResourceDescription.diagnostics.sinks] List of + * supported sinks that can be referenced. + * + * @param {boolean} [applicationResourceDescription.diagnostics.enabled] Status + * of whether or not sinks are enabled. + * + * @param {array} [applicationResourceDescription.diagnostics.defaultSinkRefs] + * The sinks to be used if diagnostics is enabled. Sink choices can be + * overridden at the service and code package level. + * + * @param {object} [applicationResourceDescription.tags] Resource tags. + * + * @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. + */ + createWithHttpOperationResponse(resourceGroupName, applicationName, applicationResourceDescription, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._create(resourceGroupName, applicationName, applicationResourceDescription, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Creates or updates an application resource. + * + * Creates an application resource with the specified name and description. If + * an application with the same name already exists, then its description is + * updated to the one indicated in this request. + * + * Use network resources to provide public connectivity to the services of an + * application. + * + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} applicationName The identity of the application. + * + * @param {object} applicationResourceDescription Description for creating an + * application resource. + * + * @param {string} [applicationResourceDescription.description] User readable + * description of the application. + * + * @param {string} [applicationResourceDescription.debugParams] Internal use. + * + * @param {array} [applicationResourceDescription.services] describes the + * services in the application. + * + * @param {object} [applicationResourceDescription.diagnostics] Describes the + * diagnostics definition and usage for an application resource. + * + * @param {array} [applicationResourceDescription.diagnostics.sinks] List of + * supported sinks that can be referenced. + * + * @param {boolean} [applicationResourceDescription.diagnostics.enabled] Status + * of whether or not sinks are enabled. + * + * @param {array} [applicationResourceDescription.diagnostics.defaultSinkRefs] + * The sinks to be used if diagnostics is enabled. Sink choices can be + * overridden at the service and code package level. + * + * @param {object} [applicationResourceDescription.tags] Resource tags. + * + * @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 {ApplicationResourceDescription} - 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 ApplicationResourceDescription} 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. + */ + create(resourceGroupName, applicationName, applicationResourceDescription, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._create(resourceGroupName, applicationName, applicationResourceDescription, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(resourceGroupName, applicationName, applicationResourceDescription, options, optionalCallback); + } + } + + /** + * @summary Gets the application resource. + * + * Gets the information about the application resource with a given name. The + * information includes the information about the application's services and + * other runtime properties. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} applicationName The identity of the application. + * + * @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, applicationName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, applicationName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Gets the application resource. + * + * Gets the information about the application resource with a given name. The + * information includes the information about the application's services and + * other runtime properties. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} applicationName The identity of the application. + * + * @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 {ApplicationResourceDescription} - 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 ApplicationResourceDescription} 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, applicationName, 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, applicationName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, applicationName, options, optionalCallback); + } + } + + /** + * @summary Deletes the application resource. + * + * Deletes the application resource identified by the name. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} applicationName The identity of the application. + * + * @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, applicationName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, applicationName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Deletes the application resource. + * + * Deletes the application resource identified by the name. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} applicationName The identity of the application. + * + * @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, applicationName, 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, applicationName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, applicationName, options, optionalCallback); + } + } + + /** + * @summary Gets all the application resources in a given resource group. + * + * Gets the information about all application resources in a given resource + * group. The information includes the information about the application's + * services and other runtime properties. + * + * @param {string} resourceGroupName Azure resource group name + * + * @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. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Gets all the application resources in a given resource group. + * + * Gets the information about all application resources in a given resource + * group. The information includes the information about the application's + * services and other runtime properties. + * + * @param {string} resourceGroupName Azure resource group name + * + * @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 {ApplicationResourceDescriptionList} - 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 ApplicationResourceDescriptionList} 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. + */ + listByResourceGroup(resourceGroupName, 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._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroup(resourceGroupName, options, optionalCallback); + } + } + + /** + * @summary Gets all the application resources in a given subscription. + * + * Gets the information about all application resources in a given + * subscription. The information includes the information about the + * application's services and other runtime properties. + * + * @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. + */ + listBySubscriptionWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listBySubscription(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Gets all the application resources in a given subscription. + * + * Gets the information about all application resources in a given + * subscription. The information includes the information about the + * application's services and other runtime properties. + * + * @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 {ApplicationResourceDescriptionList} - 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 ApplicationResourceDescriptionList} 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. + */ + listBySubscription(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._listBySubscription(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listBySubscription(options, optionalCallback); + } + } + + /** + * @summary Gets all the application resources in a given resource group. + * + * Gets the information about all application resources in a given resource + * group. The information includes the information about the application's + * services and other runtime properties. + * + * @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. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Gets all the application resources in a given resource group. + * + * Gets the information about all application resources in a given resource + * group. The information includes the information about the application's + * services and other runtime properties. + * + * @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 {ApplicationResourceDescriptionList} - 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 ApplicationResourceDescriptionList} 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. + */ + listByResourceGroupNext(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._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroupNext(nextPageLink, options, optionalCallback); + } + } + + /** + * @summary Gets all the application resources in a given subscription. + * + * Gets the information about all application resources in a given + * subscription. The information includes the information about the + * application's services and other runtime properties. + * + * @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. + */ + listBySubscriptionNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listBySubscriptionNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Gets all the application resources in a given subscription. + * + * Gets the information about all application resources in a given + * subscription. The information includes the information about the + * application's services and other runtime properties. + * + * @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 {ApplicationResourceDescriptionList} - 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 ApplicationResourceDescriptionList} 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. + */ + listBySubscriptionNext(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._listBySubscriptionNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listBySubscriptionNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = Application; diff --git a/lib/services/serviceFabricMeshManagement/lib/operations/codePackage.js b/lib/services/serviceFabricMeshManagement/lib/operations/codePackage.js new file mode 100644 index 0000000000..f993e36745 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/operations/codePackage.js @@ -0,0 +1,311 @@ +/* + * 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; + +/** + * @summary Gets the logs for the container. + * + * Get the logs for the container of a given code package of an application. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} applicationName The identity of the application. + * + * @param {string} serviceName The identity of the service. + * + * @param {string} replicaName The identity of the service replica. + * + * @param {string} codePackageName The name of the code package. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.tail] Number of lines to show from the end of the + * logs. Default is 100. + * + * @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 ContainerLogs} 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 _getContainerLog(resourceGroupName, applicationName, serviceName, replicaName, codePackageName, 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 tail = (options && options.tail !== undefined) ? options.tail : undefined; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (applicationName === null || applicationName === undefined || typeof applicationName.valueOf() !== 'string') { + throw new Error('applicationName 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 (replicaName === null || replicaName === undefined || typeof replicaName.valueOf() !== 'string') { + throw new Error('replicaName cannot be null or undefined and it must be of type string.'); + } + if (codePackageName === null || codePackageName === undefined || typeof codePackageName.valueOf() !== 'string') { + throw new Error('codePackageName cannot be null or undefined and it must be of type string.'); + } + if (tail !== null && tail !== undefined && typeof tail !== 'number') { + throw new Error('tail must be of type number.'); + } + 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.ServiceFabricMesh/applications/{applicationName}/services/{serviceName}/replicas/{replicaName}/codePackages/{codePackageName}/logs'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{applicationName}', applicationName); + requestUrl = requestUrl.replace('{serviceName}', serviceName); + requestUrl = requestUrl.replace('{replicaName}', replicaName); + requestUrl = requestUrl.replace('{codePackageName}', codePackageName); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (tail !== null && tail !== undefined) { + queryParameters.push('tail=' + encodeURIComponent(tail.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['ErrorModel']().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['ContainerLogs']().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 CodePackage. */ +class CodePackage { + /** + * Create a CodePackage. + * @param {ServiceFabricMeshManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._getContainerLog = _getContainerLog; + } + + /** + * @summary Gets the logs for the container. + * + * Get the logs for the container of a given code package of an application. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} applicationName The identity of the application. + * + * @param {string} serviceName The identity of the service. + * + * @param {string} replicaName The identity of the service replica. + * + * @param {string} codePackageName The name of the code package. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.tail] Number of lines to show from the end of the + * logs. Default is 100. + * + * @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. + */ + getContainerLogWithHttpOperationResponse(resourceGroupName, applicationName, serviceName, replicaName, codePackageName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getContainerLog(resourceGroupName, applicationName, serviceName, replicaName, codePackageName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Gets the logs for the container. + * + * Get the logs for the container of a given code package of an application. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} applicationName The identity of the application. + * + * @param {string} serviceName The identity of the service. + * + * @param {string} replicaName The identity of the service replica. + * + * @param {string} codePackageName The name of the code package. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.tail] Number of lines to show from the end of the + * logs. Default is 100. + * + * @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 {ContainerLogs} - 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 ContainerLogs} 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. + */ + getContainerLog(resourceGroupName, applicationName, serviceName, replicaName, codePackageName, 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._getContainerLog(resourceGroupName, applicationName, serviceName, replicaName, codePackageName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getContainerLog(resourceGroupName, applicationName, serviceName, replicaName, codePackageName, options, optionalCallback); + } + } + +} + +module.exports = CodePackage; diff --git a/lib/services/serviceFabricMeshManagement/lib/operations/index.d.ts b/lib/services/serviceFabricMeshManagement/lib/operations/index.d.ts new file mode 100644 index 0000000000..655f18e495 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/operations/index.d.ts @@ -0,0 +1,2209 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. +*/ + +import { ServiceClientOptions, RequestOptions, ServiceCallback, HttpOperationResponse } from 'ms-rest'; +import * as models from '../models'; + + +/** + * @class + * Application + * __NOTE__: An instance of this class is automatically created for an + * instance of the ServiceFabricMeshManagementClient. + */ +export interface Application { + + + /** + * @summary Creates or updates an application resource. + * + * Creates an application resource with the specified name and description. If + * an application with the same name already exists, then its description is + * updated to the one indicated in this request. + * + * Use network resources to provide public connectivity to the services of an + * application. + * + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} applicationName The identity of the application. + * + * @param {object} applicationResourceDescription Description for creating an + * application resource. + * + * @param {string} [applicationResourceDescription.description] User readable + * description of the application. + * + * @param {string} [applicationResourceDescription.debugParams] Internal use. + * + * @param {array} [applicationResourceDescription.services] describes the + * services in the application. + * + * @param {object} [applicationResourceDescription.diagnostics] Describes the + * diagnostics definition and usage for an application resource. + * + * @param {array} [applicationResourceDescription.diagnostics.sinks] List of + * supported sinks that can be referenced. + * + * @param {boolean} [applicationResourceDescription.diagnostics.enabled] Status + * of whether or not sinks are enabled. + * + * @param {array} [applicationResourceDescription.diagnostics.defaultSinkRefs] + * The sinks to be used if diagnostics is enabled. Sink choices can be + * overridden at the service and code package level. + * + * @param {object} [applicationResourceDescription.tags] Resource tags. + * + * @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. + */ + createWithHttpOperationResponse(resourceGroupName: string, applicationName: string, applicationResourceDescription: models.ApplicationResourceDescription, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Creates or updates an application resource. + * + * Creates an application resource with the specified name and description. If + * an application with the same name already exists, then its description is + * updated to the one indicated in this request. + * + * Use network resources to provide public connectivity to the services of an + * application. + * + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} applicationName The identity of the application. + * + * @param {object} applicationResourceDescription Description for creating an + * application resource. + * + * @param {string} [applicationResourceDescription.description] User readable + * description of the application. + * + * @param {string} [applicationResourceDescription.debugParams] Internal use. + * + * @param {array} [applicationResourceDescription.services] describes the + * services in the application. + * + * @param {object} [applicationResourceDescription.diagnostics] Describes the + * diagnostics definition and usage for an application resource. + * + * @param {array} [applicationResourceDescription.diagnostics.sinks] List of + * supported sinks that can be referenced. + * + * @param {boolean} [applicationResourceDescription.diagnostics.enabled] Status + * of whether or not sinks are enabled. + * + * @param {array} [applicationResourceDescription.diagnostics.defaultSinkRefs] + * The sinks to be used if diagnostics is enabled. Sink choices can be + * overridden at the service and code package level. + * + * @param {object} [applicationResourceDescription.tags] Resource tags. + * + * @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 {ApplicationResourceDescription} - 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. + * + * {ApplicationResourceDescription} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationResourceDescription} 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. + */ + create(resourceGroupName: string, applicationName: string, applicationResourceDescription: models.ApplicationResourceDescription, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, applicationName: string, applicationResourceDescription: models.ApplicationResourceDescription, callback: ServiceCallback): void; + create(resourceGroupName: string, applicationName: string, applicationResourceDescription: models.ApplicationResourceDescription, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Gets the application resource. + * + * Gets the information about the application resource with a given name. The + * information includes the information about the application's services and + * other runtime properties. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} applicationName The identity of the application. + * + * @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, applicationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Gets the application resource. + * + * Gets the information about the application resource with a given name. The + * information includes the information about the application's services and + * other runtime properties. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} applicationName The identity of the application. + * + * @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 {ApplicationResourceDescription} - 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. + * + * {ApplicationResourceDescription} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationResourceDescription} 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, applicationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, applicationName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, applicationName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Deletes the application resource. + * + * Deletes the application resource identified by the name. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} applicationName The identity of the application. + * + * @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, applicationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Deletes the application resource. + * + * Deletes the application resource identified by the name. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} applicationName The identity of the application. + * + * @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, applicationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, applicationName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, applicationName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Gets all the application resources in a given resource group. + * + * Gets the information about all application resources in a given resource + * group. The information includes the information about the application's + * services and other runtime properties. + * + * @param {string} resourceGroupName Azure resource group name + * + * @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>; + + /** + * @summary Gets all the application resources in a given resource group. + * + * Gets the information about all application resources in a given resource + * group. The information includes the information about the application's + * services and other runtime properties. + * + * @param {string} resourceGroupName Azure resource group name + * + * @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 {ApplicationResourceDescriptionList} - 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. + * + * {ApplicationResourceDescriptionList} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationResourceDescriptionList} 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; + + + /** + * @summary Gets all the application resources in a given subscription. + * + * Gets the information about all application resources in a given + * subscription. The information includes the information about the + * application's services and other runtime properties. + * + * @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. + */ + listBySubscriptionWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Gets all the application resources in a given subscription. + * + * Gets the information about all application resources in a given + * subscription. The information includes the information about the + * application's services and other runtime properties. + * + * @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 {ApplicationResourceDescriptionList} - 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. + * + * {ApplicationResourceDescriptionList} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationResourceDescriptionList} 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. + */ + listBySubscription(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listBySubscription(callback: ServiceCallback): void; + listBySubscription(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Gets all the application resources in a given resource group. + * + * Gets the information about all application resources in a given resource + * group. The information includes the information about the application's + * services and other runtime properties. + * + * @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. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Gets all the application resources in a given resource group. + * + * Gets the information about all application resources in a given resource + * group. The information includes the information about the application's + * services and other runtime properties. + * + * @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 {ApplicationResourceDescriptionList} - 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. + * + * {ApplicationResourceDescriptionList} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationResourceDescriptionList} 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. + */ + 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; + + + /** + * @summary Gets all the application resources in a given subscription. + * + * Gets the information about all application resources in a given + * subscription. The information includes the information about the + * application's services and other runtime properties. + * + * @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. + */ + listBySubscriptionNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Gets all the application resources in a given subscription. + * + * Gets the information about all application resources in a given + * subscription. The information includes the information about the + * application's services and other runtime properties. + * + * @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 {ApplicationResourceDescriptionList} - 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. + * + * {ApplicationResourceDescriptionList} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationResourceDescriptionList} 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. + */ + listBySubscriptionNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listBySubscriptionNext(nextPageLink: string, callback: ServiceCallback): void; + listBySubscriptionNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Service + * __NOTE__: An instance of this class is automatically created for an + * instance of the ServiceFabricMeshManagementClient. + */ +export interface Service { + + + /** + * @summary Gets services of a given application. + * + * Gets the information about all services of a given service of an + * application. The information includes the runtime properties of the service + * instance. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} applicationName The identity of the application. + * + * @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. + */ + listByApplicationNameWithHttpOperationResponse(resourceGroupName: string, applicationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Gets services of a given application. + * + * Gets the information about all services of a given service of an + * application. The information includes the runtime properties of the service + * instance. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} applicationName The identity of the application. + * + * @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 {ServiceList} - 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. + * + * {ServiceList} [result] - The deserialized result object if an error did not occur. + * See {@link ServiceList} 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. + */ + listByApplicationName(resourceGroupName: string, applicationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByApplicationName(resourceGroupName: string, applicationName: string, callback: ServiceCallback): void; + listByApplicationName(resourceGroupName: string, applicationName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Gets the properties of the service. + * + * The operation returns the properties of the service. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} applicationName The identity of the application. + * + * @param {string} serviceName The identity of the 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, applicationName: string, serviceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Gets the properties of the service. + * + * The operation returns the properties of the service. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} applicationName The identity of the application. + * + * @param {string} serviceName The identity of the 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 {ServiceResourceDescription} - 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. + * + * {ServiceResourceDescription} [result] - The deserialized result object if an error did not occur. + * See {@link ServiceResourceDescription} 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, applicationName: string, serviceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, applicationName: string, serviceName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, applicationName: string, serviceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Gets services of a given application. + * + * Gets the information about all services of a given service of an + * application. The information includes the runtime properties of the 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. + */ + listByApplicationNameNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Gets services of a given application. + * + * Gets the information about all services of a given service of an + * application. The information includes the runtime properties of the 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 {ServiceList} - 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. + * + * {ServiceList} [result] - The deserialized result object if an error did not occur. + * See {@link ServiceList} 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. + */ + listByApplicationNameNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByApplicationNameNext(nextPageLink: string, callback: ServiceCallback): void; + listByApplicationNameNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Replica + * __NOTE__: An instance of this class is automatically created for an + * instance of the ServiceFabricMeshManagementClient. + */ +export interface Replica { + + + /** + * @summary Gets replicas of a given service. + * + * Gets the information about all replicas of a given service of an + * application. The information includes the runtime properties of the replica + * instance. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} applicationName The identity of the application. + * + * @param {string} serviceName The identity of the 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. + */ + listByServiceNameWithHttpOperationResponse(resourceGroupName: string, applicationName: string, serviceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Gets replicas of a given service. + * + * Gets the information about all replicas of a given service of an + * application. The information includes the runtime properties of the replica + * instance. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} applicationName The identity of the application. + * + * @param {string} serviceName The identity of the 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 {ServiceReplicaList} - 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. + * + * {ServiceReplicaList} [result] - The deserialized result object if an error did not occur. + * See {@link ServiceReplicaList} 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. + */ + listByServiceName(resourceGroupName: string, applicationName: string, serviceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServiceName(resourceGroupName: string, applicationName: string, serviceName: string, callback: ServiceCallback): void; + listByServiceName(resourceGroupName: string, applicationName: string, serviceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Gets a specific replica of a given service. + * + * Gets the information about the specified replica of a given service of an + * application. The information includes the runtime properties of the replica + * instance. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} applicationName The identity of the application. + * + * @param {string} serviceName The identity of the service. + * + * @param {string} replicaName The identity of the service replica. + * + * @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, applicationName: string, serviceName: string, replicaName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Gets a specific replica of a given service. + * + * Gets the information about the specified replica of a given service of an + * application. The information includes the runtime properties of the replica + * instance. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} applicationName The identity of the application. + * + * @param {string} serviceName The identity of the service. + * + * @param {string} replicaName The identity of the service replica. + * + * @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 {ServiceReplicaDescription} - 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. + * + * {ServiceReplicaDescription} [result] - The deserialized result object if an error did not occur. + * See {@link ServiceReplicaDescription} 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, applicationName: string, serviceName: string, replicaName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, applicationName: string, serviceName: string, replicaName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, applicationName: string, serviceName: string, replicaName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Gets replicas of a given service. + * + * Gets the information about all replicas of a given service of an + * application. The information includes the runtime properties of the replica + * 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. + */ + listByServiceNameNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Gets replicas of a given service. + * + * Gets the information about all replicas of a given service of an + * application. The information includes the runtime properties of the replica + * 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 {ServiceReplicaList} - 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. + * + * {ServiceReplicaList} [result] - The deserialized result object if an error did not occur. + * See {@link ServiceReplicaList} 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. + */ + listByServiceNameNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServiceNameNext(nextPageLink: string, callback: ServiceCallback): void; + listByServiceNameNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * CodePackage + * __NOTE__: An instance of this class is automatically created for an + * instance of the ServiceFabricMeshManagementClient. + */ +export interface CodePackage { + + + /** + * @summary Gets the logs for the container. + * + * Get the logs for the container of a given code package of an application. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} applicationName The identity of the application. + * + * @param {string} serviceName The identity of the service. + * + * @param {string} replicaName The identity of the service replica. + * + * @param {string} codePackageName The name of the code package. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.tail] Number of lines to show from the end of the + * logs. Default is 100. + * + * @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. + */ + getContainerLogWithHttpOperationResponse(resourceGroupName: string, applicationName: string, serviceName: string, replicaName: string, codePackageName: string, options?: { tail? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Gets the logs for the container. + * + * Get the logs for the container of a given code package of an application. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} applicationName The identity of the application. + * + * @param {string} serviceName The identity of the service. + * + * @param {string} replicaName The identity of the service replica. + * + * @param {string} codePackageName The name of the code package. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.tail] Number of lines to show from the end of the + * logs. Default is 100. + * + * @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 {ContainerLogs} - 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. + * + * {ContainerLogs} [result] - The deserialized result object if an error did not occur. + * See {@link ContainerLogs} 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. + */ + getContainerLog(resourceGroupName: string, applicationName: string, serviceName: string, replicaName: string, codePackageName: string, options?: { tail? : number, customHeaders? : { [headerName: string]: string; } }): Promise; + getContainerLog(resourceGroupName: string, applicationName: string, serviceName: string, replicaName: string, codePackageName: string, callback: ServiceCallback): void; + getContainerLog(resourceGroupName: string, applicationName: string, serviceName: string, replicaName: string, codePackageName: string, options: { tail? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Operations + * __NOTE__: An instance of this class is automatically created for an + * instance of the ServiceFabricMeshManagementClient. + */ +export interface Operations { + + + /** + * @summary Lists all of the available operations. + * + * Lists all the available operations provided by Service Fabric SeaBreeze + * resource provider. + * + * @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>; + + /** + * @summary Lists all of the available operations. + * + * Lists all the available operations provided by Service Fabric SeaBreeze + * resource provider. + * + * @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 {OperationListResult} - 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. + * + * {OperationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link OperationListResult} 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; + + + /** + * @summary Lists all of the available operations. + * + * Lists all the available operations provided by Service Fabric SeaBreeze + * resource provider. + * + * @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. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Lists all of the available operations. + * + * Lists all the available operations provided by Service Fabric SeaBreeze + * resource provider. + * + * @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 {OperationListResult} - 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. + * + * {OperationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link OperationListResult} 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 + * Network + * __NOTE__: An instance of this class is automatically created for an + * instance of the ServiceFabricMeshManagementClient. + */ +export interface Network { + + + /** + * @summary Creates or updates a network resource. + * + * Creates a network resource with the specified name and description. If a + * network with the same name already exists, then its description is updated + * to the one indicated in this request. + * + * Use network resources to create private network and configure public + * connectivity for services within your application. + * + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} networkName The identity of the network. + * + * @param {object} networkResourceDescription Description for creating a + * network resource. + * + * @param {string} [networkResourceDescription.description] User readable + * description of the network. + * + * @param {string} networkResourceDescription.addressPrefix the address prefix + * for this network. + * + * @param {object} [networkResourceDescription.ingressConfig] Configuration for + * public connectivity for this network. + * + * @param {string} [networkResourceDescription.ingressConfig.qosLevel] The QoS + * tier for ingress. Possible values include: 'Bronze' + * + * @param {array} [networkResourceDescription.ingressConfig.layer4] + * Configuration for layer4 public connectivity for this network. + * + * @param {object} [networkResourceDescription.tags] Resource tags. + * + * @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. + */ + createWithHttpOperationResponse(resourceGroupName: string, networkName: string, networkResourceDescription: models.NetworkResourceDescription, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Creates or updates a network resource. + * + * Creates a network resource with the specified name and description. If a + * network with the same name already exists, then its description is updated + * to the one indicated in this request. + * + * Use network resources to create private network and configure public + * connectivity for services within your application. + * + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} networkName The identity of the network. + * + * @param {object} networkResourceDescription Description for creating a + * network resource. + * + * @param {string} [networkResourceDescription.description] User readable + * description of the network. + * + * @param {string} networkResourceDescription.addressPrefix the address prefix + * for this network. + * + * @param {object} [networkResourceDescription.ingressConfig] Configuration for + * public connectivity for this network. + * + * @param {string} [networkResourceDescription.ingressConfig.qosLevel] The QoS + * tier for ingress. Possible values include: 'Bronze' + * + * @param {array} [networkResourceDescription.ingressConfig.layer4] + * Configuration for layer4 public connectivity for this network. + * + * @param {object} [networkResourceDescription.tags] Resource tags. + * + * @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 {NetworkResourceDescription} - 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. + * + * {NetworkResourceDescription} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkResourceDescription} 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. + */ + create(resourceGroupName: string, networkName: string, networkResourceDescription: models.NetworkResourceDescription, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, networkName: string, networkResourceDescription: models.NetworkResourceDescription, callback: ServiceCallback): void; + create(resourceGroupName: string, networkName: string, networkResourceDescription: models.NetworkResourceDescription, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Gets the network resource. + * + * Gets the information about the network resource with a given name. This + * information includes the network description and other runtime information. + * + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} networkName The identity of the network. + * + * @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, networkName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Gets the network resource. + * + * Gets the information about the network resource with a given name. This + * information includes the network description and other runtime information. + * + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} networkName The identity of the network. + * + * @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 {NetworkResourceDescription} - 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. + * + * {NetworkResourceDescription} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkResourceDescription} 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, networkName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, networkName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, networkName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Deletes the network resource. + * + * Deletes the network resource identified by the name. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} networkName The identity of the network. + * + * @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, networkName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Deletes the network resource. + * + * Deletes the network resource identified by the name. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} networkName The identity of the network. + * + * @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, networkName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, networkName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, networkName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Gets all the network resources in a given resource group. + * + * Gets the information about all network resources in a given resource group. + * The information includes the network description and other runtime + * properties. + * + * + * @param {string} resourceGroupName Azure resource group name + * + * @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>; + + /** + * @summary Gets all the network resources in a given resource group. + * + * Gets the information about all network resources in a given resource group. + * The information includes the network description and other runtime + * properties. + * + * + * @param {string} resourceGroupName Azure resource group name + * + * @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 {NetworkResourceDescriptionList} - 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. + * + * {NetworkResourceDescriptionList} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkResourceDescriptionList} 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; + + + /** + * @summary Gets all the network resources in a given subscription. + * + * Gets the information about all network resources in a given subscription. + * The information includes the network description and other runtime + * properties. + * + * @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. + */ + listBySubscriptionWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Gets all the network resources in a given subscription. + * + * Gets the information about all network resources in a given subscription. + * The information includes the network description and other runtime + * properties. + * + * @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 {NetworkResourceDescriptionList} - 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. + * + * {NetworkResourceDescriptionList} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkResourceDescriptionList} 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. + */ + listBySubscription(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listBySubscription(callback: ServiceCallback): void; + listBySubscription(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Gets all the network resources in a given resource group. + * + * Gets the information about all network resources in a given resource group. + * The information includes the network description and other runtime + * properties. + * + * + * @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. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Gets all the network resources in a given resource group. + * + * Gets the information about all network resources in a given resource group. + * The information includes the network description and other runtime + * properties. + * + * + * @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 {NetworkResourceDescriptionList} - 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. + * + * {NetworkResourceDescriptionList} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkResourceDescriptionList} 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. + */ + 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; + + + /** + * @summary Gets all the network resources in a given subscription. + * + * Gets the information about all network resources in a given subscription. + * The information includes the network description and other runtime + * properties. + * + * @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. + */ + listBySubscriptionNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Gets all the network resources in a given subscription. + * + * Gets the information about all network resources in a given subscription. + * The information includes the network description and other runtime + * properties. + * + * @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 {NetworkResourceDescriptionList} - 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. + * + * {NetworkResourceDescriptionList} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkResourceDescriptionList} 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. + */ + listBySubscriptionNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listBySubscriptionNext(nextPageLink: string, callback: ServiceCallback): void; + listBySubscriptionNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Volume + * __NOTE__: An instance of this class is automatically created for an + * instance of the ServiceFabricMeshManagementClient. + */ +export interface Volume { + + + /** + * @summary Creates or updates a volume resource. + * + * Creates a volume resource with the specified name and description. If a + * volume with the same name already exists, then its description is updated to + * the one indicated in this request. + * + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} volumeName The identity of the volume. + * + * @param {object} volumeResourceDescription Description for creating a volume + * resource. + * + * @param {string} [volumeResourceDescription.description] User readable + * description of the volume. + * + * @param {object} [volumeResourceDescription.azureFileParameters] This type + * describes a volume provided by an Azure Files file share. + * + * @param {string} volumeResourceDescription.azureFileParameters.accountName + * Name of the Azure storage account for the File Share. + * + * @param {string} [volumeResourceDescription.azureFileParameters.accountKey] + * Access key of the Azure storage account for the File Share. + * + * @param {string} volumeResourceDescription.azureFileParameters.shareName Name + * of the Azure Files file share that provides storage for the volume. + * + * @param {object} [volumeResourceDescription.tags] Resource tags. + * + * @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. + */ + createWithHttpOperationResponse(resourceGroupName: string, volumeName: string, volumeResourceDescription: models.VolumeResourceDescription, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Creates or updates a volume resource. + * + * Creates a volume resource with the specified name and description. If a + * volume with the same name already exists, then its description is updated to + * the one indicated in this request. + * + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} volumeName The identity of the volume. + * + * @param {object} volumeResourceDescription Description for creating a volume + * resource. + * + * @param {string} [volumeResourceDescription.description] User readable + * description of the volume. + * + * @param {object} [volumeResourceDescription.azureFileParameters] This type + * describes a volume provided by an Azure Files file share. + * + * @param {string} volumeResourceDescription.azureFileParameters.accountName + * Name of the Azure storage account for the File Share. + * + * @param {string} [volumeResourceDescription.azureFileParameters.accountKey] + * Access key of the Azure storage account for the File Share. + * + * @param {string} volumeResourceDescription.azureFileParameters.shareName Name + * of the Azure Files file share that provides storage for the volume. + * + * @param {object} [volumeResourceDescription.tags] Resource tags. + * + * @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 {VolumeResourceDescription} - 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. + * + * {VolumeResourceDescription} [result] - The deserialized result object if an error did not occur. + * See {@link VolumeResourceDescription} 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. + */ + create(resourceGroupName: string, volumeName: string, volumeResourceDescription: models.VolumeResourceDescription, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, volumeName: string, volumeResourceDescription: models.VolumeResourceDescription, callback: ServiceCallback): void; + create(resourceGroupName: string, volumeName: string, volumeResourceDescription: models.VolumeResourceDescription, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Gets the volume resource. + * + * Gets the information about the volume resource with a given name. This + * information includes the volume description and other runtime information. + * + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} volumeName The identity of the volume. + * + * @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, volumeName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Gets the volume resource. + * + * Gets the information about the volume resource with a given name. This + * information includes the volume description and other runtime information. + * + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} volumeName The identity of the volume. + * + * @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 {VolumeResourceDescription} - 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. + * + * {VolumeResourceDescription} [result] - The deserialized result object if an error did not occur. + * See {@link VolumeResourceDescription} 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, volumeName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, volumeName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, volumeName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Deletes the volume resource. + * + * Deletes the volume identified by the name. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} volumeName The identity of the volume. + * + * @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, volumeName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Deletes the volume resource. + * + * Deletes the volume identified by the name. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} volumeName The identity of the volume. + * + * @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, volumeName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, volumeName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, volumeName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Gets all the volume resources in a given resource group. + * + * Gets the information about all volume resources in a given resource group. + * The information includes the volume description and other runtime + * information. + * + * + * @param {string} resourceGroupName Azure resource group name + * + * @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>; + + /** + * @summary Gets all the volume resources in a given resource group. + * + * Gets the information about all volume resources in a given resource group. + * The information includes the volume description and other runtime + * information. + * + * + * @param {string} resourceGroupName Azure resource group name + * + * @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 {VolumeResourceDescriptionList} - 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. + * + * {VolumeResourceDescriptionList} [result] - The deserialized result object if an error did not occur. + * See {@link VolumeResourceDescriptionList} 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; + + + /** + * @summary Gets all the volume resources in a given subscription. + * + * Gets the information about all volume resources in a given subscription. The + * information includes the volume description and other runtime information. + * + * + * @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. + */ + listBySubscriptionWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Gets all the volume resources in a given subscription. + * + * Gets the information about all volume resources in a given subscription. The + * information includes the volume description and other runtime information. + * + * + * @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 {VolumeResourceDescriptionList} - 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. + * + * {VolumeResourceDescriptionList} [result] - The deserialized result object if an error did not occur. + * See {@link VolumeResourceDescriptionList} 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. + */ + listBySubscription(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listBySubscription(callback: ServiceCallback): void; + listBySubscription(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * @summary Gets all the volume resources in a given resource group. + * + * Gets the information about all volume resources in a given resource group. + * The information includes the volume description and other runtime + * information. + * + * + * @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. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Gets all the volume resources in a given resource group. + * + * Gets the information about all volume resources in a given resource group. + * The information includes the volume description and other runtime + * information. + * + * + * @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 {VolumeResourceDescriptionList} - 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. + * + * {VolumeResourceDescriptionList} [result] - The deserialized result object if an error did not occur. + * See {@link VolumeResourceDescriptionList} 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. + */ + 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; + + + /** + * @summary Gets all the volume resources in a given subscription. + * + * Gets the information about all volume resources in a given subscription. The + * information includes the volume description and other runtime information. + * + * + * @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. + */ + listBySubscriptionNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Gets all the volume resources in a given subscription. + * + * Gets the information about all volume resources in a given subscription. The + * information includes the volume description and other runtime information. + * + * + * @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 {VolumeResourceDescriptionList} - 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. + * + * {VolumeResourceDescriptionList} [result] - The deserialized result object if an error did not occur. + * See {@link VolumeResourceDescriptionList} 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. + */ + listBySubscriptionNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listBySubscriptionNext(nextPageLink: string, callback: ServiceCallback): void; + listBySubscriptionNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} diff --git a/lib/services/serviceFabricMeshManagement/lib/operations/index.js b/lib/services/serviceFabricMeshManagement/lib/operations/index.js new file mode 100644 index 0000000000..05efe78f73 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/operations/index.js @@ -0,0 +1,23 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +exports.Application = require('./application'); +exports.Service = require('./service'); +exports.Replica = require('./replica'); +exports.CodePackage = require('./codePackage'); +exports.Operations = require('./operations'); +exports.Network = require('./network'); +exports.Volume = require('./volume'); diff --git a/lib/services/serviceFabricMeshManagement/lib/operations/network.js b/lib/services/serviceFabricMeshManagement/lib/operations/network.js new file mode 100644 index 0000000000..6ea7d1a621 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/operations/network.js @@ -0,0 +1,1758 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * @summary Creates or updates a network resource. + * + * Creates a network resource with the specified name and description. If a + * network with the same name already exists, then its description is updated + * to the one indicated in this request. + * + * Use network resources to create private network and configure public + * connectivity for services within your application. + * + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} networkName The identity of the network. + * + * @param {object} networkResourceDescription Description for creating a + * network resource. + * + * @param {string} [networkResourceDescription.description] User readable + * description of the network. + * + * @param {string} networkResourceDescription.addressPrefix the address prefix + * for this network. + * + * @param {object} [networkResourceDescription.ingressConfig] Configuration for + * public connectivity for this network. + * + * @param {string} [networkResourceDescription.ingressConfig.qosLevel] The QoS + * tier for ingress. Possible values include: 'Bronze' + * + * @param {array} [networkResourceDescription.ingressConfig.layer4] + * Configuration for layer4 public connectivity for this network. + * + * @param {object} [networkResourceDescription.tags] Resource tags. + * + * @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 NetworkResourceDescription} 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 _create(resourceGroupName, networkName, networkResourceDescription, 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 (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (networkName === null || networkName === undefined || typeof networkName.valueOf() !== 'string') { + throw new Error('networkName cannot be null or undefined and it must be of type string.'); + } + if (networkResourceDescription === null || networkResourceDescription === undefined) { + throw new Error('networkResourceDescription cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/networks/{networkName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{networkName}', networkName); + 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 (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 (networkResourceDescription !== null && networkResourceDescription !== undefined) { + let requestModelMapper = new client.models['NetworkResourceDescription']().mapper(); + requestModel = client.serialize(requestModelMapper, networkResourceDescription, 'networkResourceDescription'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(networkResourceDescription, 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['ErrorModel']().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['NetworkResourceDescription']().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['NetworkResourceDescription']().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); + }); +} + +/** + * @summary Gets the network resource. + * + * Gets the information about the network resource with a given name. This + * information includes the network description and other runtime information. + * + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} networkName The identity of the network. + * + * @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 NetworkResourceDescription} 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, networkName, 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 (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (networkName === null || networkName === undefined || typeof networkName.valueOf() !== 'string') { + throw new Error('networkName 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.ServiceFabricMesh/networks/{networkName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{networkName}', networkName); + 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['ErrorModel']().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['NetworkResourceDescription']().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); + }); +} + +/** + * @summary Deletes the network resource. + * + * Deletes the network resource identified by the name. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} networkName The identity of the network. + * + * @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, networkName, 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 (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (networkName === null || networkName === undefined || typeof networkName.valueOf() !== 'string') { + throw new Error('networkName 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.ServiceFabricMesh/networks/{networkName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{networkName}', networkName); + 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 (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 && 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['ErrorModel']().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); + }); +} + +/** + * @summary Gets all the network resources in a given resource group. + * + * Gets the information about all network resources in a given resource group. + * The information includes the network description and other runtime + * properties. + * + * + * @param {string} resourceGroupName Azure resource group name + * + * @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 NetworkResourceDescriptionList} 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 _listByResourceGroup(resourceGroupName, 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 (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (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.ServiceFabricMesh/networks'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + 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['ErrorModel']().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['NetworkResourceDescriptionList']().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); + }); +} + +/** + * @summary Gets all the network resources in a given subscription. + * + * Gets the information about all network resources in a given subscription. + * The information includes the network description and other runtime + * properties. + * + * @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 NetworkResourceDescriptionList} 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 _listBySubscription(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 (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}/providers/Microsoft.ServiceFabricMesh/networks'; + 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['ErrorModel']().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['NetworkResourceDescriptionList']().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); + }); +} + +/** + * @summary Gets all the network resources in a given resource group. + * + * Gets the information about all network resources in a given resource group. + * The information includes the network description and other runtime + * properties. + * + * + * @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 NetworkResourceDescriptionList} 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 _listByResourceGroupNext(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['ErrorModel']().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['NetworkResourceDescriptionList']().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); + }); +} + +/** + * @summary Gets all the network resources in a given subscription. + * + * Gets the information about all network resources in a given subscription. + * The information includes the network description and other runtime + * properties. + * + * @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 NetworkResourceDescriptionList} 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 _listBySubscriptionNext(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['ErrorModel']().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['NetworkResourceDescriptionList']().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 Network. */ +class Network { + /** + * Create a Network. + * @param {ServiceFabricMeshManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._create = _create; + this._get = _get; + this._deleteMethod = _deleteMethod; + this._listByResourceGroup = _listByResourceGroup; + this._listBySubscription = _listBySubscription; + this._listByResourceGroupNext = _listByResourceGroupNext; + this._listBySubscriptionNext = _listBySubscriptionNext; + } + + /** + * @summary Creates or updates a network resource. + * + * Creates a network resource with the specified name and description. If a + * network with the same name already exists, then its description is updated + * to the one indicated in this request. + * + * Use network resources to create private network and configure public + * connectivity for services within your application. + * + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} networkName The identity of the network. + * + * @param {object} networkResourceDescription Description for creating a + * network resource. + * + * @param {string} [networkResourceDescription.description] User readable + * description of the network. + * + * @param {string} networkResourceDescription.addressPrefix the address prefix + * for this network. + * + * @param {object} [networkResourceDescription.ingressConfig] Configuration for + * public connectivity for this network. + * + * @param {string} [networkResourceDescription.ingressConfig.qosLevel] The QoS + * tier for ingress. Possible values include: 'Bronze' + * + * @param {array} [networkResourceDescription.ingressConfig.layer4] + * Configuration for layer4 public connectivity for this network. + * + * @param {object} [networkResourceDescription.tags] Resource tags. + * + * @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. + */ + createWithHttpOperationResponse(resourceGroupName, networkName, networkResourceDescription, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._create(resourceGroupName, networkName, networkResourceDescription, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Creates or updates a network resource. + * + * Creates a network resource with the specified name and description. If a + * network with the same name already exists, then its description is updated + * to the one indicated in this request. + * + * Use network resources to create private network and configure public + * connectivity for services within your application. + * + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} networkName The identity of the network. + * + * @param {object} networkResourceDescription Description for creating a + * network resource. + * + * @param {string} [networkResourceDescription.description] User readable + * description of the network. + * + * @param {string} networkResourceDescription.addressPrefix the address prefix + * for this network. + * + * @param {object} [networkResourceDescription.ingressConfig] Configuration for + * public connectivity for this network. + * + * @param {string} [networkResourceDescription.ingressConfig.qosLevel] The QoS + * tier for ingress. Possible values include: 'Bronze' + * + * @param {array} [networkResourceDescription.ingressConfig.layer4] + * Configuration for layer4 public connectivity for this network. + * + * @param {object} [networkResourceDescription.tags] Resource tags. + * + * @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 {NetworkResourceDescription} - 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 NetworkResourceDescription} 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. + */ + create(resourceGroupName, networkName, networkResourceDescription, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._create(resourceGroupName, networkName, networkResourceDescription, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(resourceGroupName, networkName, networkResourceDescription, options, optionalCallback); + } + } + + /** + * @summary Gets the network resource. + * + * Gets the information about the network resource with a given name. This + * information includes the network description and other runtime information. + * + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} networkName The identity of the network. + * + * @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, networkName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, networkName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Gets the network resource. + * + * Gets the information about the network resource with a given name. This + * information includes the network description and other runtime information. + * + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} networkName The identity of the network. + * + * @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 {NetworkResourceDescription} - 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 NetworkResourceDescription} 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, networkName, 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, networkName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, networkName, options, optionalCallback); + } + } + + /** + * @summary Deletes the network resource. + * + * Deletes the network resource identified by the name. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} networkName The identity of the network. + * + * @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, networkName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, networkName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Deletes the network resource. + * + * Deletes the network resource identified by the name. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} networkName The identity of the network. + * + * @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, networkName, 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, networkName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, networkName, options, optionalCallback); + } + } + + /** + * @summary Gets all the network resources in a given resource group. + * + * Gets the information about all network resources in a given resource group. + * The information includes the network description and other runtime + * properties. + * + * + * @param {string} resourceGroupName Azure resource group name + * + * @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. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Gets all the network resources in a given resource group. + * + * Gets the information about all network resources in a given resource group. + * The information includes the network description and other runtime + * properties. + * + * + * @param {string} resourceGroupName Azure resource group name + * + * @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 {NetworkResourceDescriptionList} - 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 NetworkResourceDescriptionList} 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. + */ + listByResourceGroup(resourceGroupName, 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._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroup(resourceGroupName, options, optionalCallback); + } + } + + /** + * @summary Gets all the network resources in a given subscription. + * + * Gets the information about all network resources in a given subscription. + * The information includes the network description and other runtime + * properties. + * + * @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. + */ + listBySubscriptionWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listBySubscription(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Gets all the network resources in a given subscription. + * + * Gets the information about all network resources in a given subscription. + * The information includes the network description and other runtime + * properties. + * + * @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 {NetworkResourceDescriptionList} - 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 NetworkResourceDescriptionList} 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. + */ + listBySubscription(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._listBySubscription(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listBySubscription(options, optionalCallback); + } + } + + /** + * @summary Gets all the network resources in a given resource group. + * + * Gets the information about all network resources in a given resource group. + * The information includes the network description and other runtime + * properties. + * + * + * @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. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Gets all the network resources in a given resource group. + * + * Gets the information about all network resources in a given resource group. + * The information includes the network description and other runtime + * properties. + * + * + * @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 {NetworkResourceDescriptionList} - 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 NetworkResourceDescriptionList} 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. + */ + listByResourceGroupNext(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._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroupNext(nextPageLink, options, optionalCallback); + } + } + + /** + * @summary Gets all the network resources in a given subscription. + * + * Gets the information about all network resources in a given subscription. + * The information includes the network description and other runtime + * properties. + * + * @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. + */ + listBySubscriptionNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listBySubscriptionNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Gets all the network resources in a given subscription. + * + * Gets the information about all network resources in a given subscription. + * The information includes the network description and other runtime + * properties. + * + * @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 {NetworkResourceDescriptionList} - 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 NetworkResourceDescriptionList} 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. + */ + listBySubscriptionNext(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._listBySubscriptionNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listBySubscriptionNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = Network; diff --git a/lib/services/serviceFabricMeshManagement/lib/operations/operations.js b/lib/services/serviceFabricMeshManagement/lib/operations/operations.js new file mode 100644 index 0000000000..6df27fdfc5 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/operations/operations.js @@ -0,0 +1,466 @@ +/* + * 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; + +/** + * @summary Lists all of the available operations. + * + * Lists all the available operations provided by Service Fabric SeaBreeze + * resource provider. + * + * @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 OperationListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.ServiceFabricMesh/operations'; + 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['ErrorModel']().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['OperationListResult']().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); + }); +} + +/** + * @summary Lists all of the available operations. + * + * Lists all the available operations provided by Service Fabric SeaBreeze + * resource provider. + * + * @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 OperationListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // 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['ErrorModel']().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['OperationListResult']().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 Operations. */ +class Operations { + /** + * Create a Operations. + * @param {ServiceFabricMeshManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._listNext = _listNext; + } + + /** + * @summary Lists all of the available operations. + * + * Lists all the available operations provided by Service Fabric SeaBreeze + * resource provider. + * + * @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. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Lists all of the available operations. + * + * Lists all the available operations provided by Service Fabric SeaBreeze + * resource provider. + * + * @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 {OperationListResult} - 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 OperationListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(options, optionalCallback); + } + } + + /** + * @summary Lists all of the available operations. + * + * Lists all the available operations provided by Service Fabric SeaBreeze + * resource provider. + * + * @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. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Lists all of the available operations. + * + * Lists all the available operations provided by Service Fabric SeaBreeze + * resource provider. + * + * @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 {OperationListResult} - 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 OperationListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = Operations; diff --git a/lib/services/serviceFabricMeshManagement/lib/operations/replica.js b/lib/services/serviceFabricMeshManagement/lib/operations/replica.js new file mode 100644 index 0000000000..a1b4032aa9 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/operations/replica.js @@ -0,0 +1,767 @@ +/* + * 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; + +/** + * @summary Gets replicas of a given service. + * + * Gets the information about all replicas of a given service of an + * application. The information includes the runtime properties of the replica + * instance. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} applicationName The identity of the application. + * + * @param {string} serviceName The identity of the service. + * + * @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 ServiceReplicaList} 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 _listByServiceName(resourceGroupName, applicationName, serviceName, 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 (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (applicationName === null || applicationName === undefined || typeof applicationName.valueOf() !== 'string') { + throw new Error('applicationName 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 (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.ServiceFabricMesh/applications/{applicationName}/services/{serviceName}/replicas'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{applicationName}', applicationName); + requestUrl = requestUrl.replace('{serviceName}', serviceName); + 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = 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['ServiceReplicaList']().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); + }); +} + +/** + * @summary Gets a specific replica of a given service. + * + * Gets the information about the specified replica of a given service of an + * application. The information includes the runtime properties of the replica + * instance. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} applicationName The identity of the application. + * + * @param {string} serviceName The identity of the service. + * + * @param {string} replicaName The identity of the service replica. + * + * @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 ServiceReplicaDescription} 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, applicationName, serviceName, replicaName, 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 (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (applicationName === null || applicationName === undefined || typeof applicationName.valueOf() !== 'string') { + throw new Error('applicationName 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 (replicaName === null || replicaName === undefined || typeof replicaName.valueOf() !== 'string') { + throw new Error('replicaName 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.ServiceFabricMesh/applications/{applicationName}/services/{serviceName}/replicas/{replicaName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{applicationName}', applicationName); + requestUrl = requestUrl.replace('{serviceName}', serviceName); + requestUrl = requestUrl.replace('{replicaName}', replicaName); + 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = 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['ServiceReplicaDescription']().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); + }); +} + +/** + * @summary Gets replicas of a given service. + * + * Gets the information about all replicas of a given service of an + * application. The information includes the runtime properties of the replica + * 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 {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 ServiceReplicaList} 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 _listByServiceNameNext(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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = 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['ServiceReplicaList']().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 Replica. */ +class Replica { + /** + * Create a Replica. + * @param {ServiceFabricMeshManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listByServiceName = _listByServiceName; + this._get = _get; + this._listByServiceNameNext = _listByServiceNameNext; + } + + /** + * @summary Gets replicas of a given service. + * + * Gets the information about all replicas of a given service of an + * application. The information includes the runtime properties of the replica + * instance. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} applicationName The identity of the application. + * + * @param {string} serviceName The identity of the 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} - The error object. + */ + listByServiceNameWithHttpOperationResponse(resourceGroupName, applicationName, serviceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByServiceName(resourceGroupName, applicationName, serviceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Gets replicas of a given service. + * + * Gets the information about all replicas of a given service of an + * application. The information includes the runtime properties of the replica + * instance. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} applicationName The identity of the application. + * + * @param {string} serviceName The identity of the service. + * + * @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 {ServiceReplicaList} - 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 ServiceReplicaList} 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. + */ + listByServiceName(resourceGroupName, applicationName, serviceName, 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._listByServiceName(resourceGroupName, applicationName, serviceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByServiceName(resourceGroupName, applicationName, serviceName, options, optionalCallback); + } + } + + /** + * @summary Gets a specific replica of a given service. + * + * Gets the information about the specified replica of a given service of an + * application. The information includes the runtime properties of the replica + * instance. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} applicationName The identity of the application. + * + * @param {string} serviceName The identity of the service. + * + * @param {string} replicaName The identity of the service replica. + * + * @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, applicationName, serviceName, replicaName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, applicationName, serviceName, replicaName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Gets a specific replica of a given service. + * + * Gets the information about the specified replica of a given service of an + * application. The information includes the runtime properties of the replica + * instance. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} applicationName The identity of the application. + * + * @param {string} serviceName The identity of the service. + * + * @param {string} replicaName The identity of the service replica. + * + * @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 {ServiceReplicaDescription} - 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 ServiceReplicaDescription} 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, applicationName, serviceName, replicaName, 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, applicationName, serviceName, replicaName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, applicationName, serviceName, replicaName, options, optionalCallback); + } + } + + /** + * @summary Gets replicas of a given service. + * + * Gets the information about all replicas of a given service of an + * application. The information includes the runtime properties of the replica + * 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} - The error object. + */ + listByServiceNameNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByServiceNameNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Gets replicas of a given service. + * + * Gets the information about all replicas of a given service of an + * application. The information includes the runtime properties of the replica + * 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 {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 {ServiceReplicaList} - 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 ServiceReplicaList} 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. + */ + listByServiceNameNext(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._listByServiceNameNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByServiceNameNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = Replica; diff --git a/lib/services/serviceFabricMeshManagement/lib/operations/service.js b/lib/services/serviceFabricMeshManagement/lib/operations/service.js new file mode 100644 index 0000000000..897ac23711 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/operations/service.js @@ -0,0 +1,741 @@ +/* + * 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; + +/** + * @summary Gets services of a given application. + * + * Gets the information about all services of a given service of an + * application. The information includes the runtime properties of the service + * instance. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} applicationName The identity of the application. + * + * @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 ServiceList} 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 _listByApplicationName(resourceGroupName, applicationName, 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 (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (applicationName === null || applicationName === undefined || typeof applicationName.valueOf() !== 'string') { + throw new Error('applicationName 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.ServiceFabricMesh/applications/{applicationName}/services'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{applicationName}', applicationName); + 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = 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['ServiceList']().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); + }); +} + +/** + * @summary Gets the properties of the service. + * + * The operation returns the properties of the service. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} applicationName The identity of the application. + * + * @param {string} serviceName The identity of the service. + * + * @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 ServiceResourceDescription} 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, applicationName, serviceName, 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 (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (applicationName === null || applicationName === undefined || typeof applicationName.valueOf() !== 'string') { + throw new Error('applicationName 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 (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.ServiceFabricMesh/applications/{applicationName}/services/{serviceName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{applicationName}', applicationName); + requestUrl = requestUrl.replace('{serviceName}', serviceName); + 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = 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['ServiceResourceDescription']().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); + }); +} + +/** + * @summary Gets services of a given application. + * + * Gets the information about all services of a given service of an + * application. The information includes the runtime properties of the 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 {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 ServiceList} 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 _listByApplicationNameNext(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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = 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['ServiceList']().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 Service. */ +class Service { + /** + * Create a Service. + * @param {ServiceFabricMeshManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listByApplicationName = _listByApplicationName; + this._get = _get; + this._listByApplicationNameNext = _listByApplicationNameNext; + } + + /** + * @summary Gets services of a given application. + * + * Gets the information about all services of a given service of an + * application. The information includes the runtime properties of the service + * instance. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} applicationName The identity of the application. + * + * @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. + */ + listByApplicationNameWithHttpOperationResponse(resourceGroupName, applicationName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByApplicationName(resourceGroupName, applicationName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Gets services of a given application. + * + * Gets the information about all services of a given service of an + * application. The information includes the runtime properties of the service + * instance. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} applicationName The identity of the application. + * + * @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 {ServiceList} - 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 ServiceList} 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. + */ + listByApplicationName(resourceGroupName, applicationName, 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._listByApplicationName(resourceGroupName, applicationName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByApplicationName(resourceGroupName, applicationName, options, optionalCallback); + } + } + + /** + * @summary Gets the properties of the service. + * + * The operation returns the properties of the service. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} applicationName The identity of the application. + * + * @param {string} serviceName The identity of the 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} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, applicationName, serviceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, applicationName, serviceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Gets the properties of the service. + * + * The operation returns the properties of the service. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} applicationName The identity of the application. + * + * @param {string} serviceName The identity of the service. + * + * @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 {ServiceResourceDescription} - 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 ServiceResourceDescription} 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, applicationName, serviceName, 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, applicationName, serviceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, applicationName, serviceName, options, optionalCallback); + } + } + + /** + * @summary Gets services of a given application. + * + * Gets the information about all services of a given service of an + * application. The information includes the runtime properties of the 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} - The error object. + */ + listByApplicationNameNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByApplicationNameNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Gets services of a given application. + * + * Gets the information about all services of a given service of an + * application. The information includes the runtime properties of the 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 {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 {ServiceList} - 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 ServiceList} 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. + */ + listByApplicationNameNext(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._listByApplicationNameNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByApplicationNameNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = Service; diff --git a/lib/services/serviceFabricMeshManagement/lib/operations/volume.js b/lib/services/serviceFabricMeshManagement/lib/operations/volume.js new file mode 100644 index 0000000000..c92dfd3638 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/operations/volume.js @@ -0,0 +1,1753 @@ +/* + * 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; + +/** + * @summary Creates or updates a volume resource. + * + * Creates a volume resource with the specified name and description. If a + * volume with the same name already exists, then its description is updated to + * the one indicated in this request. + * + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} volumeName The identity of the volume. + * + * @param {object} volumeResourceDescription Description for creating a volume + * resource. + * + * @param {string} [volumeResourceDescription.description] User readable + * description of the volume. + * + * @param {object} [volumeResourceDescription.azureFileParameters] This type + * describes a volume provided by an Azure Files file share. + * + * @param {string} volumeResourceDescription.azureFileParameters.accountName + * Name of the Azure storage account for the File Share. + * + * @param {string} [volumeResourceDescription.azureFileParameters.accountKey] + * Access key of the Azure storage account for the File Share. + * + * @param {string} volumeResourceDescription.azureFileParameters.shareName Name + * of the Azure Files file share that provides storage for the volume. + * + * @param {object} [volumeResourceDescription.tags] Resource tags. + * + * @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 VolumeResourceDescription} 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 _create(resourceGroupName, volumeName, volumeResourceDescription, 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.'); + } + if (volumeResourceDescription === null || volumeResourceDescription === undefined) + { + volumeResourceDescription = {}; + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (volumeName === null || volumeName === undefined || typeof volumeName.valueOf() !== 'string') { + throw new Error('volumeName cannot be null or undefined and it must be of type string.'); + } + if (volumeResourceDescription === null || volumeResourceDescription === undefined) { + throw new Error('volumeResourceDescription cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabricMesh/volumes/{volumeName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{volumeName}', volumeName); + 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 (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 (volumeResourceDescription !== null && volumeResourceDescription !== undefined) { + let requestModelMapper = new client.models['VolumeResourceDescription']().mapper(); + requestModel = client.serialize(requestModelMapper, volumeResourceDescription, 'volumeResourceDescription'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(volumeResourceDescription, 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['ErrorModel']().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['VolumeResourceDescription']().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['VolumeResourceDescription']().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); + }); +} + +/** + * @summary Gets the volume resource. + * + * Gets the information about the volume resource with a given name. This + * information includes the volume description and other runtime information. + * + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} volumeName The identity of the volume. + * + * @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 VolumeResourceDescription} 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, volumeName, 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 (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (volumeName === null || volumeName === undefined || typeof volumeName.valueOf() !== 'string') { + throw new Error('volumeName 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.ServiceFabricMesh/volumes/{volumeName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{volumeName}', volumeName); + 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['ErrorModel']().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['VolumeResourceDescription']().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); + }); +} + +/** + * @summary Deletes the volume resource. + * + * Deletes the volume identified by the name. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} volumeName The identity of the volume. + * + * @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, volumeName, 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 (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (volumeName === null || volumeName === undefined || typeof volumeName.valueOf() !== 'string') { + throw new Error('volumeName 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.ServiceFabricMesh/volumes/{volumeName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{volumeName}', volumeName); + 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 (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 && 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['ErrorModel']().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); + }); +} + +/** + * @summary Gets all the volume resources in a given resource group. + * + * Gets the information about all volume resources in a given resource group. + * The information includes the volume description and other runtime + * information. + * + * + * @param {string} resourceGroupName Azure resource group name + * + * @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 VolumeResourceDescriptionList} 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 _listByResourceGroup(resourceGroupName, 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 (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (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.ServiceFabricMesh/volumes'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + 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['ErrorModel']().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['VolumeResourceDescriptionList']().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); + }); +} + +/** + * @summary Gets all the volume resources in a given subscription. + * + * Gets the information about all volume resources in a given subscription. The + * information includes the volume description and other runtime information. + * + * + * @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 VolumeResourceDescriptionList} 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 _listBySubscription(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 (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}/providers/Microsoft.ServiceFabricMesh/volumes'; + 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['ErrorModel']().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['VolumeResourceDescriptionList']().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); + }); +} + +/** + * @summary Gets all the volume resources in a given resource group. + * + * Gets the information about all volume resources in a given resource group. + * The information includes the volume description and other runtime + * information. + * + * + * @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 VolumeResourceDescriptionList} 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 _listByResourceGroupNext(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['ErrorModel']().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['VolumeResourceDescriptionList']().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); + }); +} + +/** + * @summary Gets all the volume resources in a given subscription. + * + * Gets the information about all volume resources in a given subscription. The + * information includes the volume description and other runtime information. + * + * + * @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 VolumeResourceDescriptionList} 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 _listBySubscriptionNext(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['ErrorModel']().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['VolumeResourceDescriptionList']().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 Volume. */ +class Volume { + /** + * Create a Volume. + * @param {ServiceFabricMeshManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._create = _create; + this._get = _get; + this._deleteMethod = _deleteMethod; + this._listByResourceGroup = _listByResourceGroup; + this._listBySubscription = _listBySubscription; + this._listByResourceGroupNext = _listByResourceGroupNext; + this._listBySubscriptionNext = _listBySubscriptionNext; + } + + /** + * @summary Creates or updates a volume resource. + * + * Creates a volume resource with the specified name and description. If a + * volume with the same name already exists, then its description is updated to + * the one indicated in this request. + * + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} volumeName The identity of the volume. + * + * @param {object} volumeResourceDescription Description for creating a volume + * resource. + * + * @param {string} [volumeResourceDescription.description] User readable + * description of the volume. + * + * @param {object} [volumeResourceDescription.azureFileParameters] This type + * describes a volume provided by an Azure Files file share. + * + * @param {string} volumeResourceDescription.azureFileParameters.accountName + * Name of the Azure storage account for the File Share. + * + * @param {string} [volumeResourceDescription.azureFileParameters.accountKey] + * Access key of the Azure storage account for the File Share. + * + * @param {string} volumeResourceDescription.azureFileParameters.shareName Name + * of the Azure Files file share that provides storage for the volume. + * + * @param {object} [volumeResourceDescription.tags] Resource tags. + * + * @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. + */ + createWithHttpOperationResponse(resourceGroupName, volumeName, volumeResourceDescription, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._create(resourceGroupName, volumeName, volumeResourceDescription, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Creates or updates a volume resource. + * + * Creates a volume resource with the specified name and description. If a + * volume with the same name already exists, then its description is updated to + * the one indicated in this request. + * + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} volumeName The identity of the volume. + * + * @param {object} volumeResourceDescription Description for creating a volume + * resource. + * + * @param {string} [volumeResourceDescription.description] User readable + * description of the volume. + * + * @param {object} [volumeResourceDescription.azureFileParameters] This type + * describes a volume provided by an Azure Files file share. + * + * @param {string} volumeResourceDescription.azureFileParameters.accountName + * Name of the Azure storage account for the File Share. + * + * @param {string} [volumeResourceDescription.azureFileParameters.accountKey] + * Access key of the Azure storage account for the File Share. + * + * @param {string} volumeResourceDescription.azureFileParameters.shareName Name + * of the Azure Files file share that provides storage for the volume. + * + * @param {object} [volumeResourceDescription.tags] Resource tags. + * + * @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 {VolumeResourceDescription} - 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 VolumeResourceDescription} 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. + */ + create(resourceGroupName, volumeName, volumeResourceDescription, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._create(resourceGroupName, volumeName, volumeResourceDescription, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(resourceGroupName, volumeName, volumeResourceDescription, options, optionalCallback); + } + } + + /** + * @summary Gets the volume resource. + * + * Gets the information about the volume resource with a given name. This + * information includes the volume description and other runtime information. + * + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} volumeName The identity of the volume. + * + * @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, volumeName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, volumeName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Gets the volume resource. + * + * Gets the information about the volume resource with a given name. This + * information includes the volume description and other runtime information. + * + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} volumeName The identity of the volume. + * + * @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 {VolumeResourceDescription} - 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 VolumeResourceDescription} 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, volumeName, 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, volumeName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, volumeName, options, optionalCallback); + } + } + + /** + * @summary Deletes the volume resource. + * + * Deletes the volume identified by the name. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} volumeName The identity of the volume. + * + * @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, volumeName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, volumeName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Deletes the volume resource. + * + * Deletes the volume identified by the name. + * + * @param {string} resourceGroupName Azure resource group name + * + * @param {string} volumeName The identity of the volume. + * + * @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, volumeName, 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, volumeName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, volumeName, options, optionalCallback); + } + } + + /** + * @summary Gets all the volume resources in a given resource group. + * + * Gets the information about all volume resources in a given resource group. + * The information includes the volume description and other runtime + * information. + * + * + * @param {string} resourceGroupName Azure resource group name + * + * @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. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Gets all the volume resources in a given resource group. + * + * Gets the information about all volume resources in a given resource group. + * The information includes the volume description and other runtime + * information. + * + * + * @param {string} resourceGroupName Azure resource group name + * + * @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 {VolumeResourceDescriptionList} - 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 VolumeResourceDescriptionList} 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. + */ + listByResourceGroup(resourceGroupName, 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._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroup(resourceGroupName, options, optionalCallback); + } + } + + /** + * @summary Gets all the volume resources in a given subscription. + * + * Gets the information about all volume resources in a given subscription. The + * information includes the volume description and other runtime information. + * + * + * @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. + */ + listBySubscriptionWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listBySubscription(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Gets all the volume resources in a given subscription. + * + * Gets the information about all volume resources in a given subscription. The + * information includes the volume description and other runtime information. + * + * + * @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 {VolumeResourceDescriptionList} - 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 VolumeResourceDescriptionList} 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. + */ + listBySubscription(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._listBySubscription(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listBySubscription(options, optionalCallback); + } + } + + /** + * @summary Gets all the volume resources in a given resource group. + * + * Gets the information about all volume resources in a given resource group. + * The information includes the volume description and other runtime + * information. + * + * + * @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. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Gets all the volume resources in a given resource group. + * + * Gets the information about all volume resources in a given resource group. + * The information includes the volume description and other runtime + * information. + * + * + * @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 {VolumeResourceDescriptionList} - 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 VolumeResourceDescriptionList} 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. + */ + listByResourceGroupNext(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._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroupNext(nextPageLink, options, optionalCallback); + } + } + + /** + * @summary Gets all the volume resources in a given subscription. + * + * Gets the information about all volume resources in a given subscription. The + * information includes the volume description and other runtime information. + * + * + * @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. + */ + listBySubscriptionNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listBySubscriptionNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * @summary Gets all the volume resources in a given subscription. + * + * Gets the information about all volume resources in a given subscription. The + * information includes the volume description and other runtime information. + * + * + * @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 {VolumeResourceDescriptionList} - 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 VolumeResourceDescriptionList} 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. + */ + listBySubscriptionNext(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._listBySubscriptionNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listBySubscriptionNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = Volume; diff --git a/lib/services/serviceFabricMeshManagement/lib/serviceFabricMeshManagementClient.d.ts b/lib/services/serviceFabricMeshManagement/lib/serviceFabricMeshManagementClient.d.ts new file mode 100644 index 0000000000..9f2f122656 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/serviceFabricMeshManagementClient.d.ts @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import { ServiceClientCredentials } from 'ms-rest'; +import { AzureServiceClient, AzureServiceClientOptions } from 'ms-rest-azure'; +import * as models from "./models"; +import * as operations from "./operations"; + +export default class ServiceFabricMeshManagementClient extends AzureServiceClient { + /** + * Initializes a new instance of the ServiceFabricMeshManagementClient class. + * @constructor + * + * @class + * @param {credentials} credentials - Credentials needed for the client to connect to Azure. + * + * @param {string} subscriptionId - The customer subscription identifier + * + * @param {string} [baseUri] - The base URI of the service. + * + * @param {object} [options] - The parameter options + * + * @param {Array} [options.filters] - Filters to be added to the request pipeline + * + * @param {object} [options.requestOptions] - Options for the underlying request object + * {@link https://github.com/request/request#requestoptions-callback Options doc} + * + * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy + * + * @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response. + * + * @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + */ + constructor(credentials: ServiceClientCredentials, subscriptionId: string, baseUri?: string, options?: AzureServiceClientOptions); + + credentials: ServiceClientCredentials; + + apiVersion: string; + + subscriptionId: string; + + acceptLanguage: string; + + longRunningOperationRetryTimeout: number; + + generateClientRequestId: boolean; + + // Operation groups + application: operations.Application; + service: operations.Service; + replica: operations.Replica; + codePackage: operations.CodePackage; + operations: operations.Operations; + network: operations.Network; + volume: operations.Volume; +} + +export { ServiceFabricMeshManagementClient, models as ServiceFabricMeshManagementModels }; diff --git a/lib/services/serviceFabricMeshManagement/lib/serviceFabricMeshManagementClient.js b/lib/services/serviceFabricMeshManagement/lib/serviceFabricMeshManagementClient.js new file mode 100644 index 0000000000..965f1cd402 --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/lib/serviceFabricMeshManagementClient.js @@ -0,0 +1,91 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const ServiceClient = msRestAzure.AzureServiceClient; + +const models = require('./models'); +const operations = require('./operations'); + + +/** Class representing a ServiceFabricMeshManagementClient. */ +class ServiceFabricMeshManagementClient extends ServiceClient { + /** + * Create a ServiceFabricMeshManagementClient. + * @param {credentials} credentials - Credentials needed for the client to connect to Azure. + * @param {string} subscriptionId - The customer subscription identifier + * @param {string} [baseUri] - The base URI of the service. + * @param {object} [options] - The parameter options + * @param {Array} [options.filters] - Filters to be added to the request pipeline + * @param {object} [options.requestOptions] - Options for the underlying request object + * {@link https://github.com/request/request#requestoptions-callback Options doc} + * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy + * @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response. + * @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + */ + constructor(credentials, subscriptionId, baseUri, options) { + if (credentials === null || credentials === undefined) { + throw new Error('\'credentials\' cannot be null.'); + } + if (subscriptionId === null || subscriptionId === undefined) { + throw new Error('\'subscriptionId\' cannot be null.'); + } + + if (!options) options = {}; + + super(credentials, options); + + this.apiVersion = '2018-07-01-preview'; + this.acceptLanguage = 'en-US'; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.baseUri = baseUri; + if (!this.baseUri) { + this.baseUri = 'https://management.azure.com'; + } + this.credentials = credentials; + this.subscriptionId = subscriptionId; + + let packageInfo = this.getPackageJsonInfo(__dirname); + this.addUserAgentInfo(`${packageInfo.name}/${packageInfo.version}`); + if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { + this.acceptLanguage = options.acceptLanguage; + } + if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { + this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; + } + if(options.generateClientRequestId !== null && options.generateClientRequestId !== undefined) { + this.generateClientRequestId = options.generateClientRequestId; + } + this.application = new operations.Application(this); + this.service = new operations.Service(this); + this.replica = new operations.Replica(this); + this.codePackage = new operations.CodePackage(this); + this.operations = new operations.Operations(this); + this.network = new operations.Network(this); + this.volume = new operations.Volume(this); + this.models = models; + msRest.addSerializationMixin(this); + } + +} + +module.exports = ServiceFabricMeshManagementClient; +module.exports['default'] = ServiceFabricMeshManagementClient; +module.exports.ServiceFabricMeshManagementClient = ServiceFabricMeshManagementClient; +module.exports.ServiceFabricMeshManagementModels = models; diff --git a/lib/services/serviceFabricMeshManagement/package.json b/lib/services/serviceFabricMeshManagement/package.json new file mode 100644 index 0000000000..12328c3f3e --- /dev/null +++ b/lib/services/serviceFabricMeshManagement/package.json @@ -0,0 +1,25 @@ +{ + "name": "azure-arm-servicefabricmesh", + "author": "Microsoft Corporation", + "description": "ServiceFabricMeshManagementClient Library with typescript type definitions for node", + "version": "1.0.0-preview", + "dependencies": { + "ms-rest": "^2.3.3", + "ms-rest-azure": "^2.5.5" + }, + "keywords": [ + "node", + "azure" + ], + "license": "MIT", + "main": "./lib/serviceFabricMeshManagementClient.js", + "types": "./lib/serviceFabricMeshManagementClient.d.ts", + "homepage": "http://github.com/azure/azure-sdk-for-node", + "repository": { + "type": "git", + "url": "https://github.com/azure/azure-sdk-for-node.git" + }, + "bugs": { + "url": "http://github.com/Azure/azure-sdk-for-node/issues" + } +}