diff --git a/lib/services/automationManagement/lib/LICENSE.txt b/lib/services/automationManagement/lib/LICENSE.txt new file mode 100644 index 0000000000..5431ba98b9 --- /dev/null +++ b/lib/services/automationManagement/lib/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/automationManagement/lib/automationClient.d.ts b/lib/services/automationManagement/lib/automationClient.d.ts index f52b909b93..27ddad23f6 100644 --- a/lib/services/automationManagement/lib/automationClient.d.ts +++ b/lib/services/automationManagement/lib/automationClient.d.ts @@ -10,9 +10,10 @@ import { ServiceClientCredentials } from 'ms-rest'; import { AzureServiceClient, AzureServiceClientOptions } from 'ms-rest-azure'; +import * as models from "./models"; import * as operations from "./operations"; -declare class AutomationClient extends AzureServiceClient { +export default class AutomationClient extends AzureServiceClient { /** * Initializes a new instance of the AutomationClient class. * @constructor @@ -44,8 +45,6 @@ declare class AutomationClient extends AzureServiceClient { credentials: ServiceClientCredentials; - apiVersion: string; - subscriptionId: string; acceptLanguage: string; @@ -59,20 +58,15 @@ declare class AutomationClient extends AzureServiceClient { operations: operations.Operations; statisticsOperations: operations.StatisticsOperations; usages: operations.Usages; + keys: operations.Keys; certificateOperations: operations.CertificateOperations; connectionOperations: operations.ConnectionOperations; connectionTypeOperations: operations.ConnectionTypeOperations; credentialOperations: operations.CredentialOperations; - dscCompilationJobOperations: operations.DscCompilationJobOperations; dscConfigurationOperations: operations.DscConfigurationOperations; - agentRegistrationInformation: operations.AgentRegistrationInformation; - dscNodeOperations: operations.DscNodeOperations; - nodeReports: operations.NodeReports; - dscNodeConfigurationOperations: operations.DscNodeConfigurationOperations; hybridRunbookWorkerGroupOperations: operations.HybridRunbookWorkerGroupOperations; - jobOperations: operations.JobOperations; - jobStreamOperations: operations.JobStreamOperations; jobScheduleOperations: operations.JobScheduleOperations; + linkedWorkspaceOperations: operations.LinkedWorkspaceOperations; activityOperations: operations.ActivityOperations; moduleOperations: operations.ModuleOperations; objectDataTypes: operations.ObjectDataTypes; @@ -80,10 +74,23 @@ declare class AutomationClient extends AzureServiceClient { runbookDraftOperations: operations.RunbookDraftOperations; runbookOperations: operations.RunbookOperations; testJobStreams: operations.TestJobStreams; - testJobs: operations.TestJobs; + testJobOperations: operations.TestJobOperations; scheduleOperations: operations.ScheduleOperations; variableOperations: operations.VariableOperations; webhookOperations: operations.WebhookOperations; + softwareUpdateConfigurations: operations.SoftwareUpdateConfigurations; + softwareUpdateConfigurationRuns: operations.SoftwareUpdateConfigurationRuns; + softwareUpdateConfigurationMachineRuns: operations.SoftwareUpdateConfigurationMachineRuns; + sourceControlOperations: operations.SourceControlOperations; + sourceControlSyncJobOperations: operations.SourceControlSyncJobOperations; + jobOperations: operations.JobOperations; + jobStreamOperations: operations.JobStreamOperations; + agentRegistrationInformation: operations.AgentRegistrationInformation; + dscNodeOperations: operations.DscNodeOperations; + nodeReports: operations.NodeReports; + dscCompilationJobOperations: operations.DscCompilationJobOperations; + dscCompilationJobStream: operations.DscCompilationJobStream; + dscNodeConfigurationOperations: operations.DscNodeConfigurationOperations; } -export = AutomationClient; +export { AutomationClient, models as AutomationModels }; diff --git a/lib/services/automationManagement/lib/automationClient.js b/lib/services/automationManagement/lib/automationClient.js index 123c18aca9..569bd56c6e 100644 --- a/lib/services/automationManagement/lib/automationClient.js +++ b/lib/services/automationManagement/lib/automationClient.js @@ -50,7 +50,6 @@ class AutomationClient extends ServiceClient { super(credentials, options); - this.apiVersion = '2015-10-31'; this.acceptLanguage = 'en-US'; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; @@ -76,20 +75,15 @@ class AutomationClient extends ServiceClient { this.operations = new operations.Operations(this); this.statisticsOperations = new operations.StatisticsOperations(this); this.usages = new operations.Usages(this); + this.keys = new operations.Keys(this); this.certificateOperations = new operations.CertificateOperations(this); this.connectionOperations = new operations.ConnectionOperations(this); this.connectionTypeOperations = new operations.ConnectionTypeOperations(this); this.credentialOperations = new operations.CredentialOperations(this); - this.dscCompilationJobOperations = new operations.DscCompilationJobOperations(this); this.dscConfigurationOperations = new operations.DscConfigurationOperations(this); - this.agentRegistrationInformation = new operations.AgentRegistrationInformation(this); - this.dscNodeOperations = new operations.DscNodeOperations(this); - this.nodeReports = new operations.NodeReports(this); - this.dscNodeConfigurationOperations = new operations.DscNodeConfigurationOperations(this); this.hybridRunbookWorkerGroupOperations = new operations.HybridRunbookWorkerGroupOperations(this); - this.jobOperations = new operations.JobOperations(this); - this.jobStreamOperations = new operations.JobStreamOperations(this); this.jobScheduleOperations = new operations.JobScheduleOperations(this); + this.linkedWorkspaceOperations = new operations.LinkedWorkspaceOperations(this); this.activityOperations = new operations.ActivityOperations(this); this.moduleOperations = new operations.ModuleOperations(this); this.objectDataTypes = new operations.ObjectDataTypes(this); @@ -97,10 +91,23 @@ class AutomationClient extends ServiceClient { this.runbookDraftOperations = new operations.RunbookDraftOperations(this); this.runbookOperations = new operations.RunbookOperations(this); this.testJobStreams = new operations.TestJobStreams(this); - this.testJobs = new operations.TestJobs(this); + this.testJobOperations = new operations.TestJobOperations(this); this.scheduleOperations = new operations.ScheduleOperations(this); this.variableOperations = new operations.VariableOperations(this); this.webhookOperations = new operations.WebhookOperations(this); + this.softwareUpdateConfigurations = new operations.SoftwareUpdateConfigurations(this); + this.softwareUpdateConfigurationRuns = new operations.SoftwareUpdateConfigurationRuns(this); + this.softwareUpdateConfigurationMachineRuns = new operations.SoftwareUpdateConfigurationMachineRuns(this); + this.sourceControlOperations = new operations.SourceControlOperations(this); + this.sourceControlSyncJobOperations = new operations.SourceControlSyncJobOperations(this); + this.jobOperations = new operations.JobOperations(this); + this.jobStreamOperations = new operations.JobStreamOperations(this); + this.agentRegistrationInformation = new operations.AgentRegistrationInformation(this); + this.dscNodeOperations = new operations.DscNodeOperations(this); + this.nodeReports = new operations.NodeReports(this); + this.dscCompilationJobOperations = new operations.DscCompilationJobOperations(this); + this.dscCompilationJobStream = new operations.DscCompilationJobStream(this); + this.dscNodeConfigurationOperations = new operations.DscNodeConfigurationOperations(this); this.models = models; msRest.addSerializationMixin(this); } @@ -108,3 +115,6 @@ class AutomationClient extends ServiceClient { } module.exports = AutomationClient; +module.exports['default'] = AutomationClient; +module.exports.AutomationClient = AutomationClient; +module.exports.AutomationModels = models; diff --git a/lib/services/automationManagement/lib/lib/automationClient.d.ts b/lib/services/automationManagement/lib/lib/automationClient.d.ts new file mode 100644 index 0000000000..27ddad23f6 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/automationClient.d.ts @@ -0,0 +1,96 @@ +/* + * 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 AutomationClient extends AzureServiceClient { + /** + * Initializes a new instance of the AutomationClient class. + * @constructor + * + * @class + * @param {credentials} credentials - Credentials needed for the client to connect to Azure. + * + * @param {string} subscriptionId - Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * + * @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; + + subscriptionId: string; + + acceptLanguage: string; + + longRunningOperationRetryTimeout: number; + + generateClientRequestId: boolean; + + // Operation groups + automationAccountOperations: operations.AutomationAccountOperations; + operations: operations.Operations; + statisticsOperations: operations.StatisticsOperations; + usages: operations.Usages; + keys: operations.Keys; + certificateOperations: operations.CertificateOperations; + connectionOperations: operations.ConnectionOperations; + connectionTypeOperations: operations.ConnectionTypeOperations; + credentialOperations: operations.CredentialOperations; + dscConfigurationOperations: operations.DscConfigurationOperations; + hybridRunbookWorkerGroupOperations: operations.HybridRunbookWorkerGroupOperations; + jobScheduleOperations: operations.JobScheduleOperations; + linkedWorkspaceOperations: operations.LinkedWorkspaceOperations; + activityOperations: operations.ActivityOperations; + moduleOperations: operations.ModuleOperations; + objectDataTypes: operations.ObjectDataTypes; + fields: operations.Fields; + runbookDraftOperations: operations.RunbookDraftOperations; + runbookOperations: operations.RunbookOperations; + testJobStreams: operations.TestJobStreams; + testJobOperations: operations.TestJobOperations; + scheduleOperations: operations.ScheduleOperations; + variableOperations: operations.VariableOperations; + webhookOperations: operations.WebhookOperations; + softwareUpdateConfigurations: operations.SoftwareUpdateConfigurations; + softwareUpdateConfigurationRuns: operations.SoftwareUpdateConfigurationRuns; + softwareUpdateConfigurationMachineRuns: operations.SoftwareUpdateConfigurationMachineRuns; + sourceControlOperations: operations.SourceControlOperations; + sourceControlSyncJobOperations: operations.SourceControlSyncJobOperations; + jobOperations: operations.JobOperations; + jobStreamOperations: operations.JobStreamOperations; + agentRegistrationInformation: operations.AgentRegistrationInformation; + dscNodeOperations: operations.DscNodeOperations; + nodeReports: operations.NodeReports; + dscCompilationJobOperations: operations.DscCompilationJobOperations; + dscCompilationJobStream: operations.DscCompilationJobStream; + dscNodeConfigurationOperations: operations.DscNodeConfigurationOperations; +} + +export { AutomationClient, models as AutomationModels }; diff --git a/lib/services/automationManagement/lib/lib/automationClient.js b/lib/services/automationManagement/lib/lib/automationClient.js new file mode 100644 index 0000000000..569bd56c6e --- /dev/null +++ b/lib/services/automationManagement/lib/lib/automationClient.js @@ -0,0 +1,120 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +/* 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 AutomationClient. */ +class AutomationClient extends ServiceClient { + /** + * Create a AutomationClient. + * @param {credentials} credentials - Credentials needed for the client to connect to Azure. + * @param {string} subscriptionId - Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * @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.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.automationAccountOperations = new operations.AutomationAccountOperations(this); + this.operations = new operations.Operations(this); + this.statisticsOperations = new operations.StatisticsOperations(this); + this.usages = new operations.Usages(this); + this.keys = new operations.Keys(this); + this.certificateOperations = new operations.CertificateOperations(this); + this.connectionOperations = new operations.ConnectionOperations(this); + this.connectionTypeOperations = new operations.ConnectionTypeOperations(this); + this.credentialOperations = new operations.CredentialOperations(this); + this.dscConfigurationOperations = new operations.DscConfigurationOperations(this); + this.hybridRunbookWorkerGroupOperations = new operations.HybridRunbookWorkerGroupOperations(this); + this.jobScheduleOperations = new operations.JobScheduleOperations(this); + this.linkedWorkspaceOperations = new operations.LinkedWorkspaceOperations(this); + this.activityOperations = new operations.ActivityOperations(this); + this.moduleOperations = new operations.ModuleOperations(this); + this.objectDataTypes = new operations.ObjectDataTypes(this); + this.fields = new operations.Fields(this); + this.runbookDraftOperations = new operations.RunbookDraftOperations(this); + this.runbookOperations = new operations.RunbookOperations(this); + this.testJobStreams = new operations.TestJobStreams(this); + this.testJobOperations = new operations.TestJobOperations(this); + this.scheduleOperations = new operations.ScheduleOperations(this); + this.variableOperations = new operations.VariableOperations(this); + this.webhookOperations = new operations.WebhookOperations(this); + this.softwareUpdateConfigurations = new operations.SoftwareUpdateConfigurations(this); + this.softwareUpdateConfigurationRuns = new operations.SoftwareUpdateConfigurationRuns(this); + this.softwareUpdateConfigurationMachineRuns = new operations.SoftwareUpdateConfigurationMachineRuns(this); + this.sourceControlOperations = new operations.SourceControlOperations(this); + this.sourceControlSyncJobOperations = new operations.SourceControlSyncJobOperations(this); + this.jobOperations = new operations.JobOperations(this); + this.jobStreamOperations = new operations.JobStreamOperations(this); + this.agentRegistrationInformation = new operations.AgentRegistrationInformation(this); + this.dscNodeOperations = new operations.DscNodeOperations(this); + this.nodeReports = new operations.NodeReports(this); + this.dscCompilationJobOperations = new operations.DscCompilationJobOperations(this); + this.dscCompilationJobStream = new operations.DscCompilationJobStream(this); + this.dscNodeConfigurationOperations = new operations.DscNodeConfigurationOperations(this); + this.models = models; + msRest.addSerializationMixin(this); + } + +} + +module.exports = AutomationClient; +module.exports['default'] = AutomationClient; +module.exports.AutomationClient = AutomationClient; +module.exports.AutomationModels = models; diff --git a/lib/services/automationManagement/lib/lib/models/activity.js b/lib/services/automationManagement/lib/lib/models/activity.js new file mode 100644 index 0000000000..414141b051 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/activity.js @@ -0,0 +1,129 @@ +/* + * 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'); + +/** + * Definition of the activity. + * + */ +class Activity { + /** + * Create a Activity. + * @member {string} [id] Gets or sets the id of the resource. + * @member {string} [name] Gets the name of the activity. + * @member {string} [definition] Gets or sets the user name of the activity. + * @member {array} [parameterSets] Gets or sets the parameter sets of the + * activity. + * @member {array} [outputTypes] Gets or sets the output types of the + * activity. + * @member {date} [creationTime] Gets or sets the creation time. + * @member {date} [lastModifiedTime] Gets or sets the last modified time. + * @member {string} [description] Gets or sets the description. + */ + constructor() { + } + + /** + * Defines the metadata of Activity + * + * @returns {object} metadata of Activity + * + */ + mapper() { + return { + required: false, + serializedName: 'Activity', + type: { + name: 'Composite', + className: 'Activity', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + definition: { + required: false, + serializedName: 'properties.definition', + type: { + name: 'String' + } + }, + parameterSets: { + required: false, + serializedName: 'properties.parameterSets', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ActivityParameterSetElementType', + type: { + name: 'Composite', + className: 'ActivityParameterSet' + } + } + } + }, + outputTypes: { + required: false, + serializedName: 'properties.outputTypes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ActivityOutputTypeElementType', + type: { + name: 'Composite', + className: 'ActivityOutputType' + } + } + } + }, + creationTime: { + required: false, + serializedName: 'properties.creationTime', + type: { + name: 'DateTime' + } + }, + lastModifiedTime: { + required: false, + serializedName: 'properties.lastModifiedTime', + type: { + name: 'DateTime' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Activity; diff --git a/lib/services/automationManagement/lib/lib/models/activityListResult.js b/lib/services/automationManagement/lib/lib/models/activityListResult.js new file mode 100644 index 0000000000..ad95309da3 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/activityListResult.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'; + +/** + * The response model for the list activity operation. + */ +class ActivityListResult extends Array { + /** + * Create a ActivityListResult. + * @member {string} [nextLink] Gets or sets the next link. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ActivityListResult + * + * @returns {object} metadata of ActivityListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ActivityListResult', + type: { + name: 'Composite', + className: 'ActivityListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ActivityElementType', + type: { + name: 'Composite', + className: 'Activity' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ActivityListResult; diff --git a/lib/services/automationManagement/lib/lib/models/activityOutputType.js b/lib/services/automationManagement/lib/lib/models/activityOutputType.js new file mode 100644 index 0000000000..324b6c3926 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/activityOutputType.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'; + +/** + * Definition of the activity output type. + * + */ +class ActivityOutputType { + /** + * Create a ActivityOutputType. + * @member {string} [name] Gets or sets the name of the activity output type. + * @member {string} [type] Gets or sets the type of the activity output type. + */ + constructor() { + } + + /** + * Defines the metadata of ActivityOutputType + * + * @returns {object} metadata of ActivityOutputType + * + */ + mapper() { + return { + required: false, + serializedName: 'ActivityOutputType', + type: { + name: 'Composite', + className: 'ActivityOutputType', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + serializedName: 'type', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ActivityOutputType; diff --git a/lib/services/automationManagement/lib/lib/models/activityParameter.js b/lib/services/automationManagement/lib/lib/models/activityParameter.js new file mode 100644 index 0000000000..9938816f29 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/activityParameter.js @@ -0,0 +1,124 @@ +/* + * 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'; + +/** + * Definition of the activity parameter. + * + */ +class ActivityParameter { + /** + * Create a ActivityParameter. + * @member {string} [name] Gets or sets the name of the activity parameter. + * @member {string} [type] Gets or sets the type of the activity parameter. + * @member {boolean} [isMandatory] Gets or sets a Boolean value that + * indicates true if the parameter is required. If the value is false, the + * parameter is optional. + * @member {boolean} [isDynamic] Gets or sets a Boolean value that indicates + * true if the parameter is dynamic. + * @member {boolean} [position] Gets or sets the position of the activity + * parameter. + * @member {boolean} [valueFromPipeline] Gets or sets a Boolean value that + * indicates true if the parameter can take values from the incoming pipeline + * objects. This setting is used if the cmdlet must access the complete input + * object. false indicates that the parameter cannot take values from the + * complete input object. + * @member {boolean} [valueFromPipelineByPropertyName] Gets or sets a Boolean + * value that indicates true if the parameter can be filled from a property + * of the incoming pipeline object that has the same name as this parameter. + * false indicates that the parameter cannot be filled from the incoming + * pipeline object property with the same name. + * @member {boolean} [valueFromRemainingArguments] Gets or sets a Boolean + * value that indicates true if the cmdlet parameter accepts all the + * remaining command-line arguments that are associated with this parameter + * in the form of an array. false if the cmdlet parameter does not accept all + * the remaining argument values. + */ + constructor() { + } + + /** + * Defines the metadata of ActivityParameter + * + * @returns {object} metadata of ActivityParameter + * + */ + mapper() { + return { + required: false, + serializedName: 'ActivityParameter', + type: { + name: 'Composite', + className: 'ActivityParameter', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + serializedName: 'type', + type: { + name: 'String' + } + }, + isMandatory: { + required: false, + serializedName: 'isMandatory', + type: { + name: 'Boolean' + } + }, + isDynamic: { + required: false, + serializedName: 'isDynamic', + type: { + name: 'Boolean' + } + }, + position: { + required: false, + serializedName: 'position', + type: { + name: 'Boolean' + } + }, + valueFromPipeline: { + required: false, + serializedName: 'valueFromPipeline', + type: { + name: 'Boolean' + } + }, + valueFromPipelineByPropertyName: { + required: false, + serializedName: 'valueFromPipelineByPropertyName', + type: { + name: 'Boolean' + } + }, + valueFromRemainingArguments: { + required: false, + serializedName: 'valueFromRemainingArguments', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = ActivityParameter; diff --git a/lib/services/automationManagement/lib/lib/models/activityParameterSet.js b/lib/services/automationManagement/lib/lib/models/activityParameterSet.js new file mode 100644 index 0000000000..811fc74a61 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/activityParameterSet.js @@ -0,0 +1,72 @@ +/* + * 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'); + +/** + * Definition of the activity parameter set. + * + */ +class ActivityParameterSet { + /** + * Create a ActivityParameterSet. + * @member {string} [name] Gets or sets the name of the activity parameter + * set. + * @member {array} [parameters] Gets or sets the parameters of the activity + * parameter set. + */ + constructor() { + } + + /** + * Defines the metadata of ActivityParameterSet + * + * @returns {object} metadata of ActivityParameterSet + * + */ + mapper() { + return { + required: false, + serializedName: 'ActivityParameterSet', + type: { + name: 'Composite', + className: 'ActivityParameterSet', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + parameters: { + required: false, + serializedName: 'parameters', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ActivityParameterElementType', + type: { + name: 'Composite', + className: 'ActivityParameter' + } + } + } + } + } + } + }; + } +} + +module.exports = ActivityParameterSet; diff --git a/lib/services/automationManagement/lib/lib/models/advancedSchedule.js b/lib/services/automationManagement/lib/lib/models/advancedSchedule.js new file mode 100644 index 0000000000..a27e6b8c7b --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/advancedSchedule.js @@ -0,0 +1,94 @@ +/* + * 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 properties of the create Advanced Schedule. + * + */ +class AdvancedSchedule { + /** + * Create a AdvancedSchedule. + * @member {array} [weekDays] Days of the week that the job should execute + * on. + * @member {array} [monthDays] Days of the month that the job should execute + * on. Must be between 1 and 31. + * @member {array} [monthlyOccurrences] Occurrences of days within a month. + */ + constructor() { + } + + /** + * Defines the metadata of AdvancedSchedule + * + * @returns {object} metadata of AdvancedSchedule + * + */ + mapper() { + return { + required: false, + serializedName: 'AdvancedSchedule', + type: { + name: 'Composite', + className: 'AdvancedSchedule', + modelProperties: { + weekDays: { + required: false, + serializedName: 'weekDays', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + monthDays: { + required: false, + serializedName: 'monthDays', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'NumberElementType', + type: { + name: 'Number' + } + } + } + }, + monthlyOccurrences: { + required: false, + serializedName: 'monthlyOccurrences', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AdvancedScheduleMonthlyOccurrenceElementType', + type: { + name: 'Composite', + className: 'AdvancedScheduleMonthlyOccurrence' + } + } + } + } + } + } + }; + } +} + +module.exports = AdvancedSchedule; diff --git a/lib/services/automationManagement/lib/lib/models/advancedScheduleMonthlyOccurrence.js b/lib/services/automationManagement/lib/lib/models/advancedScheduleMonthlyOccurrence.js new file mode 100644 index 0000000000..b35d9611bb --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/advancedScheduleMonthlyOccurrence.js @@ -0,0 +1,64 @@ +/* + * 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 properties of the create advanced schedule monthly occurrence. + * + */ +class AdvancedScheduleMonthlyOccurrence { + /** + * Create a AdvancedScheduleMonthlyOccurrence. + * @member {number} [occurrence] Occurrence of the week within the month. + * Must be between 1 and 5 + * @member {string} [day] Day of the occurrence. Must be one of monday, + * tuesday, wednesday, thursday, friday, saturday, sunday. Possible values + * include: 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', + * 'Saturday', 'Sunday' + */ + constructor() { + } + + /** + * Defines the metadata of AdvancedScheduleMonthlyOccurrence + * + * @returns {object} metadata of AdvancedScheduleMonthlyOccurrence + * + */ + mapper() { + return { + required: false, + serializedName: 'AdvancedScheduleMonthlyOccurrence', + type: { + name: 'Composite', + className: 'AdvancedScheduleMonthlyOccurrence', + modelProperties: { + occurrence: { + required: false, + serializedName: 'occurrence', + type: { + name: 'Number' + } + }, + day: { + required: false, + serializedName: 'day', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AdvancedScheduleMonthlyOccurrence; diff --git a/lib/services/automationManagement/lib/lib/models/agentRegistration.js b/lib/services/automationManagement/lib/lib/models/agentRegistration.js new file mode 100644 index 0000000000..dbd1785629 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/agentRegistration.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'); + +/** + * Definition of the agent registration infomration type. + * + */ +class AgentRegistration { + /** + * Create a AgentRegistration. + * @member {string} [dscMetaConfiguration] Gets or sets the dsc meta + * configuration. + * @member {string} [endpoint] Gets or sets the dsc server endpoint. + * @member {object} [keys] Gets or sets the agent registration keys. + * @member {string} [keys.primary] Gets or sets the primary key. + * @member {string} [keys.secondary] Gets or sets the secondary key. + * @member {string} [id] Gets or sets the id. + */ + constructor() { + } + + /** + * Defines the metadata of AgentRegistration + * + * @returns {object} metadata of AgentRegistration + * + */ + mapper() { + return { + required: false, + serializedName: 'AgentRegistration', + type: { + name: 'Composite', + className: 'AgentRegistration', + modelProperties: { + dscMetaConfiguration: { + required: false, + serializedName: 'dscMetaConfiguration', + type: { + name: 'String' + } + }, + endpoint: { + required: false, + serializedName: 'endpoint', + type: { + name: 'String' + } + }, + keys: { + required: false, + serializedName: 'keys', + type: { + name: 'Composite', + className: 'AgentRegistrationKeys' + } + }, + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AgentRegistration; diff --git a/lib/services/automationManagement/lib/lib/models/agentRegistrationKeys.js b/lib/services/automationManagement/lib/lib/models/agentRegistrationKeys.js new file mode 100644 index 0000000000..280edf399d --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/agentRegistrationKeys.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'; + +/** + * Definition of the agent registration keys. + * + */ +class AgentRegistrationKeys { + /** + * Create a AgentRegistrationKeys. + * @member {string} [primary] Gets or sets the primary key. + * @member {string} [secondary] Gets or sets the secondary key. + */ + constructor() { + } + + /** + * Defines the metadata of AgentRegistrationKeys + * + * @returns {object} metadata of AgentRegistrationKeys + * + */ + mapper() { + return { + required: false, + serializedName: 'AgentRegistrationKeys', + type: { + name: 'Composite', + className: 'AgentRegistrationKeys', + modelProperties: { + primary: { + required: false, + serializedName: 'primary', + type: { + name: 'String' + } + }, + secondary: { + required: false, + serializedName: 'secondary', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AgentRegistrationKeys; diff --git a/lib/services/automationManagement/lib/lib/models/agentRegistrationRegenerateKeyParameter.js b/lib/services/automationManagement/lib/lib/models/agentRegistrationRegenerateKeyParameter.js new file mode 100644 index 0000000000..4c7e0e4f9c --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/agentRegistrationRegenerateKeyParameter.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 parameters supplied to the regenerate keys operation. + * + */ +class AgentRegistrationRegenerateKeyParameter { + /** + * Create a AgentRegistrationRegenerateKeyParameter. + * @member {string} keyName Gets or sets the agent registration key name - + * primary or secondary. Possible values include: 'primary', 'secondary' + * @member {string} [name] Gets or sets the name of the resource. + * @member {string} [location] Gets or sets the location of the resource. + * @member {object} [tags] Gets or sets the tags attached to the resource. + */ + constructor() { + } + + /** + * Defines the metadata of AgentRegistrationRegenerateKeyParameter + * + * @returns {object} metadata of AgentRegistrationRegenerateKeyParameter + * + */ + mapper() { + return { + required: false, + serializedName: 'AgentRegistrationRegenerateKeyParameter', + type: { + name: 'Composite', + className: 'AgentRegistrationRegenerateKeyParameter', + modelProperties: { + keyName: { + required: true, + serializedName: 'keyName', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + 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 = AgentRegistrationRegenerateKeyParameter; diff --git a/lib/services/automationManagement/lib/lib/models/automationAccount.js b/lib/services/automationManagement/lib/lib/models/automationAccount.js new file mode 100644 index 0000000000..41d7d1ecf3 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/automationAccount.js @@ -0,0 +1,158 @@ +/* + * 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'); + +/** + * Definition of the automation account type. + * + * @extends models['TrackedResource'] + */ +class AutomationAccount extends models['TrackedResource'] { + /** + * Create a AutomationAccount. + * @member {object} [sku] Gets or sets the SKU of account. + * @member {string} [sku.name] Gets or sets the SKU name of the account. + * Possible values include: 'Free', 'Basic' + * @member {string} [sku.family] Gets or sets the SKU family. + * @member {number} [sku.capacity] Gets or sets the SKU capacity. + * @member {string} [lastModifiedBy] Gets or sets the last modified by. + * @member {string} [state] Gets status of account. Possible values include: + * 'Ok', 'Unavailable', 'Suspended' + * @member {date} [creationTime] Gets the creation time. + * @member {date} [lastModifiedTime] Gets the last modified time. + * @member {string} [description] Gets or sets the description. + * @member {string} [etag] Gets or sets the etag of the resource. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of AutomationAccount + * + * @returns {object} metadata of AutomationAccount + * + */ + mapper() { + return { + required: false, + serializedName: 'AutomationAccount', + type: { + name: 'Composite', + className: 'AutomationAccount', + 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' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + sku: { + required: false, + serializedName: 'properties.sku', + type: { + name: 'Composite', + className: 'Sku' + } + }, + lastModifiedBy: { + required: false, + serializedName: 'properties.lastModifiedBy', + type: { + name: 'String' + } + }, + state: { + required: false, + readOnly: true, + serializedName: 'properties.state', + type: { + name: 'String' + } + }, + creationTime: { + required: false, + readOnly: true, + serializedName: 'properties.creationTime', + type: { + name: 'DateTime' + } + }, + lastModifiedTime: { + required: false, + readOnly: true, + serializedName: 'properties.lastModifiedTime', + type: { + name: 'DateTime' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AutomationAccount; diff --git a/lib/services/automationManagement/lib/lib/models/automationAccountCreateOrUpdateParameters.js b/lib/services/automationManagement/lib/lib/models/automationAccountCreateOrUpdateParameters.js new file mode 100644 index 0000000000..6793f6f794 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/automationAccountCreateOrUpdateParameters.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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The parameters supplied to the create or update automation account + * operation. + * + */ +class AutomationAccountCreateOrUpdateParameters { + /** + * Create a AutomationAccountCreateOrUpdateParameters. + * @member {object} [sku] Gets or sets account SKU. + * @member {string} [sku.name] Gets or sets the SKU name of the account. + * Possible values include: 'Free', 'Basic' + * @member {string} [sku.family] Gets or sets the SKU family. + * @member {number} [sku.capacity] Gets or sets the SKU capacity. + * @member {string} [name] Gets or sets name of the resource. + * @member {string} [location] Gets or sets the location of the resource. + * @member {object} [tags] Gets or sets the tags attached to the resource. + */ + constructor() { + } + + /** + * Defines the metadata of AutomationAccountCreateOrUpdateParameters + * + * @returns {object} metadata of AutomationAccountCreateOrUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'AutomationAccountCreateOrUpdateParameters', + type: { + name: 'Composite', + className: 'AutomationAccountCreateOrUpdateParameters', + modelProperties: { + sku: { + required: false, + serializedName: 'properties.sku', + type: { + name: 'Composite', + className: 'Sku' + } + }, + name: { + required: false, + serializedName: 'name', + 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 = AutomationAccountCreateOrUpdateParameters; diff --git a/lib/services/automationManagement/lib/lib/models/automationAccountListResult.js b/lib/services/automationManagement/lib/lib/models/automationAccountListResult.js new file mode 100644 index 0000000000..e59c38d358 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/automationAccountListResult.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'; + +/** + * The response model for the list account operation. + */ +class AutomationAccountListResult extends Array { + /** + * Create a AutomationAccountListResult. + * @member {string} [nextLink] Gets or sets the next link. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of AutomationAccountListResult + * + * @returns {object} metadata of AutomationAccountListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'AutomationAccountListResult', + type: { + name: 'Composite', + className: 'AutomationAccountListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AutomationAccountElementType', + type: { + name: 'Composite', + className: 'AutomationAccount' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AutomationAccountListResult; diff --git a/lib/services/automationManagement/lib/lib/models/automationAccountUpdateParameters.js b/lib/services/automationManagement/lib/lib/models/automationAccountUpdateParameters.js new file mode 100644 index 0000000000..f4917c3f5c --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/automationAccountUpdateParameters.js @@ -0,0 +1,90 @@ +/* + * 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 parameters supplied to the update automation account operation. + * + */ +class AutomationAccountUpdateParameters { + /** + * Create a AutomationAccountUpdateParameters. + * @member {object} [sku] Gets or sets account SKU. + * @member {string} [sku.name] Gets or sets the SKU name of the account. + * Possible values include: 'Free', 'Basic' + * @member {string} [sku.family] Gets or sets the SKU family. + * @member {number} [sku.capacity] Gets or sets the SKU capacity. + * @member {string} [name] Gets or sets the name of the resource. + * @member {string} [location] Gets or sets the location of the resource. + * @member {object} [tags] Gets or sets the tags attached to the resource. + */ + constructor() { + } + + /** + * Defines the metadata of AutomationAccountUpdateParameters + * + * @returns {object} metadata of AutomationAccountUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'AutomationAccountUpdateParameters', + type: { + name: 'Composite', + className: 'AutomationAccountUpdateParameters', + modelProperties: { + sku: { + required: false, + serializedName: 'properties.sku', + type: { + name: 'Composite', + className: 'Sku' + } + }, + name: { + required: false, + serializedName: 'name', + 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 = AutomationAccountUpdateParameters; diff --git a/lib/services/automationManagement/lib/lib/models/certificate.js b/lib/services/automationManagement/lib/lib/models/certificate.js new file mode 100644 index 0000000000..040fb31a01 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/certificate.js @@ -0,0 +1,126 @@ +/* + * 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'); + +/** + * Definition of the certificate. + * + * @extends models['ProxyResource'] + */ +class Certificate extends models['ProxyResource'] { + /** + * Create a Certificate. + * @member {string} [thumbprint] Gets the thumbprint of the certificate. + * @member {date} [expiryTime] Gets the expiry time of the certificate. + * @member {boolean} [isExportable] Gets the is exportable flag of the + * certificate. + * @member {date} [creationTime] Gets the creation time. + * @member {date} [lastModifiedTime] Gets the last modified time. + * @member {string} [description] Gets or sets the description. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Certificate + * + * @returns {object} metadata of Certificate + * + */ + mapper() { + return { + required: false, + serializedName: 'Certificate', + type: { + name: 'Composite', + className: 'Certificate', + 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' + } + }, + thumbprint: { + required: false, + readOnly: true, + serializedName: 'properties.thumbprint', + type: { + name: 'String' + } + }, + expiryTime: { + required: false, + readOnly: true, + serializedName: 'properties.expiryTime', + type: { + name: 'DateTime' + } + }, + isExportable: { + required: false, + readOnly: true, + serializedName: 'properties.isExportable', + type: { + name: 'Boolean' + } + }, + creationTime: { + required: false, + readOnly: true, + serializedName: 'properties.creationTime', + type: { + name: 'DateTime' + } + }, + lastModifiedTime: { + required: false, + readOnly: true, + serializedName: 'properties.lastModifiedTime', + type: { + name: 'DateTime' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Certificate; diff --git a/lib/services/automationManagement/lib/lib/models/certificateCreateOrUpdateParameters.js b/lib/services/automationManagement/lib/lib/models/certificateCreateOrUpdateParameters.js new file mode 100644 index 0000000000..e3106d82f4 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/certificateCreateOrUpdateParameters.js @@ -0,0 +1,89 @@ +/* + * 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 parameters supplied to the create or update or replace certificate + * operation. + * + */ +class CertificateCreateOrUpdateParameters { + /** + * Create a CertificateCreateOrUpdateParameters. + * @member {string} name Gets or sets the name of the certificate. + * @member {string} base64Value Gets or sets the base64 encoded value of the + * certificate. + * @member {string} [description] Gets or sets the description of the + * certificate. + * @member {string} [thumbprint] Gets or sets the thumbprint of the + * certificate. + * @member {boolean} [isExportable] Gets or sets the is exportable flag of + * the certificate. + */ + constructor() { + } + + /** + * Defines the metadata of CertificateCreateOrUpdateParameters + * + * @returns {object} metadata of CertificateCreateOrUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'CertificateCreateOrUpdateParameters', + type: { + name: 'Composite', + className: 'CertificateCreateOrUpdateParameters', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + base64Value: { + required: true, + serializedName: 'properties.base64Value', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + thumbprint: { + required: false, + serializedName: 'properties.thumbprint', + type: { + name: 'String' + } + }, + isExportable: { + required: false, + serializedName: 'properties.isExportable', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = CertificateCreateOrUpdateParameters; diff --git a/lib/services/automationManagement/lib/lib/models/certificateListResult.js b/lib/services/automationManagement/lib/lib/models/certificateListResult.js new file mode 100644 index 0000000000..10baecf0a0 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/certificateListResult.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'; + +/** + * The response model for the list certificate operation. + */ +class CertificateListResult extends Array { + /** + * Create a CertificateListResult. + * @member {string} [nextLink] Gets or sets the next link. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of CertificateListResult + * + * @returns {object} metadata of CertificateListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'CertificateListResult', + type: { + name: 'Composite', + className: 'CertificateListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'CertificateElementType', + type: { + name: 'Composite', + className: 'Certificate' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = CertificateListResult; diff --git a/lib/services/automationManagement/lib/lib/models/certificateUpdateParameters.js b/lib/services/automationManagement/lib/lib/models/certificateUpdateParameters.js new file mode 100644 index 0000000000..11e6061763 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/certificateUpdateParameters.js @@ -0,0 +1,61 @@ +/* + * 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 parameters supplied to the update certificate operation. + * + */ +class CertificateUpdateParameters { + /** + * Create a CertificateUpdateParameters. + * @member {string} [name] Gets or sets the name of the certificate. + * @member {string} [description] Gets or sets the description of the + * certificate. + */ + constructor() { + } + + /** + * Defines the metadata of CertificateUpdateParameters + * + * @returns {object} metadata of CertificateUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'CertificateUpdateParameters', + type: { + name: 'Composite', + className: 'CertificateUpdateParameters', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = CertificateUpdateParameters; diff --git a/lib/services/automationManagement/lib/lib/models/collectionItemUpdateConfiguration.js b/lib/services/automationManagement/lib/lib/models/collectionItemUpdateConfiguration.js new file mode 100644 index 0000000000..f74f815c18 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/collectionItemUpdateConfiguration.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'; + +/** + * object returned when requesting a collection of software update + * configuration + * + */ +class CollectionItemUpdateConfiguration { + /** + * Create a CollectionItemUpdateConfiguration. + * @member {array} [azureVirtualMachines] List of azure resource Ids for + * azure virtual machines targeted by the software update configuration. + * @member {moment.duration} [duration] Maximum time allowed for the software + * update configuration run. Duration needs to be specified using the format + * PT[n]H[n]M[n]S as per ISO8601 + */ + constructor() { + } + + /** + * Defines the metadata of CollectionItemUpdateConfiguration + * + * @returns {object} metadata of CollectionItemUpdateConfiguration + * + */ + mapper() { + return { + required: false, + serializedName: 'collectionItemUpdateConfiguration', + type: { + name: 'Composite', + className: 'CollectionItemUpdateConfiguration', + modelProperties: { + azureVirtualMachines: { + required: false, + serializedName: 'azureVirtualMachines', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + duration: { + required: false, + serializedName: 'duration', + type: { + name: 'TimeSpan' + } + } + } + } + }; + } +} + +module.exports = CollectionItemUpdateConfiguration; diff --git a/lib/services/automationManagement/lib/lib/models/connection.js b/lib/services/automationManagement/lib/lib/models/connection.js new file mode 100644 index 0000000000..3a41e356d4 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/connection.js @@ -0,0 +1,127 @@ +/* + * 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'); + +/** + * Definition of the connection. + * + * @extends models['ProxyResource'] + */ +class Connection extends models['ProxyResource'] { + /** + * Create a Connection. + * @member {object} [connectionType] Gets or sets the connectionType of the + * connection. + * @member {string} [connectionType.name] Gets or sets the name of the + * connection type. + * @member {object} [fieldDefinitionValues] Gets the field definition values + * of the connection. + * @member {date} [creationTime] Gets the creation time. + * @member {date} [lastModifiedTime] Gets the last modified time. + * @member {string} [description] Gets or sets the description. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Connection + * + * @returns {object} metadata of Connection + * + */ + mapper() { + return { + required: false, + serializedName: 'Connection', + type: { + name: 'Composite', + className: 'Connection', + 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' + } + }, + connectionType: { + required: false, + serializedName: 'properties.connectionType', + type: { + name: 'Composite', + className: 'ConnectionTypeAssociationProperty' + } + }, + fieldDefinitionValues: { + required: false, + readOnly: true, + serializedName: 'properties.fieldDefinitionValues', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + creationTime: { + required: false, + readOnly: true, + serializedName: 'properties.creationTime', + type: { + name: 'DateTime' + } + }, + lastModifiedTime: { + required: false, + readOnly: true, + serializedName: 'properties.lastModifiedTime', + type: { + name: 'DateTime' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Connection; diff --git a/lib/services/automationManagement/lib/lib/models/connectionCreateOrUpdateParameters.js b/lib/services/automationManagement/lib/lib/models/connectionCreateOrUpdateParameters.js new file mode 100644 index 0000000000..08097d7229 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/connectionCreateOrUpdateParameters.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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The parameters supplied to the create or update connection operation. + * + */ +class ConnectionCreateOrUpdateParameters { + /** + * Create a ConnectionCreateOrUpdateParameters. + * @member {string} name Gets or sets the name of the connection. + * @member {string} [description] Gets or sets the description of the + * connection. + * @member {object} connectionType Gets or sets the connectionType of the + * connection. + * @member {string} [connectionType.name] Gets or sets the name of the + * connection type. + * @member {object} [fieldDefinitionValues] Gets or sets the field definition + * properties of the connection. + */ + constructor() { + } + + /** + * Defines the metadata of ConnectionCreateOrUpdateParameters + * + * @returns {object} metadata of ConnectionCreateOrUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'ConnectionCreateOrUpdateParameters', + type: { + name: 'Composite', + className: 'ConnectionCreateOrUpdateParameters', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + connectionType: { + required: true, + serializedName: 'properties.connectionType', + type: { + name: 'Composite', + className: 'ConnectionTypeAssociationProperty' + } + }, + fieldDefinitionValues: { + required: false, + serializedName: 'properties.fieldDefinitionValues', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = ConnectionCreateOrUpdateParameters; diff --git a/lib/services/automationManagement/lib/lib/models/connectionListResult.js b/lib/services/automationManagement/lib/lib/models/connectionListResult.js new file mode 100644 index 0000000000..684c9928b9 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/connectionListResult.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'; + +/** + * The response model for the list connection operation. + */ +class ConnectionListResult extends Array { + /** + * Create a ConnectionListResult. + * @member {string} [nextLink] Gets or sets the next link. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ConnectionListResult + * + * @returns {object} metadata of ConnectionListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ConnectionListResult', + type: { + name: 'Composite', + className: 'ConnectionListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ConnectionElementType', + type: { + name: 'Composite', + className: 'Connection' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ConnectionListResult; diff --git a/lib/services/automationManagement/lib/lib/models/connectionType.js b/lib/services/automationManagement/lib/lib/models/connectionType.js new file mode 100644 index 0000000000..d5d7e8848d --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/connectionType.js @@ -0,0 +1,125 @@ +/* + * 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'); + +/** + * Definition of the connection type. + * + */ +class ConnectionType { + /** + * Create a ConnectionType. + * @member {string} [id] Gets the id of the resource. + * @member {string} [name] Gets the name of the connection type. + * @member {string} [type] Resource type + * @member {boolean} [isGlobal] Gets or sets a Boolean value to indicate if + * the connection type is global. + * @member {object} [fieldDefinitions] Gets the field definitions of the + * connection type. + * @member {date} [creationTime] Gets the creation time. + * @member {date} [lastModifiedTime] Gets or sets the last modified time. + * @member {string} [description] Gets or sets the description. + */ + constructor() { + } + + /** + * Defines the metadata of ConnectionType + * + * @returns {object} metadata of ConnectionType + * + */ + mapper() { + return { + required: false, + serializedName: 'ConnectionType', + type: { + name: 'Composite', + className: 'ConnectionType', + 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' + } + }, + isGlobal: { + required: false, + serializedName: 'properties.isGlobal', + type: { + name: 'Boolean' + } + }, + fieldDefinitions: { + required: false, + readOnly: true, + serializedName: 'properties.fieldDefinitions', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'FieldDefinitionElementType', + type: { + name: 'Composite', + className: 'FieldDefinition' + } + } + } + }, + creationTime: { + required: false, + readOnly: true, + serializedName: 'properties.creationTime', + type: { + name: 'DateTime' + } + }, + lastModifiedTime: { + required: false, + serializedName: 'properties.lastModifiedTime', + type: { + name: 'DateTime' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ConnectionType; diff --git a/lib/services/automationManagement/lib/lib/models/connectionTypeAssociationProperty.js b/lib/services/automationManagement/lib/lib/models/connectionTypeAssociationProperty.js new file mode 100644 index 0000000000..30d648524d --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/connectionTypeAssociationProperty.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 connection type property associated with the entity. + * + */ +class ConnectionTypeAssociationProperty { + /** + * Create a ConnectionTypeAssociationProperty. + * @member {string} [name] Gets or sets the name of the connection type. + */ + constructor() { + } + + /** + * Defines the metadata of ConnectionTypeAssociationProperty + * + * @returns {object} metadata of ConnectionTypeAssociationProperty + * + */ + mapper() { + return { + required: false, + serializedName: 'ConnectionTypeAssociationProperty', + type: { + name: 'Composite', + className: 'ConnectionTypeAssociationProperty', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ConnectionTypeAssociationProperty; diff --git a/lib/services/automationManagement/lib/lib/models/connectionTypeCreateOrUpdateParameters.js b/lib/services/automationManagement/lib/lib/models/connectionTypeCreateOrUpdateParameters.js new file mode 100644 index 0000000000..4c8eae0138 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/connectionTypeCreateOrUpdateParameters.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 parameters supplied to the create or update connection type operation. + * + */ +class ConnectionTypeCreateOrUpdateParameters { + /** + * Create a ConnectionTypeCreateOrUpdateParameters. + * @member {string} name Gets or sets the name of the connection type. + * @member {boolean} [isGlobal] Gets or sets a Boolean value to indicate if + * the connection type is global. + * @member {object} fieldDefinitions Gets or sets the field definitions of + * the connection type. + */ + constructor() { + } + + /** + * Defines the metadata of ConnectionTypeCreateOrUpdateParameters + * + * @returns {object} metadata of ConnectionTypeCreateOrUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'ConnectionTypeCreateOrUpdateParameters', + type: { + name: 'Composite', + className: 'ConnectionTypeCreateOrUpdateParameters', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + isGlobal: { + required: false, + serializedName: 'properties.isGlobal', + type: { + name: 'Boolean' + } + }, + fieldDefinitions: { + required: true, + serializedName: 'properties.fieldDefinitions', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'FieldDefinitionElementType', + type: { + name: 'Composite', + className: 'FieldDefinition' + } + } + } + } + } + } + }; + } +} + +module.exports = ConnectionTypeCreateOrUpdateParameters; diff --git a/lib/services/automationManagement/lib/lib/models/connectionTypeListResult.js b/lib/services/automationManagement/lib/lib/models/connectionTypeListResult.js new file mode 100644 index 0000000000..956d39daec --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/connectionTypeListResult.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'; + +/** + * The response model for the list connection type operation. + */ +class ConnectionTypeListResult extends Array { + /** + * Create a ConnectionTypeListResult. + * @member {string} [nextLink] Gets or sets the next link. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ConnectionTypeListResult + * + * @returns {object} metadata of ConnectionTypeListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ConnectionTypeListResult', + type: { + name: 'Composite', + className: 'ConnectionTypeListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ConnectionTypeElementType', + type: { + name: 'Composite', + className: 'ConnectionType' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ConnectionTypeListResult; diff --git a/lib/services/automationManagement/lib/lib/models/connectionUpdateParameters.js b/lib/services/automationManagement/lib/lib/models/connectionUpdateParameters.js new file mode 100644 index 0000000000..fa7a6f712a --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/connectionUpdateParameters.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'; + +/** + * The parameters supplied to the update connection operation. + * + */ +class ConnectionUpdateParameters { + /** + * Create a ConnectionUpdateParameters. + * @member {string} [name] Gets or sets the name of the connection. + * @member {string} [description] Gets or sets the description of the + * connection. + * @member {object} [fieldDefinitionValues] Gets or sets the field definition + * values of the connection. + */ + constructor() { + } + + /** + * Defines the metadata of ConnectionUpdateParameters + * + * @returns {object} metadata of ConnectionUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'ConnectionUpdateParameters', + type: { + name: 'Composite', + className: 'ConnectionUpdateParameters', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + fieldDefinitionValues: { + required: false, + serializedName: 'properties.fieldDefinitionValues', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = ConnectionUpdateParameters; diff --git a/lib/services/automationManagement/lib/lib/models/contentHash.js b/lib/services/automationManagement/lib/lib/models/contentHash.js new file mode 100644 index 0000000000..3c4e13d238 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/contentHash.js @@ -0,0 +1,61 @@ +/* + * 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'; + +/** + * Definition of the runbook property type. + * + */ +class ContentHash { + /** + * Create a ContentHash. + * @member {string} algorithm Gets or sets the content hash algorithm used to + * hash the content. + * @member {string} value Gets or sets expected hash value of the content. + */ + constructor() { + } + + /** + * Defines the metadata of ContentHash + * + * @returns {object} metadata of ContentHash + * + */ + mapper() { + return { + required: false, + serializedName: 'ContentHash', + type: { + name: 'Composite', + className: 'ContentHash', + modelProperties: { + algorithm: { + required: true, + serializedName: 'algorithm', + type: { + name: 'String' + } + }, + value: { + required: true, + serializedName: 'value', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ContentHash; diff --git a/lib/services/automationManagement/lib/lib/models/contentLink.js b/lib/services/automationManagement/lib/lib/models/contentLink.js new file mode 100644 index 0000000000..3e96458ded --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/contentLink.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'; + +const models = require('./index'); + +/** + * Definition of the content link. + * + */ +class ContentLink { + /** + * Create a ContentLink. + * @member {string} [uri] Gets or sets the uri of the runbook content. + * @member {object} [contentHash] Gets or sets the hash. + * @member {string} [contentHash.algorithm] Gets or sets the content hash + * algorithm used to hash the content. + * @member {string} [contentHash.value] Gets or sets expected hash value of + * the content. + * @member {string} [version] Gets or sets the version of the content. + */ + constructor() { + } + + /** + * Defines the metadata of ContentLink + * + * @returns {object} metadata of ContentLink + * + */ + mapper() { + return { + required: false, + serializedName: 'ContentLink', + type: { + name: 'Composite', + className: 'ContentLink', + modelProperties: { + uri: { + required: false, + serializedName: 'uri', + type: { + name: 'String' + } + }, + contentHash: { + required: false, + serializedName: 'contentHash', + type: { + name: 'Composite', + className: 'ContentHash' + } + }, + version: { + required: false, + serializedName: 'version', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ContentLink; diff --git a/lib/services/automationManagement/lib/lib/models/contentSource.js b/lib/services/automationManagement/lib/lib/models/contentSource.js new file mode 100644 index 0000000000..7c01643a28 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/contentSource.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'); + +/** + * Definition of the content source. + * + */ +class ContentSource { + /** + * Create a ContentSource. + * @member {object} [hash] Gets or sets the hash. + * @member {string} [hash.algorithm] Gets or sets the content hash algorithm + * used to hash the content. + * @member {string} [hash.value] Gets or sets expected hash value of the + * content. + * @member {string} [type] Gets or sets the content source type. Possible + * values include: 'embeddedContent', 'uri' + * @member {string} [value] Gets or sets the value of the content. This is + * based on the content source type. + * @member {string} [version] Gets or sets the version of the content. + */ + constructor() { + } + + /** + * Defines the metadata of ContentSource + * + * @returns {object} metadata of ContentSource + * + */ + mapper() { + return { + required: false, + serializedName: 'ContentSource', + type: { + name: 'Composite', + className: 'ContentSource', + modelProperties: { + hash: { + required: false, + serializedName: 'hash', + type: { + name: 'Composite', + className: 'ContentHash' + } + }, + type: { + required: false, + serializedName: 'type', + type: { + name: 'String' + } + }, + value: { + required: false, + serializedName: 'value', + type: { + name: 'String' + } + }, + version: { + required: false, + serializedName: 'version', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ContentSource; diff --git a/lib/services/automationManagement/lib/lib/models/credential.js b/lib/services/automationManagement/lib/lib/models/credential.js new file mode 100644 index 0000000000..a84920edca --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/credential.js @@ -0,0 +1,107 @@ +/* + * 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'); + +/** + * Definition of the credential. + * + * @extends models['ProxyResource'] + */ +class Credential extends models['ProxyResource'] { + /** + * Create a Credential. + * @member {string} [userName] Gets the user name of the credential. + * @member {date} [creationTime] Gets the creation time. + * @member {date} [lastModifiedTime] Gets the last modified time. + * @member {string} [description] Gets or sets the description. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Credential + * + * @returns {object} metadata of Credential + * + */ + mapper() { + return { + required: false, + serializedName: 'Credential', + type: { + name: 'Composite', + className: 'Credential', + 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' + } + }, + userName: { + required: false, + readOnly: true, + serializedName: 'properties.userName', + type: { + name: 'String' + } + }, + creationTime: { + required: false, + readOnly: true, + serializedName: 'properties.creationTime', + type: { + name: 'DateTime' + } + }, + lastModifiedTime: { + required: false, + readOnly: true, + serializedName: 'properties.lastModifiedTime', + type: { + name: 'DateTime' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Credential; diff --git a/lib/services/automationManagement/lib/lib/models/credentialCreateOrUpdateParameters.js b/lib/services/automationManagement/lib/lib/models/credentialCreateOrUpdateParameters.js new file mode 100644 index 0000000000..b43367de48 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/credentialCreateOrUpdateParameters.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'; + +/** + * The parameters supplied to the create or update credential operation. + * + */ +class CredentialCreateOrUpdateParameters { + /** + * Create a CredentialCreateOrUpdateParameters. + * @member {string} name Gets or sets the name of the credential. + * @member {string} userName Gets or sets the user name of the credential. + * @member {string} password Gets or sets the password of the credential. + * @member {string} [description] Gets or sets the description of the + * credential. + */ + constructor() { + } + + /** + * Defines the metadata of CredentialCreateOrUpdateParameters + * + * @returns {object} metadata of CredentialCreateOrUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'CredentialCreateOrUpdateParameters', + type: { + name: 'Composite', + className: 'CredentialCreateOrUpdateParameters', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + userName: { + required: true, + serializedName: 'properties.userName', + type: { + name: 'String' + } + }, + password: { + required: true, + serializedName: 'properties.password', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = CredentialCreateOrUpdateParameters; diff --git a/lib/services/automationManagement/lib/lib/models/credentialListResult.js b/lib/services/automationManagement/lib/lib/models/credentialListResult.js new file mode 100644 index 0000000000..741fa8a7f6 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/credentialListResult.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'; + +/** + * The response model for the list credential operation. + */ +class CredentialListResult extends Array { + /** + * Create a CredentialListResult. + * @member {string} [nextLink] Gets or sets the next link. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of CredentialListResult + * + * @returns {object} metadata of CredentialListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'CredentialListResult', + type: { + name: 'Composite', + className: 'CredentialListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'CredentialElementType', + type: { + name: 'Composite', + className: 'Credential' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = CredentialListResult; diff --git a/lib/services/automationManagement/lib/lib/models/credentialUpdateParameters.js b/lib/services/automationManagement/lib/lib/models/credentialUpdateParameters.js new file mode 100644 index 0000000000..44760f420b --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/credentialUpdateParameters.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'; + +/** + * The parameters supplied to the Update credential operation. + * + */ +class CredentialUpdateParameters { + /** + * Create a CredentialUpdateParameters. + * @member {string} [name] Gets or sets the name of the credential. + * @member {string} [userName] Gets or sets the user name of the credential. + * @member {string} [password] Gets or sets the password of the credential. + * @member {string} [description] Gets or sets the description of the + * credential. + */ + constructor() { + } + + /** + * Defines the metadata of CredentialUpdateParameters + * + * @returns {object} metadata of CredentialUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'CredentialUpdateParameters', + type: { + name: 'Composite', + className: 'CredentialUpdateParameters', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + userName: { + required: false, + serializedName: 'properties.userName', + type: { + name: 'String' + } + }, + password: { + required: false, + serializedName: 'properties.password', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = CredentialUpdateParameters; diff --git a/lib/services/automationManagement/lib/lib/models/dscCompilationJob.js b/lib/services/automationManagement/lib/lib/models/dscCompilationJob.js new file mode 100644 index 0000000000..e33fe69c1f --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/dscCompilationJob.js @@ -0,0 +1,213 @@ +/* + * 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'); + +/** + * Definition of the Dsc Compilation job. + * + * @extends models['ProxyResource'] + */ +class DscCompilationJob extends models['ProxyResource'] { + /** + * Create a DscCompilationJob. + * @member {object} [configuration] Gets or sets the configuration. + * @member {string} [configuration.name] Gets or sets the name of the Dsc + * configuration. + * @member {string} [startedBy] Gets the compilation job started by. + * @member {uuid} [jobId] Gets the id of the job. + * @member {date} [creationTime] Gets the creation time of the job. + * @member {object} [provisioningState] The current provisioning state of the + * job. + * @member {string} [provisioningState.provisioningState] The provisioning + * state of the resource. Possible values include: 'Failed', 'Succeeded', + * 'Suspended', 'Processing' + * @member {string} [runOn] Gets or sets the runOn which specifies the group + * name where the job is to be executed. + * @member {string} [status] Gets or sets the status of the job. Possible + * values include: 'New', 'Activating', 'Running', 'Completed', 'Failed', + * 'Stopped', 'Blocked', 'Suspended', 'Disconnected', 'Suspending', + * 'Stopping', 'Resuming', 'Removing' + * @member {string} [statusDetails] Gets or sets the status details of the + * job. + * @member {date} [startTime] Gets the start time of the job. + * @member {date} [endTime] Gets the end time of the job. + * @member {string} [exception] Gets the exception of the job. + * @member {date} [lastModifiedTime] Gets the last modified time of the job. + * @member {date} [lastStatusModifiedTime] Gets the last status modified time + * of the job. + * @member {object} [parameters] Gets or sets the parameters of the job. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DscCompilationJob + * + * @returns {object} metadata of DscCompilationJob + * + */ + mapper() { + return { + required: false, + serializedName: 'DscCompilationJob', + type: { + name: 'Composite', + className: 'DscCompilationJob', + 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' + } + }, + configuration: { + required: false, + serializedName: 'properties.configuration', + type: { + name: 'Composite', + className: 'DscConfigurationAssociationProperty' + } + }, + startedBy: { + required: false, + readOnly: true, + serializedName: 'properties.startedBy', + type: { + name: 'String' + } + }, + jobId: { + required: false, + readOnly: true, + serializedName: 'properties.jobId', + type: { + name: 'String' + } + }, + creationTime: { + required: false, + readOnly: true, + serializedName: 'properties.creationTime', + type: { + name: 'DateTime' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'Composite', + className: 'JobProvisioningStateProperty' + } + }, + runOn: { + required: false, + serializedName: 'properties.runOn', + type: { + name: 'String' + } + }, + status: { + required: false, + serializedName: 'properties.status', + type: { + name: 'String' + } + }, + statusDetails: { + required: false, + serializedName: 'properties.statusDetails', + type: { + name: 'String' + } + }, + startTime: { + required: false, + readOnly: true, + serializedName: 'properties.startTime', + type: { + name: 'DateTime' + } + }, + endTime: { + required: false, + readOnly: true, + serializedName: 'properties.endTime', + type: { + name: 'DateTime' + } + }, + exception: { + required: false, + readOnly: true, + serializedName: 'properties.exception', + type: { + name: 'String' + } + }, + lastModifiedTime: { + required: false, + readOnly: true, + serializedName: 'properties.lastModifiedTime', + type: { + name: 'DateTime' + } + }, + lastStatusModifiedTime: { + required: false, + readOnly: true, + serializedName: 'properties.lastStatusModifiedTime', + type: { + name: 'DateTime' + } + }, + parameters: { + required: false, + serializedName: 'properties.parameters', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = DscCompilationJob; diff --git a/lib/services/automationManagement/lib/lib/models/dscCompilationJobCreateParameters.js b/lib/services/automationManagement/lib/lib/models/dscCompilationJobCreateParameters.js new file mode 100644 index 0000000000..364f2c99a6 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/dscCompilationJobCreateParameters.js @@ -0,0 +1,112 @@ +/* + * 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 parameters supplied to the create compilation job operation. + * + */ +class DscCompilationJobCreateParameters { + /** + * Create a DscCompilationJobCreateParameters. + * @member {object} configuration Gets or sets the configuration. + * @member {string} [configuration.name] Gets or sets the name of the Dsc + * configuration. + * @member {object} [parameters] Gets or sets the parameters of the job. + * @member {boolean} [newNodeConfigurationBuildVersionRequired] If a new + * build version of NodeConfiguration is required. + * @member {string} [name] Gets or sets name of the resource. + * @member {string} [location] Gets or sets the location of the resource. + * @member {object} [tags] Gets or sets the tags attached to the resource. + */ + constructor() { + } + + /** + * Defines the metadata of DscCompilationJobCreateParameters + * + * @returns {object} metadata of DscCompilationJobCreateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'DscCompilationJobCreateParameters', + type: { + name: 'Composite', + className: 'DscCompilationJobCreateParameters', + modelProperties: { + configuration: { + required: true, + serializedName: 'properties.configuration', + type: { + name: 'Composite', + className: 'DscConfigurationAssociationProperty' + } + }, + parameters: { + required: false, + serializedName: 'properties.parameters', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + newNodeConfigurationBuildVersionRequired: { + required: false, + serializedName: 'properties.newNodeConfigurationBuildVersionRequired', + type: { + name: 'Boolean' + } + }, + name: { + required: false, + serializedName: 'name', + 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 = DscCompilationJobCreateParameters; diff --git a/lib/services/automationManagement/lib/lib/models/dscCompilationJobListResult.js b/lib/services/automationManagement/lib/lib/models/dscCompilationJobListResult.js new file mode 100644 index 0000000000..6798c520b0 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/dscCompilationJobListResult.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'; + +/** + * The response model for the list job operation. + */ +class DscCompilationJobListResult extends Array { + /** + * Create a DscCompilationJobListResult. + * @member {string} [nextLink] Gets or sets the next link. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DscCompilationJobListResult + * + * @returns {object} metadata of DscCompilationJobListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'DscCompilationJobListResult', + type: { + name: 'Composite', + className: 'DscCompilationJobListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DscCompilationJobElementType', + type: { + name: 'Composite', + className: 'DscCompilationJob' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DscCompilationJobListResult; diff --git a/lib/services/automationManagement/lib/lib/models/dscConfiguration.js b/lib/services/automationManagement/lib/lib/models/dscConfiguration.js new file mode 100644 index 0000000000..99f3b9ceef --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/dscConfiguration.js @@ -0,0 +1,196 @@ +/* + * 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'); + +/** + * Definition of the configuration type. + * + * @extends models['TrackedResource'] + */ +class DscConfiguration extends models['TrackedResource'] { + /** + * Create a DscConfiguration. + * @member {string} [provisioningState] Gets or sets the provisioning state + * of the configuration. Possible values include: 'Succeeded' + * @member {number} [jobCount] Gets or sets the job count of the + * configuration. + * @member {object} [parameters] Gets or sets the configuration parameters. + * @member {object} [source] Gets or sets the source. + * @member {object} [source.hash] Gets or sets the hash. + * @member {string} [source.hash.algorithm] Gets or sets the content hash + * algorithm used to hash the content. + * @member {string} [source.hash.value] Gets or sets expected hash value of + * the content. + * @member {string} [source.type] Gets or sets the content source type. + * Possible values include: 'embeddedContent', 'uri' + * @member {string} [source.value] Gets or sets the value of the content. + * This is based on the content source type. + * @member {string} [source.version] Gets or sets the version of the content. + * @member {string} [state] Gets or sets the state of the configuration. + * Possible values include: 'New', 'Edit', 'Published' + * @member {boolean} [logVerbose] Gets or sets verbose log option. + * @member {date} [creationTime] Gets or sets the creation time. + * @member {date} [lastModifiedTime] Gets or sets the last modified time. + * @member {string} [description] Gets or sets the description. + * @member {string} [etag] Gets or sets the etag of the resource. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DscConfiguration + * + * @returns {object} metadata of DscConfiguration + * + */ + mapper() { + return { + required: false, + serializedName: 'DscConfiguration', + type: { + name: 'Composite', + className: 'DscConfiguration', + 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' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'Enum', + allowedValues: [ 'Succeeded' ] + } + }, + jobCount: { + required: false, + serializedName: 'properties.jobCount', + type: { + name: 'Number' + } + }, + parameters: { + required: false, + serializedName: 'properties.parameters', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'DscConfigurationParameterElementType', + type: { + name: 'Composite', + className: 'DscConfigurationParameter' + } + } + } + }, + source: { + required: false, + serializedName: 'properties.source', + type: { + name: 'Composite', + className: 'ContentSource' + } + }, + state: { + required: false, + serializedName: 'properties.state', + type: { + name: 'String' + } + }, + logVerbose: { + required: false, + serializedName: 'properties.logVerbose', + type: { + name: 'Boolean' + } + }, + creationTime: { + required: false, + serializedName: 'properties.creationTime', + type: { + name: 'DateTime' + } + }, + lastModifiedTime: { + required: false, + serializedName: 'properties.lastModifiedTime', + type: { + name: 'DateTime' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DscConfiguration; diff --git a/lib/services/automationManagement/lib/lib/models/dscConfigurationAssociationProperty.js b/lib/services/automationManagement/lib/lib/models/dscConfigurationAssociationProperty.js new file mode 100644 index 0000000000..3755ed8927 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/dscConfigurationAssociationProperty.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 Dsc configuration property associated with the entity. + * + */ +class DscConfigurationAssociationProperty { + /** + * Create a DscConfigurationAssociationProperty. + * @member {string} [name] Gets or sets the name of the Dsc configuration. + */ + constructor() { + } + + /** + * Defines the metadata of DscConfigurationAssociationProperty + * + * @returns {object} metadata of DscConfigurationAssociationProperty + * + */ + mapper() { + return { + required: false, + serializedName: 'DscConfigurationAssociationProperty', + type: { + name: 'Composite', + className: 'DscConfigurationAssociationProperty', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DscConfigurationAssociationProperty; diff --git a/lib/services/automationManagement/lib/lib/models/dscConfigurationCreateOrUpdateParameters.js b/lib/services/automationManagement/lib/lib/models/dscConfigurationCreateOrUpdateParameters.js new file mode 100644 index 0000000000..f821247894 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/dscConfigurationCreateOrUpdateParameters.js @@ -0,0 +1,137 @@ +/* + * 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 parameters supplied to the create or update configuration operation. + * + */ +class DscConfigurationCreateOrUpdateParameters { + /** + * Create a DscConfigurationCreateOrUpdateParameters. + * @member {boolean} [logVerbose] Gets or sets verbose log option. + * @member {boolean} [logProgress] Gets or sets progress log option. + * @member {object} source Gets or sets the source. + * @member {object} [source.hash] Gets or sets the hash. + * @member {string} [source.hash.algorithm] Gets or sets the content hash + * algorithm used to hash the content. + * @member {string} [source.hash.value] Gets or sets expected hash value of + * the content. + * @member {string} [source.type] Gets or sets the content source type. + * Possible values include: 'embeddedContent', 'uri' + * @member {string} [source.value] Gets or sets the value of the content. + * This is based on the content source type. + * @member {string} [source.version] Gets or sets the version of the content. + * @member {object} [parameters] Gets or sets the configuration parameters. + * @member {string} [description] Gets or sets the description of the + * configuration. + * @member {string} [name] Gets or sets name of the resource. + * @member {string} [location] Gets or sets the location of the resource. + * @member {object} [tags] Gets or sets the tags attached to the resource. + */ + constructor() { + } + + /** + * Defines the metadata of DscConfigurationCreateOrUpdateParameters + * + * @returns {object} metadata of DscConfigurationCreateOrUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'DscConfigurationCreateOrUpdateParameters', + type: { + name: 'Composite', + className: 'DscConfigurationCreateOrUpdateParameters', + modelProperties: { + logVerbose: { + required: false, + serializedName: 'properties.logVerbose', + type: { + name: 'Boolean' + } + }, + logProgress: { + required: false, + serializedName: 'properties.logProgress', + type: { + name: 'Boolean' + } + }, + source: { + required: true, + serializedName: 'properties.source', + type: { + name: 'Composite', + className: 'ContentSource' + } + }, + parameters: { + required: false, + serializedName: 'properties.parameters', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'DscConfigurationParameterElementType', + type: { + name: 'Composite', + className: 'DscConfigurationParameter' + } + } + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + 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 = DscConfigurationCreateOrUpdateParameters; diff --git a/lib/services/automationManagement/lib/lib/models/dscConfigurationListResult.js b/lib/services/automationManagement/lib/lib/models/dscConfigurationListResult.js new file mode 100644 index 0000000000..38653beb4a --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/dscConfigurationListResult.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'; + +/** + * The response model for the list configuration operation. + */ +class DscConfigurationListResult extends Array { + /** + * Create a DscConfigurationListResult. + * @member {string} [nextLink] Gets or sets the next link. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DscConfigurationListResult + * + * @returns {object} metadata of DscConfigurationListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'DscConfigurationListResult', + type: { + name: 'Composite', + className: 'DscConfigurationListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DscConfigurationElementType', + type: { + name: 'Composite', + className: 'DscConfiguration' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DscConfigurationListResult; diff --git a/lib/services/automationManagement/lib/lib/models/dscConfigurationParameter.js b/lib/services/automationManagement/lib/lib/models/dscConfigurationParameter.js new file mode 100644 index 0000000000..909e7f3db9 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/dscConfigurationParameter.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'; + +/** + * Definition of the configuration parameter type. + * + */ +class DscConfigurationParameter { + /** + * Create a DscConfigurationParameter. + * @member {string} [type] Gets or sets the type of the parameter. + * @member {boolean} [isMandatory] Gets or sets a Boolean value to indicate + * whether the parameter is madatory or not. + * @member {number} [position] Get or sets the position of the parameter. + * @member {string} [defaultValue] Gets or sets the default value of + * parameter. + */ + constructor() { + } + + /** + * Defines the metadata of DscConfigurationParameter + * + * @returns {object} metadata of DscConfigurationParameter + * + */ + mapper() { + return { + required: false, + serializedName: 'DscConfigurationParameter', + type: { + name: 'Composite', + className: 'DscConfigurationParameter', + modelProperties: { + type: { + required: false, + serializedName: 'type', + type: { + name: 'String' + } + }, + isMandatory: { + required: false, + serializedName: 'isMandatory', + type: { + name: 'Boolean' + } + }, + position: { + required: false, + serializedName: 'position', + type: { + name: 'Number' + } + }, + defaultValue: { + required: false, + serializedName: 'defaultValue', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DscConfigurationParameter; diff --git a/lib/services/automationManagement/lib/lib/models/dscConfigurationUpdateParameters.js b/lib/services/automationManagement/lib/lib/models/dscConfigurationUpdateParameters.js new file mode 100644 index 0000000000..a0fcd3d36d --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/dscConfigurationUpdateParameters.js @@ -0,0 +1,129 @@ +/* + * 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 parameters supplied to the create or update configuration operation. + * + */ +class DscConfigurationUpdateParameters { + /** + * Create a DscConfigurationUpdateParameters. + * @member {boolean} [logVerbose] Gets or sets verbose log option. + * @member {boolean} [logProgress] Gets or sets progress log option. + * @member {object} source Gets or sets the source. + * @member {object} [source.hash] Gets or sets the hash. + * @member {string} [source.hash.algorithm] Gets or sets the content hash + * algorithm used to hash the content. + * @member {string} [source.hash.value] Gets or sets expected hash value of + * the content. + * @member {string} [source.type] Gets or sets the content source type. + * Possible values include: 'embeddedContent', 'uri' + * @member {string} [source.value] Gets or sets the value of the content. + * This is based on the content source type. + * @member {string} [source.version] Gets or sets the version of the content. + * @member {object} [parameters] Gets or sets the configuration parameters. + * @member {string} [description] Gets or sets the description of the + * configuration. + * @member {string} [name] Gets or sets name of the resource. + * @member {object} [tags] Gets or sets the tags attached to the resource. + */ + constructor() { + } + + /** + * Defines the metadata of DscConfigurationUpdateParameters + * + * @returns {object} metadata of DscConfigurationUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'DscConfigurationUpdateParameters', + type: { + name: 'Composite', + className: 'DscConfigurationUpdateParameters', + modelProperties: { + logVerbose: { + required: false, + serializedName: 'properties.logVerbose', + type: { + name: 'Boolean' + } + }, + logProgress: { + required: false, + serializedName: 'properties.logProgress', + type: { + name: 'Boolean' + } + }, + source: { + required: true, + serializedName: 'properties.source', + type: { + name: 'Composite', + className: 'ContentSource' + } + }, + parameters: { + required: false, + serializedName: 'properties.parameters', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'DscConfigurationParameterElementType', + type: { + name: 'Composite', + className: 'DscConfigurationParameter' + } + } + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = DscConfigurationUpdateParameters; diff --git a/lib/services/automationManagement/lib/lib/models/dscMetaConfiguration.js b/lib/services/automationManagement/lib/lib/models/dscMetaConfiguration.js new file mode 100644 index 0000000000..a3043ee993 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/dscMetaConfiguration.js @@ -0,0 +1,107 @@ +/* + * 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'; + +/** + * Definition of the DSC Meta Configuration. + * + */ +class DscMetaConfiguration { + /** + * Create a DscMetaConfiguration. + * @member {number} [configurationModeFrequencyMins] Gets or sets the + * ConfigurationModeFrequencyMins value of the meta configuration. + * @member {boolean} [rebootNodeIfNeeded] Gets or sets the RebootNodeIfNeeded + * value of the meta configuration. + * @member {string} [configurationMode] Gets or sets the ConfigurationMode + * value of the meta configuration. + * @member {string} [actionAfterReboot] Gets or sets the ActionAfterReboot + * value of the meta configuration. + * @member {string} [certificateId] Gets or sets the CertificateId value of + * the meta configuration. + * @member {number} [refreshFrequencyMins] Gets or sets the + * RefreshFrequencyMins value of the meta configuration. + * @member {boolean} [allowModuleOverwrite] Gets or sets the + * AllowModuleOverwrite value of the meta configuration. + */ + constructor() { + } + + /** + * Defines the metadata of DscMetaConfiguration + * + * @returns {object} metadata of DscMetaConfiguration + * + */ + mapper() { + return { + required: false, + serializedName: 'DscMetaConfiguration', + type: { + name: 'Composite', + className: 'DscMetaConfiguration', + modelProperties: { + configurationModeFrequencyMins: { + required: false, + serializedName: 'configurationModeFrequencyMins', + type: { + name: 'Number' + } + }, + rebootNodeIfNeeded: { + required: false, + serializedName: 'rebootNodeIfNeeded', + type: { + name: 'Boolean' + } + }, + configurationMode: { + required: false, + serializedName: 'configurationMode', + type: { + name: 'String' + } + }, + actionAfterReboot: { + required: false, + serializedName: 'actionAfterReboot', + type: { + name: 'String' + } + }, + certificateId: { + required: false, + serializedName: 'certificateId', + type: { + name: 'String' + } + }, + refreshFrequencyMins: { + required: false, + serializedName: 'refreshFrequencyMins', + type: { + name: 'Number' + } + }, + allowModuleOverwrite: { + required: false, + serializedName: 'allowModuleOverwrite', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = DscMetaConfiguration; diff --git a/lib/services/automationManagement/lib/lib/models/dscNode.js b/lib/services/automationManagement/lib/lib/models/dscNode.js new file mode 100644 index 0000000000..94a9a48fee --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/dscNode.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'); + +/** + * Definition of a DscNode + * + * @extends models['ProxyResource'] + */ +class DscNode extends models['ProxyResource'] { + /** + * Create a DscNode. + * @member {date} [lastSeen] Gets or sets the last seen time of the node. + * @member {date} [registrationTime] Gets or sets the registration time of + * the node. + * @member {string} [ip] Gets or sets the ip of the node. + * @member {string} [accountId] Gets or sets the account id of the node. + * @member {string} [dscNodeName] Gets or sets the name of the dsc + * nodeconfiguration. + * @member {string} [status] Gets or sets the status of the node. + * @member {string} [nodeId] Gets or sets the node id. + * @member {string} [etag] Gets or sets the etag of the resource. + * @member {array} [extensionHandler] Gets or sets the list of + * extensionHandler properties for a Node. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DscNode + * + * @returns {object} metadata of DscNode + * + */ + mapper() { + return { + required: false, + serializedName: 'DscNode', + type: { + name: 'Composite', + className: 'DscNode', + 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' + } + }, + lastSeen: { + required: false, + serializedName: 'properties.lastSeen', + type: { + name: 'DateTime' + } + }, + registrationTime: { + required: false, + serializedName: 'properties.registrationTime', + type: { + name: 'DateTime' + } + }, + ip: { + required: false, + serializedName: 'properties.ip', + type: { + name: 'String' + } + }, + accountId: { + required: false, + serializedName: 'properties.accountId', + type: { + name: 'String' + } + }, + dscNodeName: { + required: false, + serializedName: 'properties.nodeConfiguration.name', + type: { + name: 'String' + } + }, + status: { + required: false, + serializedName: 'properties.status', + type: { + name: 'String' + } + }, + nodeId: { + required: false, + serializedName: 'properties.nodeId', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'properties.etag', + type: { + name: 'String' + } + }, + extensionHandler: { + required: false, + serializedName: 'properties.extensionHandler', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DscNodeExtensionHandlerAssociationPropertyElementType', + type: { + name: 'Composite', + className: 'DscNodeExtensionHandlerAssociationProperty' + } + } + } + } + } + } + }; + } +} + +module.exports = DscNode; diff --git a/lib/services/automationManagement/lib/lib/models/dscNodeConfiguration.js b/lib/services/automationManagement/lib/lib/models/dscNodeConfiguration.js new file mode 100644 index 0000000000..82ce02c8ec --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/dscNodeConfiguration.js @@ -0,0 +1,126 @@ +/* + * 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'); + +/** + * Definition of the dsc node configuration. + * + * @extends models['ProxyResource'] + */ +class DscNodeConfiguration extends models['ProxyResource'] { + /** + * Create a DscNodeConfiguration. + * @member {date} [lastModifiedTime] Gets or sets the last modified time. + * @member {date} [creationTime] Gets or sets creation time. + * @member {object} [configuration] Gets or sets the configuration of the + * node. + * @member {string} [configuration.name] Gets or sets the name of the Dsc + * configuration. + * @member {string} [source] Source of node configuration. + * @member {number} [nodeCount] Number of nodes with this nodeconfiguration + * assigned + * @member {boolean} [incrementNodeConfigurationBuild] If a new build version + * of NodeConfiguration is required. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DscNodeConfiguration + * + * @returns {object} metadata of DscNodeConfiguration + * + */ + mapper() { + return { + required: false, + serializedName: 'DscNodeConfiguration', + type: { + name: 'Composite', + className: 'DscNodeConfiguration', + 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' + } + }, + lastModifiedTime: { + required: false, + serializedName: 'properties.lastModifiedTime', + type: { + name: 'DateTime' + } + }, + creationTime: { + required: false, + serializedName: 'properties.creationTime', + type: { + name: 'DateTime' + } + }, + configuration: { + required: false, + serializedName: 'properties.configuration', + type: { + name: 'Composite', + className: 'DscConfigurationAssociationProperty' + } + }, + source: { + required: false, + serializedName: 'properties.source', + type: { + name: 'String' + } + }, + nodeCount: { + required: false, + serializedName: 'properties.nodeCount', + type: { + name: 'Number' + } + }, + incrementNodeConfigurationBuild: { + required: false, + serializedName: 'properties.incrementNodeConfigurationBuild', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = DscNodeConfiguration; diff --git a/lib/services/automationManagement/lib/lib/models/dscNodeConfigurationAssociationProperty.js b/lib/services/automationManagement/lib/lib/models/dscNodeConfigurationAssociationProperty.js new file mode 100644 index 0000000000..edf421b664 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/dscNodeConfigurationAssociationProperty.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'; + +/** + * The dsc nodeconfiguration property associated with the entity. + * + */ +class DscNodeConfigurationAssociationProperty { + /** + * Create a DscNodeConfigurationAssociationProperty. + * @member {string} [name] Gets or sets the name of the dsc + * nodeconfiguration. + */ + constructor() { + } + + /** + * Defines the metadata of DscNodeConfigurationAssociationProperty + * + * @returns {object} metadata of DscNodeConfigurationAssociationProperty + * + */ + mapper() { + return { + required: false, + serializedName: 'DscNodeConfigurationAssociationProperty', + type: { + name: 'Composite', + className: 'DscNodeConfigurationAssociationProperty', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DscNodeConfigurationAssociationProperty; diff --git a/lib/services/automationManagement/lib/lib/models/dscNodeConfigurationCreateOrUpdateParameters.js b/lib/services/automationManagement/lib/lib/models/dscNodeConfigurationCreateOrUpdateParameters.js new file mode 100644 index 0000000000..35c2d9a93e --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/dscNodeConfigurationCreateOrUpdateParameters.js @@ -0,0 +1,94 @@ +/* + * 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 parameters supplied to the create or update node configuration + * operation. + * + */ +class DscNodeConfigurationCreateOrUpdateParameters { + /** + * Create a DscNodeConfigurationCreateOrUpdateParameters. + * @member {object} source Gets or sets the source. + * @member {object} [source.hash] Gets or sets the hash. + * @member {string} [source.hash.algorithm] Gets or sets the content hash + * algorithm used to hash the content. + * @member {string} [source.hash.value] Gets or sets expected hash value of + * the content. + * @member {string} [source.type] Gets or sets the content source type. + * Possible values include: 'embeddedContent', 'uri' + * @member {string} [source.value] Gets or sets the value of the content. + * This is based on the content source type. + * @member {string} [source.version] Gets or sets the version of the content. + * @member {string} name Gets or sets the type of the parameter. + * @member {object} configuration Gets or sets the configuration of the node. + * @member {string} [configuration.name] Gets or sets the name of the Dsc + * configuration. + * @member {boolean} [newNodeConfigurationBuildVersionRequired] If a new + * build version of NodeConfiguration is required. + */ + constructor() { + } + + /** + * Defines the metadata of DscNodeConfigurationCreateOrUpdateParameters + * + * @returns {object} metadata of DscNodeConfigurationCreateOrUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'DscNodeConfigurationCreateOrUpdateParameters', + type: { + name: 'Composite', + className: 'DscNodeConfigurationCreateOrUpdateParameters', + modelProperties: { + source: { + required: true, + serializedName: 'source', + type: { + name: 'Composite', + className: 'ContentSource' + } + }, + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + configuration: { + required: true, + serializedName: 'configuration', + type: { + name: 'Composite', + className: 'DscConfigurationAssociationProperty' + } + }, + newNodeConfigurationBuildVersionRequired: { + required: false, + serializedName: 'newNodeConfigurationBuildVersionRequired', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = DscNodeConfigurationCreateOrUpdateParameters; diff --git a/lib/services/automationManagement/lib/lib/models/dscNodeConfigurationCreateOrUpdateParametersProperties.js b/lib/services/automationManagement/lib/lib/models/dscNodeConfigurationCreateOrUpdateParametersProperties.js new file mode 100644 index 0000000000..077e9bb237 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/dscNodeConfigurationCreateOrUpdateParametersProperties.js @@ -0,0 +1,94 @@ +/* + * 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 parameters supplied to the create or update node configuration + * operation. + * + */ +class DscNodeConfigurationCreateOrUpdateParametersProperties { + /** + * Create a DscNodeConfigurationCreateOrUpdateParametersProperties. + * @member {object} source Gets or sets the source. + * @member {object} [source.hash] Gets or sets the hash. + * @member {string} [source.hash.algorithm] Gets or sets the content hash + * algorithm used to hash the content. + * @member {string} [source.hash.value] Gets or sets expected hash value of + * the content. + * @member {string} [source.type] Gets or sets the content source type. + * Possible values include: 'embeddedContent', 'uri' + * @member {string} [source.value] Gets or sets the value of the content. + * This is based on the content source type. + * @member {string} [source.version] Gets or sets the version of the content. + * @member {string} name Gets or sets the type of the parameter. + * @member {object} configuration Gets or sets the configuration of the node. + * @member {string} [configuration.name] Gets or sets the name of the Dsc + * configuration. + * @member {boolean} [incrementNodeConfigurationBuild] If a new build version + * of NodeConfiguration is required. + */ + constructor() { + } + + /** + * Defines the metadata of DscNodeConfigurationCreateOrUpdateParametersProperties + * + * @returns {object} metadata of DscNodeConfigurationCreateOrUpdateParametersProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'DscNodeConfigurationCreateOrUpdateParametersProperties', + type: { + name: 'Composite', + className: 'DscNodeConfigurationCreateOrUpdateParametersProperties', + modelProperties: { + source: { + required: true, + serializedName: 'source', + type: { + name: 'Composite', + className: 'ContentSource' + } + }, + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + configuration: { + required: true, + serializedName: 'configuration', + type: { + name: 'Composite', + className: 'DscConfigurationAssociationProperty' + } + }, + incrementNodeConfigurationBuild: { + required: false, + serializedName: 'incrementNodeConfigurationBuild', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = DscNodeConfigurationCreateOrUpdateParametersProperties; diff --git a/lib/services/automationManagement/lib/lib/models/dscNodeConfigurationListResult.js b/lib/services/automationManagement/lib/lib/models/dscNodeConfigurationListResult.js new file mode 100644 index 0000000000..8cdad3ff3d --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/dscNodeConfigurationListResult.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'; + +/** + * The response model for the list job operation. + */ +class DscNodeConfigurationListResult extends Array { + /** + * Create a DscNodeConfigurationListResult. + * @member {string} [nextLink] Gets or sets the next link. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DscNodeConfigurationListResult + * + * @returns {object} metadata of DscNodeConfigurationListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'DscNodeConfigurationListResult', + type: { + name: 'Composite', + className: 'DscNodeConfigurationListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DscNodeConfigurationElementType', + type: { + name: 'Composite', + className: 'DscNodeConfiguration' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DscNodeConfigurationListResult; diff --git a/lib/services/automationManagement/lib/lib/models/dscNodeExtensionHandlerAssociationProperty.js b/lib/services/automationManagement/lib/lib/models/dscNodeExtensionHandlerAssociationProperty.js new file mode 100644 index 0000000000..1f97fc4e80 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/dscNodeExtensionHandlerAssociationProperty.js @@ -0,0 +1,61 @@ +/* + * 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 dsc extensionHandler property associated with the node + * + */ +class DscNodeExtensionHandlerAssociationProperty { + /** + * Create a DscNodeExtensionHandlerAssociationProperty. + * @member {string} [name] Gets or sets the name of the extension handler. + * @member {string} [version] Gets or sets the version of the extension + * handler. + */ + constructor() { + } + + /** + * Defines the metadata of DscNodeExtensionHandlerAssociationProperty + * + * @returns {object} metadata of DscNodeExtensionHandlerAssociationProperty + * + */ + mapper() { + return { + required: false, + serializedName: 'DscNodeExtensionHandlerAssociationProperty', + type: { + name: 'Composite', + className: 'DscNodeExtensionHandlerAssociationProperty', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + version: { + required: false, + serializedName: 'version', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DscNodeExtensionHandlerAssociationProperty; diff --git a/lib/services/automationManagement/lib/lib/models/dscNodeListResult.js b/lib/services/automationManagement/lib/lib/models/dscNodeListResult.js new file mode 100644 index 0000000000..800ae685e9 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/dscNodeListResult.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'; + +/** + * The response model for the list dsc nodes operation. + */ +class DscNodeListResult extends Array { + /** + * Create a DscNodeListResult. + * @member {string} [nextLink] Gets or sets the next link. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DscNodeListResult + * + * @returns {object} metadata of DscNodeListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'DscNodeListResult', + type: { + name: 'Composite', + className: 'DscNodeListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DscNodeElementType', + type: { + name: 'Composite', + className: 'DscNode' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DscNodeListResult; diff --git a/lib/services/automationManagement/lib/lib/models/dscNodeReport.js b/lib/services/automationManagement/lib/lib/models/dscNodeReport.js new file mode 100644 index 0000000000..b60522bf39 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/dscNodeReport.js @@ -0,0 +1,255 @@ +/* + * 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'); + +/** + * Definition of the dsc node report type. + * + */ +class DscNodeReport { + /** + * Create a DscNodeReport. + * @member {date} [endTime] Gets or sets the end time of the node report. + * @member {date} [lastModifiedTime] Gets or sets the lastModifiedTime of the + * node report. + * @member {date} [startTime] Gets or sets the start time of the node report. + * @member {string} [type] Gets or sets the type of the node report. + * @member {string} [reportId] Gets or sets the id of the node report. + * @member {string} [status] Gets or sets the status of the node report. + * @member {string} [refreshMode] Gets or sets the refreshMode of the node + * report. + * @member {string} [rebootRequested] Gets or sets the rebootRequested of the + * node report. + * @member {string} [reportFormatVersion] Gets or sets the + * reportFormatVersion of the node report. + * @member {string} [configurationVersion] Gets or sets the + * configurationVersion of the node report. + * @member {string} [id] Gets or sets the id. + * @member {array} [errors] Gets or sets the errors for the node report. + * @member {array} [resources] Gets or sets the resource for the node report. + * @member {object} [metaConfiguration] Gets or sets the metaConfiguration of + * the node at the time of the report. + * @member {number} [metaConfiguration.configurationModeFrequencyMins] Gets + * or sets the ConfigurationModeFrequencyMins value of the meta + * configuration. + * @member {boolean} [metaConfiguration.rebootNodeIfNeeded] Gets or sets the + * RebootNodeIfNeeded value of the meta configuration. + * @member {string} [metaConfiguration.configurationMode] Gets or sets the + * ConfigurationMode value of the meta configuration. + * @member {string} [metaConfiguration.actionAfterReboot] Gets or sets the + * ActionAfterReboot value of the meta configuration. + * @member {string} [metaConfiguration.certificateId] Gets or sets the + * CertificateId value of the meta configuration. + * @member {number} [metaConfiguration.refreshFrequencyMins] Gets or sets the + * RefreshFrequencyMins value of the meta configuration. + * @member {boolean} [metaConfiguration.allowModuleOverwrite] Gets or sets + * the AllowModuleOverwrite value of the meta configuration. + * @member {string} [hostName] Gets or sets the hostname of the node that + * sent the report. + * @member {array} [iPV4Addresses] Gets or sets the IPv4 address of the node + * that sent the report. + * @member {array} [iPV6Addresses] Gets or sets the IPv6 address of the node + * that sent the report. + * @member {number} [numberOfResources] Gets or sets the number of resource + * in the node report. + * @member {string} [rawErrors] Gets or sets the unparsed errors for the node + * report. + */ + constructor() { + } + + /** + * Defines the metadata of DscNodeReport + * + * @returns {object} metadata of DscNodeReport + * + */ + mapper() { + return { + required: false, + serializedName: 'DscNodeReport', + type: { + name: 'Composite', + className: 'DscNodeReport', + modelProperties: { + endTime: { + required: false, + serializedName: 'endTime', + type: { + name: 'DateTime' + } + }, + lastModifiedTime: { + required: false, + serializedName: 'lastModifiedTime', + type: { + name: 'DateTime' + } + }, + startTime: { + required: false, + serializedName: 'startTime', + type: { + name: 'DateTime' + } + }, + type: { + required: false, + serializedName: 'type', + type: { + name: 'String' + } + }, + reportId: { + required: false, + serializedName: 'reportId', + type: { + name: 'String' + } + }, + status: { + required: false, + serializedName: 'status', + type: { + name: 'String' + } + }, + refreshMode: { + required: false, + serializedName: 'refreshMode', + type: { + name: 'String' + } + }, + rebootRequested: { + required: false, + serializedName: 'rebootRequested', + type: { + name: 'String' + } + }, + reportFormatVersion: { + required: false, + serializedName: 'reportFormatVersion', + type: { + name: 'String' + } + }, + configurationVersion: { + required: false, + serializedName: 'configurationVersion', + type: { + name: 'String' + } + }, + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + errors: { + required: false, + serializedName: 'errors', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DscReportErrorElementType', + type: { + name: 'Composite', + className: 'DscReportError' + } + } + } + }, + resources: { + required: false, + serializedName: 'resources', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DscReportResourceElementType', + type: { + name: 'Composite', + className: 'DscReportResource' + } + } + } + }, + metaConfiguration: { + required: false, + serializedName: 'metaConfiguration', + type: { + name: 'Composite', + className: 'DscMetaConfiguration' + } + }, + hostName: { + required: false, + serializedName: 'hostName', + type: { + name: 'String' + } + }, + iPV4Addresses: { + required: false, + serializedName: 'iPV4Addresses', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + iPV6Addresses: { + required: false, + serializedName: 'iPV6Addresses', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + numberOfResources: { + required: false, + serializedName: 'numberOfResources', + type: { + name: 'Number' + } + }, + rawErrors: { + required: false, + serializedName: 'rawErrors', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DscNodeReport; diff --git a/lib/services/automationManagement/lib/lib/models/dscNodeReportListResult.js b/lib/services/automationManagement/lib/lib/models/dscNodeReportListResult.js new file mode 100644 index 0000000000..f98497f1a0 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/dscNodeReportListResult.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'; + +/** + * The response model for the list dsc nodes operation. + */ +class DscNodeReportListResult extends Array { + /** + * Create a DscNodeReportListResult. + * @member {string} [nextLink] Gets or sets the next link. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DscNodeReportListResult + * + * @returns {object} metadata of DscNodeReportListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'DscNodeReportListResult', + type: { + name: 'Composite', + className: 'DscNodeReportListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DscNodeReportElementType', + type: { + name: 'Composite', + className: 'DscNodeReport' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DscNodeReportListResult; diff --git a/lib/services/automationManagement/lib/lib/models/dscNodeUpdateParameters.js b/lib/services/automationManagement/lib/lib/models/dscNodeUpdateParameters.js new file mode 100644 index 0000000000..b5bb93583d --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/dscNodeUpdateParameters.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'; + +const models = require('./index'); + +/** + * The parameters supplied to the update dsc node operation. + * + */ +class DscNodeUpdateParameters { + /** + * Create a DscNodeUpdateParameters. + * @member {string} [nodeId] Gets or sets the id of the dsc node. + * @member {object} [nodeConfiguration] Gets or sets the configuration of the + * node. + * @member {string} [nodeConfiguration.name] Gets or sets the name of the dsc + * nodeconfiguration. + * @member {object} [properties] + * @member {string} [properties.name] Gets or sets the name of the dsc + * nodeconfiguration. + */ + constructor() { + } + + /** + * Defines the metadata of DscNodeUpdateParameters + * + * @returns {object} metadata of DscNodeUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'DscNodeUpdateParameters', + type: { + name: 'Composite', + className: 'DscNodeUpdateParameters', + modelProperties: { + nodeId: { + required: false, + serializedName: 'nodeId', + type: { + name: 'String' + } + }, + nodeConfiguration: { + required: false, + serializedName: 'nodeConfiguration', + type: { + name: 'Composite', + className: 'DscNodeConfigurationAssociationProperty' + } + }, + properties: { + required: false, + serializedName: 'properties', + type: { + name: 'Composite', + className: 'DscNodeUpdateParametersProperties' + } + } + } + } + }; + } +} + +module.exports = DscNodeUpdateParameters; diff --git a/lib/services/automationManagement/lib/lib/models/dscNodeUpdateParametersProperties.js b/lib/services/automationManagement/lib/lib/models/dscNodeUpdateParametersProperties.js new file mode 100644 index 0000000000..98c1f8dc94 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/dscNodeUpdateParametersProperties.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'; + +/** + * Class representing a DscNodeUpdateParametersProperties. + */ +class DscNodeUpdateParametersProperties { + /** + * Create a DscNodeUpdateParametersProperties. + * @member {string} [name] Gets or sets the name of the dsc + * nodeconfiguration. + */ + constructor() { + } + + /** + * Defines the metadata of DscNodeUpdateParametersProperties + * + * @returns {object} metadata of DscNodeUpdateParametersProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'DscNodeUpdateParameters_properties', + type: { + name: 'Composite', + className: 'DscNodeUpdateParametersProperties', + modelProperties: { + name: { + required: false, + serializedName: 'nodeConfiguration.name', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DscNodeUpdateParametersProperties; diff --git a/lib/services/automationManagement/lib/lib/models/dscReportError.js b/lib/services/automationManagement/lib/lib/models/dscReportError.js new file mode 100644 index 0000000000..d06f3d6110 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/dscReportError.js @@ -0,0 +1,93 @@ +/* + * 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'; + +/** + * Definition of the dsc node report error type. + * + */ +class DscReportError { + /** + * Create a DscReportError. + * @member {string} [errorSource] Gets or sets the source of the error. + * @member {string} [resourceId] Gets or sets the resource ID which generated + * the error. + * @member {string} [errorCode] Gets or sets the error code. + * @member {string} [errorMessage] Gets or sets the error message. + * @member {string} [locale] Gets or sets the locale of the error. + * @member {string} [errorDetails] Gets or sets the error details. + */ + constructor() { + } + + /** + * Defines the metadata of DscReportError + * + * @returns {object} metadata of DscReportError + * + */ + mapper() { + return { + required: false, + serializedName: 'DscReportError', + type: { + name: 'Composite', + className: 'DscReportError', + modelProperties: { + errorSource: { + required: false, + serializedName: 'errorSource', + type: { + name: 'String' + } + }, + resourceId: { + required: false, + serializedName: 'resourceId', + type: { + name: 'String' + } + }, + errorCode: { + required: false, + serializedName: 'errorCode', + type: { + name: 'String' + } + }, + errorMessage: { + required: false, + serializedName: 'errorMessage', + type: { + name: 'String' + } + }, + locale: { + required: false, + serializedName: 'locale', + type: { + name: 'String' + } + }, + errorDetails: { + required: false, + serializedName: 'errorDetails', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DscReportError; diff --git a/lib/services/automationManagement/lib/lib/models/dscReportResource.js b/lib/services/automationManagement/lib/lib/models/dscReportResource.js new file mode 100644 index 0000000000..8d2c7b7f14 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/dscReportResource.js @@ -0,0 +1,139 @@ +/* + * 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'); + +/** + * Definition of the DSC Report Resource. + * + */ +class DscReportResource { + /** + * Create a DscReportResource. + * @member {string} [resourceId] Gets or sets the ID of the resource. + * @member {string} [sourceInfo] Gets or sets the source info of the + * resource. + * @member {array} [dependsOn] Gets or sets the Resource Navigation values + * for resources the resource depends on. + * @member {string} [moduleName] Gets or sets the module name of the + * resource. + * @member {string} [moduleVersion] Gets or sets the module version of the + * resource. + * @member {string} [resourceName] Gets or sets the name of the resource. + * @member {string} [error] Gets or sets the error of the resource. + * @member {string} [status] Gets or sets the status of the resource. + * @member {number} [durationInSeconds] Gets or sets the duration in seconds + * for the resource. + * @member {date} [startDate] Gets or sets the start date of the resource. + */ + constructor() { + } + + /** + * Defines the metadata of DscReportResource + * + * @returns {object} metadata of DscReportResource + * + */ + mapper() { + return { + required: false, + serializedName: 'DscReportResource', + type: { + name: 'Composite', + className: 'DscReportResource', + modelProperties: { + resourceId: { + required: false, + serializedName: 'resourceId', + type: { + name: 'String' + } + }, + sourceInfo: { + required: false, + serializedName: 'sourceInfo', + type: { + name: 'String' + } + }, + dependsOn: { + required: false, + serializedName: 'dependsOn', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DscReportResourceNavigationElementType', + type: { + name: 'Composite', + className: 'DscReportResourceNavigation' + } + } + } + }, + moduleName: { + required: false, + serializedName: 'moduleName', + type: { + name: 'String' + } + }, + moduleVersion: { + required: false, + serializedName: 'moduleVersion', + type: { + name: 'String' + } + }, + resourceName: { + required: false, + serializedName: 'resourceName', + type: { + name: 'String' + } + }, + error: { + required: false, + serializedName: 'error', + type: { + name: 'String' + } + }, + status: { + required: false, + serializedName: 'status', + type: { + name: 'String' + } + }, + durationInSeconds: { + required: false, + serializedName: 'durationInSeconds', + type: { + name: 'Number' + } + }, + startDate: { + required: false, + serializedName: 'startDate', + type: { + name: 'DateTime' + } + } + } + } + }; + } +} + +module.exports = DscReportResource; diff --git a/lib/services/automationManagement/lib/lib/models/dscReportResourceNavigation.js b/lib/services/automationManagement/lib/lib/models/dscReportResourceNavigation.js new file mode 100644 index 0000000000..08b91a2b90 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/dscReportResourceNavigation.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'; + +/** + * Navigation for DSC Report Resource. + * + */ +class DscReportResourceNavigation { + /** + * Create a DscReportResourceNavigation. + * @member {string} [resourceId] Gets or sets the ID of the resource to + * navigate to. + */ + constructor() { + } + + /** + * Defines the metadata of DscReportResourceNavigation + * + * @returns {object} metadata of DscReportResourceNavigation + * + */ + mapper() { + return { + required: false, + serializedName: 'DscReportResourceNavigation', + type: { + name: 'Composite', + className: 'DscReportResourceNavigation', + modelProperties: { + resourceId: { + required: false, + serializedName: 'resourceId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DscReportResourceNavigation; diff --git a/lib/services/automationManagement/lib/lib/models/errorResponse.js b/lib/services/automationManagement/lib/lib/models/errorResponse.js new file mode 100644 index 0000000000..c2c14698c9 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/errorResponse.js @@ -0,0 +1,61 @@ +/* + * 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'; + +/** + * Error response of an operation failure + * + */ +class ErrorResponse { + /** + * Create a ErrorResponse. + * @member {string} [code] Error code + * @member {string} [message] Error message indicating why the operation + * failed. + */ + constructor() { + } + + /** + * Defines the metadata of ErrorResponse + * + * @returns {object} metadata of ErrorResponse + * + */ + mapper() { + return { + required: false, + serializedName: 'ErrorResponse', + type: { + name: 'Composite', + className: 'ErrorResponse', + modelProperties: { + code: { + required: false, + serializedName: 'code', + type: { + name: 'String' + } + }, + message: { + required: false, + serializedName: 'message', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ErrorResponse; diff --git a/lib/services/automationManagement/lib/lib/models/fieldDefinition.js b/lib/services/automationManagement/lib/lib/models/fieldDefinition.js new file mode 100644 index 0000000000..27b90c9bec --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/fieldDefinition.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'; + +/** + * Definition of the connection fields. + * + */ +class FieldDefinition { + /** + * Create a FieldDefinition. + * @member {boolean} [isEncrypted] Gets or sets the isEncrypted flag of the + * connection field definition. + * @member {boolean} [isOptional] Gets or sets the isOptional flag of the + * connection field definition. + * @member {string} type Gets or sets the type of the connection field + * definition. + */ + constructor() { + } + + /** + * Defines the metadata of FieldDefinition + * + * @returns {object} metadata of FieldDefinition + * + */ + mapper() { + return { + required: false, + serializedName: 'FieldDefinition', + type: { + name: 'Composite', + className: 'FieldDefinition', + modelProperties: { + isEncrypted: { + required: false, + serializedName: 'isEncrypted', + type: { + name: 'Boolean' + } + }, + isOptional: { + required: false, + serializedName: 'isOptional', + type: { + name: 'Boolean' + } + }, + type: { + required: true, + serializedName: 'type', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = FieldDefinition; diff --git a/lib/services/automationManagement/lib/lib/models/hybridRunbookWorker.js b/lib/services/automationManagement/lib/lib/models/hybridRunbookWorker.js new file mode 100644 index 0000000000..b5d30a8689 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/hybridRunbookWorker.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'; + +/** + * Definition of hybrid runbook worker. + * + */ +class HybridRunbookWorker { + /** + * Create a HybridRunbookWorker. + * @member {string} [name] Gets or sets the worker machine name. + * @member {string} [ip] Gets or sets the assigned machine IP address. + * @member {date} [registrationTime] Gets or sets the registration time of + * the worker machine. + */ + constructor() { + } + + /** + * Defines the metadata of HybridRunbookWorker + * + * @returns {object} metadata of HybridRunbookWorker + * + */ + mapper() { + return { + required: false, + serializedName: 'HybridRunbookWorker', + type: { + name: 'Composite', + className: 'HybridRunbookWorker', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + ip: { + required: false, + serializedName: 'ip', + type: { + name: 'String' + } + }, + registrationTime: { + required: false, + serializedName: 'registrationTime', + type: { + name: 'DateTime' + } + } + } + } + }; + } +} + +module.exports = HybridRunbookWorker; diff --git a/lib/services/automationManagement/lib/lib/models/hybridRunbookWorkerGroup.js b/lib/services/automationManagement/lib/lib/models/hybridRunbookWorkerGroup.js new file mode 100644 index 0000000000..e9637e1e56 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/hybridRunbookWorkerGroup.js @@ -0,0 +1,90 @@ +/* + * 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'); + +/** + * Definition of hybrid runbook worker group. + * + */ +class HybridRunbookWorkerGroup { + /** + * Create a HybridRunbookWorkerGroup. + * @member {string} [id] Gets or sets the id of the resource. + * @member {string} [name] Gets or sets the name of the group. + * @member {array} [hybridRunbookWorkers] Gets or sets the list of hybrid + * runbook workers. + * @member {object} [credential] Sets the credential of a worker group. + * @member {string} [credential.name] Gets or sets the name of the + * credential. + */ + constructor() { + } + + /** + * Defines the metadata of HybridRunbookWorkerGroup + * + * @returns {object} metadata of HybridRunbookWorkerGroup + * + */ + mapper() { + return { + required: false, + serializedName: 'HybridRunbookWorkerGroup', + type: { + name: 'Composite', + className: 'HybridRunbookWorkerGroup', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + hybridRunbookWorkers: { + required: false, + serializedName: 'hybridRunbookWorkers', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'HybridRunbookWorkerElementType', + type: { + name: 'Composite', + className: 'HybridRunbookWorker' + } + } + } + }, + credential: { + required: false, + serializedName: 'credential', + type: { + name: 'Composite', + className: 'RunAsCredentialAssociationProperty' + } + } + } + } + }; + } +} + +module.exports = HybridRunbookWorkerGroup; diff --git a/lib/services/automationManagement/lib/lib/models/hybridRunbookWorkerGroupUpdateParameters.js b/lib/services/automationManagement/lib/lib/models/hybridRunbookWorkerGroupUpdateParameters.js new file mode 100644 index 0000000000..daa66160b4 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/hybridRunbookWorkerGroupUpdateParameters.js @@ -0,0 +1,57 @@ +/* + * 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'); + +/** + * Parameters supplied to the update operation. + * + */ +class HybridRunbookWorkerGroupUpdateParameters { + /** + * Create a HybridRunbookWorkerGroupUpdateParameters. + * @member {object} [credential] Sets the credential of a worker group. + * @member {string} [credential.name] Gets or sets the name of the + * credential. + */ + constructor() { + } + + /** + * Defines the metadata of HybridRunbookWorkerGroupUpdateParameters + * + * @returns {object} metadata of HybridRunbookWorkerGroupUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'HybridRunbookWorkerGroupUpdateParameters', + type: { + name: 'Composite', + className: 'HybridRunbookWorkerGroupUpdateParameters', + modelProperties: { + credential: { + required: false, + serializedName: 'credential', + type: { + name: 'Composite', + className: 'RunAsCredentialAssociationProperty' + } + } + } + } + }; + } +} + +module.exports = HybridRunbookWorkerGroupUpdateParameters; diff --git a/lib/services/automationManagement/lib/lib/models/hybridRunbookWorkerGroupsListResult.js b/lib/services/automationManagement/lib/lib/models/hybridRunbookWorkerGroupsListResult.js new file mode 100644 index 0000000000..7599d2c57b --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/hybridRunbookWorkerGroupsListResult.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'; + +/** + * The response model for the list hybrid runbook worker groups. + */ +class HybridRunbookWorkerGroupsListResult extends Array { + /** + * Create a HybridRunbookWorkerGroupsListResult. + * @member {string} [nextLink] Gets or sets the next link. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of HybridRunbookWorkerGroupsListResult + * + * @returns {object} metadata of HybridRunbookWorkerGroupsListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'HybridRunbookWorkerGroupsListResult', + type: { + name: 'Composite', + className: 'HybridRunbookWorkerGroupsListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'HybridRunbookWorkerGroupElementType', + type: { + name: 'Composite', + className: 'HybridRunbookWorkerGroup' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = HybridRunbookWorkerGroupsListResult; diff --git a/lib/services/automationManagement/lib/lib/models/index.d.ts b/lib/services/automationManagement/lib/lib/models/index.d.ts new file mode 100644 index 0000000000..6c24f4b0f5 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/index.d.ts @@ -0,0 +1,3351 @@ +/* + * 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 ErrorResponse class. + * @constructor + * Error response of an operation failure + * + * @member {string} [code] Error code + * @member {string} [message] Error message indicating why the operation + * failed. + */ +export interface ErrorResponse { + code?: string; + message?: string; +} + +/** + * @class + * Initializes a new instance of the Key class. + * @constructor + * Automation key which is used to register a DSC Node + * + * @member {string} [keyName] Automation key name. Possible values include: + * 'primary', 'secondary' + * @member {string} [permissions] Automation key permissions. Possible values + * include: 'Full' + * @member {string} [value] Value of the Automation Key used for registration. + */ +export interface Key { + keyName?: string; + permissions?: string; + value?: string; +} + +/** + * @class + * Initializes a new instance of the UsageCounterName class. + * @constructor + * Definition of usage counter name. + * + * @member {string} [value] Gets or sets the usage counter name. + * @member {string} [localizedValue] Gets or sets the localized usage counter + * name. + */ +export interface UsageCounterName { + value?: string; + localizedValue?: string; +} + +/** + * @class + * Initializes a new instance of the Usage class. + * @constructor + * Definition of Usage. + * + * @member {string} [id] Gets or sets the id of the resource. + * @member {object} [name] Gets or sets the usage counter name. + * @member {string} [name.value] Gets or sets the usage counter name. + * @member {string} [name.localizedValue] Gets or sets the localized usage + * counter name. + * @member {string} [unit] Gets or sets the usage unit name. + * @member {number} [currentValue] Gets or sets the current usage value. + * @member {number} [limit] Gets or sets max limit. -1 for unlimited + * @member {string} [throttleStatus] Gets or sets the throttle status. + */ +export interface Usage { + id?: string; + name?: UsageCounterName; + unit?: string; + currentValue?: number; + limit?: number; + throttleStatus?: string; +} + +/** + * @class + * Initializes a new instance of the Statistics class. + * @constructor + * Definition of the statistic. + * + * @member {string} [counterProperty] Gets the property value of the statistic. + * @member {number} [counterValue] Gets the value of the statistic. + * @member {date} [startTime] Gets the startTime of the statistic. + * @member {date} [endTime] Gets the endTime of the statistic. + * @member {string} [id] Gets the id. + */ +export interface Statistics { + readonly counterProperty?: string; + readonly counterValue?: number; + readonly startTime?: Date; + readonly endTime?: Date; + readonly id?: string; +} + +/** + * @class + * Initializes a new instance of the RunbookAssociationProperty class. + * @constructor + * The runbook property associated with the entity. + * + * @member {string} [name] Gets or sets the name of the runbook. + */ +export interface RunbookAssociationProperty { + name?: string; +} + +/** + * @class + * Initializes a new instance of the Resource class. + * @constructor + * The core properties of ARM resources + * + * @member {string} [id] Fully qualified resource Id for the resource + * @member {string} [name] The name of the resource + * @member {string} [type] The type of the resource. + */ +export interface Resource extends BaseResource { + readonly id?: string; + readonly name?: string; + readonly type?: string; +} + +/** + * @class + * Initializes a new instance of the ProxyResource class. + * @constructor + * The resource model definition for a ARM proxy resource. It will have + * everything other than required location and tags + * + */ +export interface ProxyResource extends Resource { +} + +/** + * @class + * Initializes a new instance of the Webhook class. + * @constructor + * Definition of the webhook type. + * + * @member {boolean} [isEnabled] Gets or sets the value of the enabled flag of + * the webhook. Default value: false . + * @member {string} [uri] Gets or sets the webhook uri. + * @member {date} [expiryTime] Gets or sets the expiry time. + * @member {date} [lastInvokedTime] Gets or sets the last invoked time. + * @member {object} [parameters] Gets or sets the parameters of the job that is + * created when the webhook calls the runbook it is associated with. + * @member {object} [runbook] Gets or sets the runbook the webhook is + * associated with. + * @member {string} [runbook.name] Gets or sets the name of the runbook. + * @member {string} [runOn] Gets or sets the name of the hybrid worker group + * the webhook job will run on. + * @member {date} [creationTime] Gets or sets the creation time. + * @member {date} [lastModifiedTime] Gets or sets the last modified time. + * @member {string} [description] Gets or sets the description. + */ +export interface Webhook extends ProxyResource { + isEnabled?: boolean; + uri?: string; + expiryTime?: Date; + lastInvokedTime?: Date; + parameters?: { [propertyName: string]: string }; + runbook?: RunbookAssociationProperty; + runOn?: string; + creationTime?: Date; + lastModifiedTime?: Date; + description?: string; +} + +/** + * @class + * Initializes a new instance of the Variable class. + * @constructor + * Definition of the varible. + * + * @member {string} [value] Gets or sets the value of the variable. + * @member {boolean} [isEncrypted] Gets or sets the encrypted flag of the + * variable. + * @member {date} [creationTime] Gets or sets the creation time. + * @member {date} [lastModifiedTime] Gets or sets the last modified time. + * @member {string} [description] Gets or sets the description. + */ +export interface Variable extends ProxyResource { + value?: string; + isEncrypted?: boolean; + creationTime?: Date; + lastModifiedTime?: Date; + description?: string; +} + +/** + * @class + * Initializes a new instance of the JobProvisioningStateProperty class. + * @constructor + * The provisioning state property. + * + * @member {string} [provisioningState] The provisioning state of the resource. + * Possible values include: 'Failed', 'Succeeded', 'Suspended', 'Processing' + */ +export interface JobProvisioningStateProperty { + readonly provisioningState?: string; +} + +/** + * @class + * Initializes a new instance of the DscConfigurationAssociationProperty class. + * @constructor + * The Dsc configuration property associated with the entity. + * + * @member {string} [name] Gets or sets the name of the Dsc configuration. + */ +export interface DscConfigurationAssociationProperty { + name?: string; +} + +/** + * @class + * Initializes a new instance of the DscCompilationJob class. + * @constructor + * Definition of the Dsc Compilation job. + * + * @member {object} [configuration] Gets or sets the configuration. + * @member {string} [configuration.name] Gets or sets the name of the Dsc + * configuration. + * @member {string} [startedBy] Gets the compilation job started by. + * @member {uuid} [jobId] Gets the id of the job. + * @member {date} [creationTime] Gets the creation time of the job. + * @member {object} [provisioningState] The current provisioning state of the + * job. + * @member {string} [provisioningState.provisioningState] The provisioning + * state of the resource. Possible values include: 'Failed', 'Succeeded', + * 'Suspended', 'Processing' + * @member {string} [runOn] Gets or sets the runOn which specifies the group + * name where the job is to be executed. + * @member {string} [status] Gets or sets the status of the job. Possible + * values include: 'New', 'Activating', 'Running', 'Completed', 'Failed', + * 'Stopped', 'Blocked', 'Suspended', 'Disconnected', 'Suspending', 'Stopping', + * 'Resuming', 'Removing' + * @member {string} [statusDetails] Gets or sets the status details of the job. + * @member {date} [startTime] Gets the start time of the job. + * @member {date} [endTime] Gets the end time of the job. + * @member {string} [exception] Gets the exception of the job. + * @member {date} [lastModifiedTime] Gets the last modified time of the job. + * @member {date} [lastStatusModifiedTime] Gets the last status modified time + * of the job. + * @member {object} [parameters] Gets or sets the parameters of the job. + */ +export interface DscCompilationJob extends ProxyResource { + configuration?: DscConfigurationAssociationProperty; + readonly startedBy?: string; + readonly jobId?: string; + readonly creationTime?: Date; + provisioningState?: JobProvisioningStateProperty; + runOn?: string; + status?: string; + statusDetails?: string; + readonly startTime?: Date; + readonly endTime?: Date; + readonly exception?: string; + readonly lastModifiedTime?: Date; + readonly lastStatusModifiedTime?: Date; + parameters?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the Credential class. + * @constructor + * Definition of the credential. + * + * @member {string} [userName] Gets the user name of the credential. + * @member {date} [creationTime] Gets the creation time. + * @member {date} [lastModifiedTime] Gets the last modified time. + * @member {string} [description] Gets or sets the description. + */ +export interface Credential extends ProxyResource { + readonly userName?: string; + readonly creationTime?: Date; + readonly lastModifiedTime?: Date; + description?: string; +} + +/** + * @class + * Initializes a new instance of the ConnectionTypeAssociationProperty class. + * @constructor + * The connection type property associated with the entity. + * + * @member {string} [name] Gets or sets the name of the connection type. + */ +export interface ConnectionTypeAssociationProperty { + name?: string; +} + +/** + * @class + * Initializes a new instance of the Connection class. + * @constructor + * Definition of the connection. + * + * @member {object} [connectionType] Gets or sets the connectionType of the + * connection. + * @member {string} [connectionType.name] Gets or sets the name of the + * connection type. + * @member {object} [fieldDefinitionValues] Gets the field definition values of + * the connection. + * @member {date} [creationTime] Gets the creation time. + * @member {date} [lastModifiedTime] Gets the last modified time. + * @member {string} [description] Gets or sets the description. + */ +export interface Connection extends ProxyResource { + connectionType?: ConnectionTypeAssociationProperty; + readonly fieldDefinitionValues?: { [propertyName: string]: string }; + readonly creationTime?: Date; + readonly lastModifiedTime?: Date; + description?: string; +} + +/** + * @class + * Initializes a new instance of the Certificate class. + * @constructor + * Definition of the certificate. + * + * @member {string} [thumbprint] Gets the thumbprint of the certificate. + * @member {date} [expiryTime] Gets the expiry time of the certificate. + * @member {boolean} [isExportable] Gets the is exportable flag of the + * certificate. + * @member {date} [creationTime] Gets the creation time. + * @member {date} [lastModifiedTime] Gets the last modified time. + * @member {string} [description] Gets or sets the description. + */ +export interface Certificate extends ProxyResource { + readonly thumbprint?: string; + readonly expiryTime?: Date; + readonly isExportable?: boolean; + readonly creationTime?: Date; + readonly lastModifiedTime?: Date; + description?: string; +} + +/** + * @class + * Initializes a new instance of the RunbookParameter class. + * @constructor + * Definition of the runbook parameter type. + * + * @member {string} [type] Gets or sets the type of the parameter. + * @member {boolean} [isMandatory] Gets or sets a Boolean value to indicate + * whether the parameter is madatory or not. + * @member {number} [position] Get or sets the position of the parameter. + * @member {string} [defaultValue] Gets or sets the default value of parameter. + */ +export interface RunbookParameter { + type?: string; + isMandatory?: boolean; + position?: number; + defaultValue?: string; +} + +/** + * @class + * Initializes a new instance of the ContentHash class. + * @constructor + * Definition of the runbook property type. + * + * @member {string} algorithm Gets or sets the content hash algorithm used to + * hash the content. + * @member {string} value Gets or sets expected hash value of the content. + */ +export interface ContentHash { + algorithm: string; + value: string; +} + +/** + * @class + * Initializes a new instance of the ContentLink class. + * @constructor + * Definition of the content link. + * + * @member {string} [uri] Gets or sets the uri of the runbook content. + * @member {object} [contentHash] Gets or sets the hash. + * @member {string} [contentHash.algorithm] Gets or sets the content hash + * algorithm used to hash the content. + * @member {string} [contentHash.value] Gets or sets expected hash value of the + * content. + * @member {string} [version] Gets or sets the version of the content. + */ +export interface ContentLink { + uri?: string; + contentHash?: ContentHash; + version?: string; +} + +/** + * @class + * Initializes a new instance of the RunbookDraft class. + * @constructor + * Definition of the runbook type. + * + * @member {boolean} [inEdit] Gets or sets whether runbook is in edit mode. + * @member {object} [draftContentLink] Gets or sets the draft runbook content + * link. + * @member {string} [draftContentLink.uri] Gets or sets the uri of the runbook + * content. + * @member {object} [draftContentLink.contentHash] Gets or sets the hash. + * @member {string} [draftContentLink.contentHash.algorithm] Gets or sets the + * content hash algorithm used to hash the content. + * @member {string} [draftContentLink.contentHash.value] Gets or sets expected + * hash value of the content. + * @member {string} [draftContentLink.version] Gets or sets the version of the + * content. + * @member {date} [creationTime] Gets or sets the creation time of the runbook + * draft. + * @member {date} [lastModifiedTime] Gets or sets the last modified time of the + * runbook draft. + * @member {object} [parameters] Gets or sets the runbook draft parameters. + * @member {array} [outputTypes] Gets or sets the runbook output types. + */ +export interface RunbookDraft { + inEdit?: boolean; + draftContentLink?: ContentLink; + creationTime?: Date; + lastModifiedTime?: Date; + parameters?: { [propertyName: string]: RunbookParameter }; + outputTypes?: string[]; +} + +/** + * @class + * Initializes a new instance of the TrackedResource class. + * @constructor + * The resource model definition for a ARM tracked top level resource + * + * @member {object} [tags] Resource tags. + * @member {string} [location] The Azure Region where the resource lives + */ +export interface TrackedResource extends Resource { + tags?: { [propertyName: string]: string }; + location?: string; +} + +/** + * @class + * Initializes a new instance of the Runbook class. + * @constructor + * Definition of the runbook type. + * + * @member {string} [runbookType] Gets or sets the type of the runbook. + * Possible values include: 'Script', 'Graph', 'PowerShellWorkflow', + * 'PowerShell', 'GraphPowerShellWorkflow', 'GraphPowerShell' + * @member {object} [publishContentLink] Gets or sets the published runbook + * content link. + * @member {string} [publishContentLink.uri] Gets or sets the uri of the + * runbook content. + * @member {object} [publishContentLink.contentHash] Gets or sets the hash. + * @member {string} [publishContentLink.contentHash.algorithm] Gets or sets the + * content hash algorithm used to hash the content. + * @member {string} [publishContentLink.contentHash.value] Gets or sets + * expected hash value of the content. + * @member {string} [publishContentLink.version] Gets or sets the version of + * the content. + * @member {string} [state] Gets or sets the state of the runbook. Possible + * values include: 'New', 'Edit', 'Published' + * @member {boolean} [logVerbose] Gets or sets verbose log option. + * @member {boolean} [logProgress] Gets or sets progress log option. + * @member {number} [logActivityTrace] Gets or sets the option to log activity + * trace of the runbook. + * @member {number} [jobCount] Gets or sets the job count of the runbook. + * @member {object} [parameters] Gets or sets the runbook parameters. + * @member {array} [outputTypes] Gets or sets the runbook output types. + * @member {object} [draft] Gets or sets the draft runbook properties. + * @member {boolean} [draft.inEdit] Gets or sets whether runbook is in edit + * mode. + * @member {object} [draft.draftContentLink] Gets or sets the draft runbook + * content link. + * @member {string} [draft.draftContentLink.uri] Gets or sets the uri of the + * runbook content. + * @member {object} [draft.draftContentLink.contentHash] Gets or sets the hash. + * @member {string} [draft.draftContentLink.contentHash.algorithm] Gets or sets + * the content hash algorithm used to hash the content. + * @member {string} [draft.draftContentLink.contentHash.value] Gets or sets + * expected hash value of the content. + * @member {string} [draft.draftContentLink.version] Gets or sets the version + * of the content. + * @member {date} [draft.creationTime] Gets or sets the creation time of the + * runbook draft. + * @member {date} [draft.lastModifiedTime] Gets or sets the last modified time + * of the runbook draft. + * @member {object} [draft.parameters] Gets or sets the runbook draft + * parameters. + * @member {array} [draft.outputTypes] Gets or sets the runbook output types. + * @member {string} [provisioningState] Gets or sets the provisioning state of + * the runbook. Possible values include: 'Succeeded' + * @member {string} [lastModifiedBy] Gets or sets the last modified by. + * @member {date} [creationTime] Gets or sets the creation time. + * @member {date} [lastModifiedTime] Gets or sets the last modified time. + * @member {string} [description] Gets or sets the description. + * @member {string} [etag] Gets or sets the etag of the resource. + */ +export interface Runbook extends TrackedResource { + runbookType?: string; + publishContentLink?: ContentLink; + state?: string; + logVerbose?: boolean; + logProgress?: boolean; + logActivityTrace?: number; + jobCount?: number; + parameters?: { [propertyName: string]: RunbookParameter }; + outputTypes?: string[]; + draft?: RunbookDraft; + provisioningState?: string; + lastModifiedBy?: string; + creationTime?: Date; + lastModifiedTime?: Date; + description?: string; + etag?: string; +} + +/** + * @class + * Initializes a new instance of the ModuleErrorInfo class. + * @constructor + * Definition of the module error info type. + * + * @member {string} [code] Gets or sets the error code. + * @member {string} [message] Gets or sets the error message. + */ +export interface ModuleErrorInfo { + code?: string; + message?: string; +} + +/** + * @class + * Initializes a new instance of the Module class. + * @constructor + * Definition of the module type. + * + * @member {boolean} [isGlobal] Gets or sets the isGlobal flag of the module. + * @member {string} [version] Gets or sets the version of the module. + * @member {number} [sizeInBytes] Gets or sets the size in bytes of the module. + * @member {number} [activityCount] Gets or sets the activity count of the + * module. + * @member {string} [provisioningState] Gets or sets the provisioning state of + * the module. Possible values include: 'Created', 'Creating', + * 'StartingImportModuleRunbook', 'RunningImportModuleRunbook', + * 'ContentRetrieved', 'ContentDownloaded', 'ContentValidated', + * 'ConnectionTypeImported', 'ContentStored', 'ModuleDataStored', + * 'ActivitiesStored', 'ModuleImportRunbookComplete', 'Succeeded', 'Failed', + * 'Cancelled', 'Updating' + * @member {object} [contentLink] Gets or sets the contentLink of the module. + * @member {string} [contentLink.uri] Gets or sets the uri of the runbook + * content. + * @member {object} [contentLink.contentHash] Gets or sets the hash. + * @member {string} [contentLink.contentHash.algorithm] Gets or sets the + * content hash algorithm used to hash the content. + * @member {string} [contentLink.contentHash.value] Gets or sets expected hash + * value of the content. + * @member {string} [contentLink.version] Gets or sets the version of the + * content. + * @member {object} [error] Gets or sets the error info of the module. + * @member {string} [error.code] Gets or sets the error code. + * @member {string} [error.message] Gets or sets the error message. + * @member {date} [creationTime] Gets or sets the creation time. + * @member {date} [lastModifiedTime] Gets or sets the last modified time. + * @member {string} [description] Gets or sets the description. + * @member {string} [etag] Gets or sets the etag of the resource. + */ +export interface Module extends TrackedResource { + isGlobal?: boolean; + version?: string; + sizeInBytes?: number; + activityCount?: number; + provisioningState?: string; + contentLink?: ContentLink; + error?: ModuleErrorInfo; + creationTime?: Date; + lastModifiedTime?: Date; + description?: string; + etag?: string; +} + +/** + * @class + * Initializes a new instance of the ContentSource class. + * @constructor + * Definition of the content source. + * + * @member {object} [hash] Gets or sets the hash. + * @member {string} [hash.algorithm] Gets or sets the content hash algorithm + * used to hash the content. + * @member {string} [hash.value] Gets or sets expected hash value of the + * content. + * @member {string} [type] Gets or sets the content source type. Possible + * values include: 'embeddedContent', 'uri' + * @member {string} [value] Gets or sets the value of the content. This is + * based on the content source type. + * @member {string} [version] Gets or sets the version of the content. + */ +export interface ContentSource { + hash?: ContentHash; + type?: string; + value?: string; + version?: string; +} + +/** + * @class + * Initializes a new instance of the DscConfigurationParameter class. + * @constructor + * Definition of the configuration parameter type. + * + * @member {string} [type] Gets or sets the type of the parameter. + * @member {boolean} [isMandatory] Gets or sets a Boolean value to indicate + * whether the parameter is madatory or not. + * @member {number} [position] Get or sets the position of the parameter. + * @member {string} [defaultValue] Gets or sets the default value of parameter. + */ +export interface DscConfigurationParameter { + type?: string; + isMandatory?: boolean; + position?: number; + defaultValue?: string; +} + +/** + * @class + * Initializes a new instance of the DscConfiguration class. + * @constructor + * Definition of the configuration type. + * + * @member {string} [provisioningState] Gets or sets the provisioning state of + * the configuration. Possible values include: 'Succeeded' + * @member {number} [jobCount] Gets or sets the job count of the configuration. + * @member {object} [parameters] Gets or sets the configuration parameters. + * @member {object} [source] Gets or sets the source. + * @member {object} [source.hash] Gets or sets the hash. + * @member {string} [source.hash.algorithm] Gets or sets the content hash + * algorithm used to hash the content. + * @member {string} [source.hash.value] Gets or sets expected hash value of the + * content. + * @member {string} [source.type] Gets or sets the content source type. + * Possible values include: 'embeddedContent', 'uri' + * @member {string} [source.value] Gets or sets the value of the content. This + * is based on the content source type. + * @member {string} [source.version] Gets or sets the version of the content. + * @member {string} [state] Gets or sets the state of the configuration. + * Possible values include: 'New', 'Edit', 'Published' + * @member {boolean} [logVerbose] Gets or sets verbose log option. + * @member {date} [creationTime] Gets or sets the creation time. + * @member {date} [lastModifiedTime] Gets or sets the last modified time. + * @member {string} [description] Gets or sets the description. + * @member {string} [etag] Gets or sets the etag of the resource. + */ +export interface DscConfiguration extends TrackedResource { + provisioningState?: string; + jobCount?: number; + parameters?: { [propertyName: string]: DscConfigurationParameter }; + source?: ContentSource; + state?: string; + logVerbose?: boolean; + creationTime?: Date; + lastModifiedTime?: Date; + description?: string; + etag?: string; +} + +/** + * @class + * Initializes a new instance of the Sku class. + * @constructor + * The account SKU. + * + * @member {string} name Gets or sets the SKU name of the account. Possible + * values include: 'Free', 'Basic' + * @member {string} [family] Gets or sets the SKU family. + * @member {number} [capacity] Gets or sets the SKU capacity. + */ +export interface Sku { + name: string; + family?: string; + capacity?: number; +} + +/** + * @class + * Initializes a new instance of the AutomationAccount class. + * @constructor + * Definition of the automation account type. + * + * @member {object} [sku] Gets or sets the SKU of account. + * @member {string} [sku.name] Gets or sets the SKU name of the account. + * Possible values include: 'Free', 'Basic' + * @member {string} [sku.family] Gets or sets the SKU family. + * @member {number} [sku.capacity] Gets or sets the SKU capacity. + * @member {string} [lastModifiedBy] Gets or sets the last modified by. + * @member {string} [state] Gets status of account. Possible values include: + * 'Ok', 'Unavailable', 'Suspended' + * @member {date} [creationTime] Gets the creation time. + * @member {date} [lastModifiedTime] Gets the last modified time. + * @member {string} [description] Gets or sets the description. + * @member {string} [etag] Gets or sets the etag of the resource. + */ +export interface AutomationAccount extends TrackedResource { + sku?: Sku; + lastModifiedBy?: string; + readonly state?: string; + readonly creationTime?: Date; + readonly lastModifiedTime?: Date; + description?: string; + etag?: string; +} + +/** + * @class + * Initializes a new instance of the OperationDisplay class. + * @constructor + * Provider, Resource and Operation values + * + * @member {string} [provider] Service provider: Microsoft.Automation + * @member {string} [resource] Resource on which the operation is performed: + * Runbooks, Jobs etc. + * @member {string} [operation] Operation type: Read, write, delete, etc. + */ +export interface OperationDisplay { + provider?: string; + resource?: string; + operation?: string; +} + +/** + * @class + * Initializes a new instance of the Operation class. + * @constructor + * Automation REST API operation + * + * @member {string} [name] Operation name: {provider}/{resource}/{operation} + * @member {object} [display] Provider, Resource and Operation values + * @member {string} [display.provider] Service provider: Microsoft.Automation + * @member {string} [display.resource] Resource on which the operation is + * performed: Runbooks, Jobs etc. + * @member {string} [display.operation] Operation type: Read, write, delete, + * etc. + */ +export interface Operation { + name?: string; + display?: OperationDisplay; +} + +/** + * @class + * Initializes a new instance of the AutomationAccountCreateOrUpdateParameters class. + * @constructor + * The parameters supplied to the create or update automation account + * operation. + * + * @member {object} [sku] Gets or sets account SKU. + * @member {string} [sku.name] Gets or sets the SKU name of the account. + * Possible values include: 'Free', 'Basic' + * @member {string} [sku.family] Gets or sets the SKU family. + * @member {number} [sku.capacity] Gets or sets the SKU capacity. + * @member {string} [name] Gets or sets name of the resource. + * @member {string} [location] Gets or sets the location of the resource. + * @member {object} [tags] Gets or sets the tags attached to the resource. + */ +export interface AutomationAccountCreateOrUpdateParameters { + sku?: Sku; + name?: string; + location?: string; + tags?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the AutomationAccountUpdateParameters class. + * @constructor + * The parameters supplied to the update automation account operation. + * + * @member {object} [sku] Gets or sets account SKU. + * @member {string} [sku.name] Gets or sets the SKU name of the account. + * Possible values include: 'Free', 'Basic' + * @member {string} [sku.family] Gets or sets the SKU family. + * @member {number} [sku.capacity] Gets or sets the SKU capacity. + * @member {string} [name] Gets or sets the name of the resource. + * @member {string} [location] Gets or sets the location of the resource. + * @member {object} [tags] Gets or sets the tags attached to the resource. + */ +export interface AutomationAccountUpdateParameters { + sku?: Sku; + name?: string; + location?: string; + tags?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the CertificateUpdateParameters class. + * @constructor + * The parameters supplied to the update certificate operation. + * + * @member {string} [name] Gets or sets the name of the certificate. + * @member {string} [description] Gets or sets the description of the + * certificate. + */ +export interface CertificateUpdateParameters { + name?: string; + description?: string; +} + +/** + * @class + * Initializes a new instance of the CertificateCreateOrUpdateParameters class. + * @constructor + * The parameters supplied to the create or update or replace certificate + * operation. + * + * @member {string} name Gets or sets the name of the certificate. + * @member {string} base64Value Gets or sets the base64 encoded value of the + * certificate. + * @member {string} [description] Gets or sets the description of the + * certificate. + * @member {string} [thumbprint] Gets or sets the thumbprint of the + * certificate. + * @member {boolean} [isExportable] Gets or sets the is exportable flag of the + * certificate. + */ +export interface CertificateCreateOrUpdateParameters { + name: string; + base64Value: string; + description?: string; + thumbprint?: string; + isExportable?: boolean; +} + +/** + * @class + * Initializes a new instance of the ConnectionUpdateParameters class. + * @constructor + * The parameters supplied to the update connection operation. + * + * @member {string} [name] Gets or sets the name of the connection. + * @member {string} [description] Gets or sets the description of the + * connection. + * @member {object} [fieldDefinitionValues] Gets or sets the field definition + * values of the connection. + */ +export interface ConnectionUpdateParameters { + name?: string; + description?: string; + fieldDefinitionValues?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the ConnectionCreateOrUpdateParameters class. + * @constructor + * The parameters supplied to the create or update connection operation. + * + * @member {string} name Gets or sets the name of the connection. + * @member {string} [description] Gets or sets the description of the + * connection. + * @member {object} connectionType Gets or sets the connectionType of the + * connection. + * @member {string} [connectionType.name] Gets or sets the name of the + * connection type. + * @member {object} [fieldDefinitionValues] Gets or sets the field definition + * properties of the connection. + */ +export interface ConnectionCreateOrUpdateParameters { + name: string; + description?: string; + connectionType: ConnectionTypeAssociationProperty; + fieldDefinitionValues?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the FieldDefinition class. + * @constructor + * Definition of the connection fields. + * + * @member {boolean} [isEncrypted] Gets or sets the isEncrypted flag of the + * connection field definition. + * @member {boolean} [isOptional] Gets or sets the isOptional flag of the + * connection field definition. + * @member {string} type Gets or sets the type of the connection field + * definition. + */ +export interface FieldDefinition { + isEncrypted?: boolean; + isOptional?: boolean; + type: string; +} + +/** + * @class + * Initializes a new instance of the ConnectionType class. + * @constructor + * Definition of the connection type. + * + * @member {string} [id] Gets the id of the resource. + * @member {string} [name] Gets the name of the connection type. + * @member {string} [type] Resource type + * @member {boolean} [isGlobal] Gets or sets a Boolean value to indicate if the + * connection type is global. + * @member {object} [fieldDefinitions] Gets the field definitions of the + * connection type. + * @member {date} [creationTime] Gets the creation time. + * @member {date} [lastModifiedTime] Gets or sets the last modified time. + * @member {string} [description] Gets or sets the description. + */ +export interface ConnectionType { + readonly id?: string; + readonly name?: string; + readonly type?: string; + isGlobal?: boolean; + readonly fieldDefinitions?: { [propertyName: string]: FieldDefinition }; + readonly creationTime?: Date; + lastModifiedTime?: Date; + description?: string; +} + +/** + * @class + * Initializes a new instance of the ConnectionTypeCreateOrUpdateParameters class. + * @constructor + * The parameters supplied to the create or update connection type operation. + * + * @member {string} name Gets or sets the name of the connection type. + * @member {boolean} [isGlobal] Gets or sets a Boolean value to indicate if the + * connection type is global. + * @member {object} fieldDefinitions Gets or sets the field definitions of the + * connection type. + */ +export interface ConnectionTypeCreateOrUpdateParameters { + name: string; + isGlobal?: boolean; + fieldDefinitions: { [propertyName: string]: FieldDefinition }; +} + +/** + * @class + * Initializes a new instance of the CredentialUpdateParameters class. + * @constructor + * The parameters supplied to the Update credential operation. + * + * @member {string} [name] Gets or sets the name of the credential. + * @member {string} [userName] Gets or sets the user name of the credential. + * @member {string} [password] Gets or sets the password of the credential. + * @member {string} [description] Gets or sets the description of the + * credential. + */ +export interface CredentialUpdateParameters { + name?: string; + userName?: string; + password?: string; + description?: string; +} + +/** + * @class + * Initializes a new instance of the CredentialCreateOrUpdateParameters class. + * @constructor + * The parameters supplied to the create or update credential operation. + * + * @member {string} name Gets or sets the name of the credential. + * @member {string} userName Gets or sets the user name of the credential. + * @member {string} password Gets or sets the password of the credential. + * @member {string} [description] Gets or sets the description of the + * credential. + */ +export interface CredentialCreateOrUpdateParameters { + name: string; + userName: string; + password: string; + description?: string; +} + +/** + * @class + * Initializes a new instance of the ActivityParameter class. + * @constructor + * Definition of the activity parameter. + * + * @member {string} [name] Gets or sets the name of the activity parameter. + * @member {string} [type] Gets or sets the type of the activity parameter. + * @member {boolean} [isMandatory] Gets or sets a Boolean value that indicates + * true if the parameter is required. If the value is false, the parameter is + * optional. + * @member {boolean} [isDynamic] Gets or sets a Boolean value that indicates + * true if the parameter is dynamic. + * @member {boolean} [position] Gets or sets the position of the activity + * parameter. + * @member {boolean} [valueFromPipeline] Gets or sets a Boolean value that + * indicates true if the parameter can take values from the incoming pipeline + * objects. This setting is used if the cmdlet must access the complete input + * object. false indicates that the parameter cannot take values from the + * complete input object. + * @member {boolean} [valueFromPipelineByPropertyName] Gets or sets a Boolean + * value that indicates true if the parameter can be filled from a property of + * the incoming pipeline object that has the same name as this parameter. false + * indicates that the parameter cannot be filled from the incoming pipeline + * object property with the same name. + * @member {boolean} [valueFromRemainingArguments] Gets or sets a Boolean value + * that indicates true if the cmdlet parameter accepts all the remaining + * command-line arguments that are associated with this parameter in the form + * of an array. false if the cmdlet parameter does not accept all the remaining + * argument values. + */ +export interface ActivityParameter { + name?: string; + type?: string; + isMandatory?: boolean; + isDynamic?: boolean; + position?: boolean; + valueFromPipeline?: boolean; + valueFromPipelineByPropertyName?: boolean; + valueFromRemainingArguments?: boolean; +} + +/** + * @class + * Initializes a new instance of the ActivityParameterSet class. + * @constructor + * Definition of the activity parameter set. + * + * @member {string} [name] Gets or sets the name of the activity parameter set. + * @member {array} [parameters] Gets or sets the parameters of the activity + * parameter set. + */ +export interface ActivityParameterSet { + name?: string; + parameters?: ActivityParameter[]; +} + +/** + * @class + * Initializes a new instance of the ActivityOutputType class. + * @constructor + * Definition of the activity output type. + * + * @member {string} [name] Gets or sets the name of the activity output type. + * @member {string} [type] Gets or sets the type of the activity output type. + */ +export interface ActivityOutputType { + name?: string; + type?: string; +} + +/** + * @class + * Initializes a new instance of the Activity class. + * @constructor + * Definition of the activity. + * + * @member {string} [id] Gets or sets the id of the resource. + * @member {string} [name] Gets the name of the activity. + * @member {string} [definition] Gets or sets the user name of the activity. + * @member {array} [parameterSets] Gets or sets the parameter sets of the + * activity. + * @member {array} [outputTypes] Gets or sets the output types of the activity. + * @member {date} [creationTime] Gets or sets the creation time. + * @member {date} [lastModifiedTime] Gets or sets the last modified time. + * @member {string} [description] Gets or sets the description. + */ +export interface Activity { + id?: string; + readonly name?: string; + definition?: string; + parameterSets?: ActivityParameterSet[]; + outputTypes?: ActivityOutputType[]; + creationTime?: Date; + lastModifiedTime?: Date; + description?: string; +} + +/** + * @class + * Initializes a new instance of the AdvancedScheduleMonthlyOccurrence class. + * @constructor + * The properties of the create advanced schedule monthly occurrence. + * + * @member {number} [occurrence] Occurrence of the week within the month. Must + * be between 1 and 5 + * @member {string} [day] Day of the occurrence. Must be one of monday, + * tuesday, wednesday, thursday, friday, saturday, sunday. Possible values + * include: 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', + * 'Sunday' + */ +export interface AdvancedScheduleMonthlyOccurrence { + occurrence?: number; + day?: string; +} + +/** + * @class + * Initializes a new instance of the AdvancedSchedule class. + * @constructor + * The properties of the create Advanced Schedule. + * + * @member {array} [weekDays] Days of the week that the job should execute on. + * @member {array} [monthDays] Days of the month that the job should execute + * on. Must be between 1 and 31. + * @member {array} [monthlyOccurrences] Occurrences of days within a month. + */ +export interface AdvancedSchedule { + weekDays?: string[]; + monthDays?: number[]; + monthlyOccurrences?: AdvancedScheduleMonthlyOccurrence[]; +} + +/** + * @class + * Initializes a new instance of the AgentRegistrationKeys class. + * @constructor + * Definition of the agent registration keys. + * + * @member {string} [primary] Gets or sets the primary key. + * @member {string} [secondary] Gets or sets the secondary key. + */ +export interface AgentRegistrationKeys { + primary?: string; + secondary?: string; +} + +/** + * @class + * Initializes a new instance of the AgentRegistration class. + * @constructor + * Definition of the agent registration infomration type. + * + * @member {string} [dscMetaConfiguration] Gets or sets the dsc meta + * configuration. + * @member {string} [endpoint] Gets or sets the dsc server endpoint. + * @member {object} [keys] Gets or sets the agent registration keys. + * @member {string} [keys.primary] Gets or sets the primary key. + * @member {string} [keys.secondary] Gets or sets the secondary key. + * @member {string} [id] Gets or sets the id. + */ +export interface AgentRegistration { + dscMetaConfiguration?: string; + endpoint?: string; + keys?: AgentRegistrationKeys; + id?: string; +} + +/** + * @class + * Initializes a new instance of the AgentRegistrationRegenerateKeyParameter class. + * @constructor + * The parameters supplied to the regenerate keys operation. + * + * @member {string} keyName Gets or sets the agent registration key name - + * primary or secondary. Possible values include: 'primary', 'secondary' + * @member {string} [name] Gets or sets the name of the resource. + * @member {string} [location] Gets or sets the location of the resource. + * @member {object} [tags] Gets or sets the tags attached to the resource. + */ +export interface AgentRegistrationRegenerateKeyParameter { + keyName: string; + name?: string; + location?: string; + tags?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the DscCompilationJobCreateParameters class. + * @constructor + * The parameters supplied to the create compilation job operation. + * + * @member {object} configuration Gets or sets the configuration. + * @member {string} [configuration.name] Gets or sets the name of the Dsc + * configuration. + * @member {object} [parameters] Gets or sets the parameters of the job. + * @member {boolean} [newNodeConfigurationBuildVersionRequired] If a new build + * version of NodeConfiguration is required. + * @member {string} [name] Gets or sets name of the resource. + * @member {string} [location] Gets or sets the location of the resource. + * @member {object} [tags] Gets or sets the tags attached to the resource. + */ +export interface DscCompilationJobCreateParameters { + configuration: DscConfigurationAssociationProperty; + parameters?: { [propertyName: string]: string }; + newNodeConfigurationBuildVersionRequired?: boolean; + name?: string; + location?: string; + tags?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the DscConfigurationCreateOrUpdateParameters class. + * @constructor + * The parameters supplied to the create or update configuration operation. + * + * @member {boolean} [logVerbose] Gets or sets verbose log option. + * @member {boolean} [logProgress] Gets or sets progress log option. + * @member {object} source Gets or sets the source. + * @member {object} [source.hash] Gets or sets the hash. + * @member {string} [source.hash.algorithm] Gets or sets the content hash + * algorithm used to hash the content. + * @member {string} [source.hash.value] Gets or sets expected hash value of the + * content. + * @member {string} [source.type] Gets or sets the content source type. + * Possible values include: 'embeddedContent', 'uri' + * @member {string} [source.value] Gets or sets the value of the content. This + * is based on the content source type. + * @member {string} [source.version] Gets or sets the version of the content. + * @member {object} [parameters] Gets or sets the configuration parameters. + * @member {string} [description] Gets or sets the description of the + * configuration. + * @member {string} [name] Gets or sets name of the resource. + * @member {string} [location] Gets or sets the location of the resource. + * @member {object} [tags] Gets or sets the tags attached to the resource. + */ +export interface DscConfigurationCreateOrUpdateParameters { + logVerbose?: boolean; + logProgress?: boolean; + source: ContentSource; + parameters?: { [propertyName: string]: DscConfigurationParameter }; + description?: string; + name?: string; + location?: string; + tags?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the DscConfigurationUpdateParameters class. + * @constructor + * The parameters supplied to the create or update configuration operation. + * + * @member {boolean} [logVerbose] Gets or sets verbose log option. + * @member {boolean} [logProgress] Gets or sets progress log option. + * @member {object} source Gets or sets the source. + * @member {object} [source.hash] Gets or sets the hash. + * @member {string} [source.hash.algorithm] Gets or sets the content hash + * algorithm used to hash the content. + * @member {string} [source.hash.value] Gets or sets expected hash value of the + * content. + * @member {string} [source.type] Gets or sets the content source type. + * Possible values include: 'embeddedContent', 'uri' + * @member {string} [source.value] Gets or sets the value of the content. This + * is based on the content source type. + * @member {string} [source.version] Gets or sets the version of the content. + * @member {object} [parameters] Gets or sets the configuration parameters. + * @member {string} [description] Gets or sets the description of the + * configuration. + * @member {string} [name] Gets or sets name of the resource. + * @member {object} [tags] Gets or sets the tags attached to the resource. + */ +export interface DscConfigurationUpdateParameters { + logVerbose?: boolean; + logProgress?: boolean; + source: ContentSource; + parameters?: { [propertyName: string]: DscConfigurationParameter }; + description?: string; + name?: string; + tags?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the DscMetaConfiguration class. + * @constructor + * Definition of the DSC Meta Configuration. + * + * @member {number} [configurationModeFrequencyMins] Gets or sets the + * ConfigurationModeFrequencyMins value of the meta configuration. + * @member {boolean} [rebootNodeIfNeeded] Gets or sets the RebootNodeIfNeeded + * value of the meta configuration. + * @member {string} [configurationMode] Gets or sets the ConfigurationMode + * value of the meta configuration. + * @member {string} [actionAfterReboot] Gets or sets the ActionAfterReboot + * value of the meta configuration. + * @member {string} [certificateId] Gets or sets the CertificateId value of the + * meta configuration. + * @member {number} [refreshFrequencyMins] Gets or sets the + * RefreshFrequencyMins value of the meta configuration. + * @member {boolean} [allowModuleOverwrite] Gets or sets the + * AllowModuleOverwrite value of the meta configuration. + */ +export interface DscMetaConfiguration { + configurationModeFrequencyMins?: number; + rebootNodeIfNeeded?: boolean; + configurationMode?: string; + actionAfterReboot?: string; + certificateId?: string; + refreshFrequencyMins?: number; + allowModuleOverwrite?: boolean; +} + +/** + * @class + * Initializes a new instance of the DscNodeConfigurationCreateOrUpdateParameters class. + * @constructor + * The parameters supplied to the create or update node configuration + * operation. + * + * @member {object} source Gets or sets the source. + * @member {object} [source.hash] Gets or sets the hash. + * @member {string} [source.hash.algorithm] Gets or sets the content hash + * algorithm used to hash the content. + * @member {string} [source.hash.value] Gets or sets expected hash value of the + * content. + * @member {string} [source.type] Gets or sets the content source type. + * Possible values include: 'embeddedContent', 'uri' + * @member {string} [source.value] Gets or sets the value of the content. This + * is based on the content source type. + * @member {string} [source.version] Gets or sets the version of the content. + * @member {string} name Gets or sets the type of the parameter. + * @member {object} configuration Gets or sets the configuration of the node. + * @member {string} [configuration.name] Gets or sets the name of the Dsc + * configuration. + * @member {boolean} [newNodeConfigurationBuildVersionRequired] If a new build + * version of NodeConfiguration is required. + */ +export interface DscNodeConfigurationCreateOrUpdateParameters { + source: ContentSource; + name: string; + configuration: DscConfigurationAssociationProperty; + newNodeConfigurationBuildVersionRequired?: boolean; +} + +/** + * @class + * Initializes a new instance of the DscNodeConfigurationAssociationProperty class. + * @constructor + * The dsc nodeconfiguration property associated with the entity. + * + * @member {string} [name] Gets or sets the name of the dsc nodeconfiguration. + */ +export interface DscNodeConfigurationAssociationProperty { + name?: string; +} + +/** + * @class + * Initializes a new instance of the DscNodeExtensionHandlerAssociationProperty class. + * @constructor + * The dsc extensionHandler property associated with the node + * + * @member {string} [name] Gets or sets the name of the extension handler. + * @member {string} [version] Gets or sets the version of the extension + * handler. + */ +export interface DscNodeExtensionHandlerAssociationProperty { + name?: string; + version?: string; +} + +/** + * @class + * Initializes a new instance of the DscNodeUpdateParametersProperties class. + * @constructor + * @member {string} [name] Gets or sets the name of the dsc nodeconfiguration. + */ +export interface DscNodeUpdateParametersProperties { + name?: string; +} + +/** + * @class + * Initializes a new instance of the DscNodeUpdateParameters class. + * @constructor + * The parameters supplied to the update dsc node operation. + * + * @member {string} [nodeId] Gets or sets the id of the dsc node. + * @member {object} [nodeConfiguration] Gets or sets the configuration of the + * node. + * @member {string} [nodeConfiguration.name] Gets or sets the name of the dsc + * nodeconfiguration. + * @member {object} [properties] + * @member {string} [properties.name] Gets or sets the name of the dsc + * nodeconfiguration. + */ +export interface DscNodeUpdateParameters { + nodeId?: string; + nodeConfiguration?: DscNodeConfigurationAssociationProperty; + properties?: DscNodeUpdateParametersProperties; +} + +/** + * @class + * Initializes a new instance of the DscReportError class. + * @constructor + * Definition of the dsc node report error type. + * + * @member {string} [errorSource] Gets or sets the source of the error. + * @member {string} [resourceId] Gets or sets the resource ID which generated + * the error. + * @member {string} [errorCode] Gets or sets the error code. + * @member {string} [errorMessage] Gets or sets the error message. + * @member {string} [locale] Gets or sets the locale of the error. + * @member {string} [errorDetails] Gets or sets the error details. + */ +export interface DscReportError { + errorSource?: string; + resourceId?: string; + errorCode?: string; + errorMessage?: string; + locale?: string; + errorDetails?: string; +} + +/** + * @class + * Initializes a new instance of the DscReportResourceNavigation class. + * @constructor + * Navigation for DSC Report Resource. + * + * @member {string} [resourceId] Gets or sets the ID of the resource to + * navigate to. + */ +export interface DscReportResourceNavigation { + resourceId?: string; +} + +/** + * @class + * Initializes a new instance of the DscReportResource class. + * @constructor + * Definition of the DSC Report Resource. + * + * @member {string} [resourceId] Gets or sets the ID of the resource. + * @member {string} [sourceInfo] Gets or sets the source info of the resource. + * @member {array} [dependsOn] Gets or sets the Resource Navigation values for + * resources the resource depends on. + * @member {string} [moduleName] Gets or sets the module name of the resource. + * @member {string} [moduleVersion] Gets or sets the module version of the + * resource. + * @member {string} [resourceName] Gets or sets the name of the resource. + * @member {string} [error] Gets or sets the error of the resource. + * @member {string} [status] Gets or sets the status of the resource. + * @member {number} [durationInSeconds] Gets or sets the duration in seconds + * for the resource. + * @member {date} [startDate] Gets or sets the start date of the resource. + */ +export interface DscReportResource { + resourceId?: string; + sourceInfo?: string; + dependsOn?: DscReportResourceNavigation[]; + moduleName?: string; + moduleVersion?: string; + resourceName?: string; + error?: string; + status?: string; + durationInSeconds?: number; + startDate?: Date; +} + +/** + * @class + * Initializes a new instance of the DscNodeReport class. + * @constructor + * Definition of the dsc node report type. + * + * @member {date} [endTime] Gets or sets the end time of the node report. + * @member {date} [lastModifiedTime] Gets or sets the lastModifiedTime of the + * node report. + * @member {date} [startTime] Gets or sets the start time of the node report. + * @member {string} [type] Gets or sets the type of the node report. + * @member {string} [reportId] Gets or sets the id of the node report. + * @member {string} [status] Gets or sets the status of the node report. + * @member {string} [refreshMode] Gets or sets the refreshMode of the node + * report. + * @member {string} [rebootRequested] Gets or sets the rebootRequested of the + * node report. + * @member {string} [reportFormatVersion] Gets or sets the reportFormatVersion + * of the node report. + * @member {string} [configurationVersion] Gets or sets the + * configurationVersion of the node report. + * @member {string} [id] Gets or sets the id. + * @member {array} [errors] Gets or sets the errors for the node report. + * @member {array} [resources] Gets or sets the resource for the node report. + * @member {object} [metaConfiguration] Gets or sets the metaConfiguration of + * the node at the time of the report. + * @member {number} [metaConfiguration.configurationModeFrequencyMins] Gets or + * sets the ConfigurationModeFrequencyMins value of the meta configuration. + * @member {boolean} [metaConfiguration.rebootNodeIfNeeded] Gets or sets the + * RebootNodeIfNeeded value of the meta configuration. + * @member {string} [metaConfiguration.configurationMode] Gets or sets the + * ConfigurationMode value of the meta configuration. + * @member {string} [metaConfiguration.actionAfterReboot] Gets or sets the + * ActionAfterReboot value of the meta configuration. + * @member {string} [metaConfiguration.certificateId] Gets or sets the + * CertificateId value of the meta configuration. + * @member {number} [metaConfiguration.refreshFrequencyMins] Gets or sets the + * RefreshFrequencyMins value of the meta configuration. + * @member {boolean} [metaConfiguration.allowModuleOverwrite] Gets or sets the + * AllowModuleOverwrite value of the meta configuration. + * @member {string} [hostName] Gets or sets the hostname of the node that sent + * the report. + * @member {array} [iPV4Addresses] Gets or sets the IPv4 address of the node + * that sent the report. + * @member {array} [iPV6Addresses] Gets or sets the IPv6 address of the node + * that sent the report. + * @member {number} [numberOfResources] Gets or sets the number of resource in + * the node report. + * @member {string} [rawErrors] Gets or sets the unparsed errors for the node + * report. + */ +export interface DscNodeReport { + endTime?: Date; + lastModifiedTime?: Date; + startTime?: Date; + type?: string; + reportId?: string; + status?: string; + refreshMode?: string; + rebootRequested?: string; + reportFormatVersion?: string; + configurationVersion?: string; + id?: string; + errors?: DscReportError[]; + resources?: DscReportResource[]; + metaConfiguration?: DscMetaConfiguration; + hostName?: string; + iPV4Addresses?: string[]; + iPV6Addresses?: string[]; + numberOfResources?: number; + rawErrors?: string; +} + +/** + * @class + * Initializes a new instance of the HybridRunbookWorker class. + * @constructor + * Definition of hybrid runbook worker. + * + * @member {string} [name] Gets or sets the worker machine name. + * @member {string} [ip] Gets or sets the assigned machine IP address. + * @member {date} [registrationTime] Gets or sets the registration time of the + * worker machine. + */ +export interface HybridRunbookWorker { + name?: string; + ip?: string; + registrationTime?: Date; +} + +/** + * @class + * Initializes a new instance of the RunAsCredentialAssociationProperty class. + * @constructor + * Definition of runas credential to use for hybrid worker. + * + * @member {string} [name] Gets or sets the name of the credential. + */ +export interface RunAsCredentialAssociationProperty { + name?: string; +} + +/** + * @class + * Initializes a new instance of the HybridRunbookWorkerGroup class. + * @constructor + * Definition of hybrid runbook worker group. + * + * @member {string} [id] Gets or sets the id of the resource. + * @member {string} [name] Gets or sets the name of the group. + * @member {array} [hybridRunbookWorkers] Gets or sets the list of hybrid + * runbook workers. + * @member {object} [credential] Sets the credential of a worker group. + * @member {string} [credential.name] Gets or sets the name of the credential. + */ +export interface HybridRunbookWorkerGroup { + id?: string; + name?: string; + hybridRunbookWorkers?: HybridRunbookWorker[]; + credential?: RunAsCredentialAssociationProperty; +} + +/** + * @class + * Initializes a new instance of the HybridRunbookWorkerGroupUpdateParameters class. + * @constructor + * Parameters supplied to the update operation. + * + * @member {object} [credential] Sets the credential of a worker group. + * @member {string} [credential.name] Gets or sets the name of the credential. + */ +export interface HybridRunbookWorkerGroupUpdateParameters { + credential?: RunAsCredentialAssociationProperty; +} + +/** + * @class + * Initializes a new instance of the Job class. + * @constructor + * Definition of the job. + * + * @member {object} [runbook] Gets or sets the runbook. + * @member {string} [runbook.name] Gets or sets the name of the runbook. + * @member {string} [startedBy] Gets or sets the job started by. + * @member {string} [runOn] Gets or sets the runOn which specifies the group + * name where the job is to be executed. + * @member {uuid} [jobId] Gets or sets the id of the job. + * @member {date} [creationTime] Gets or sets the creation time of the job. + * @member {string} [status] Gets or sets the status of the job. Possible + * values include: 'New', 'Activating', 'Running', 'Completed', 'Failed', + * 'Stopped', 'Blocked', 'Suspended', 'Disconnected', 'Suspending', 'Stopping', + * 'Resuming', 'Removing' + * @member {string} [statusDetails] Gets or sets the status details of the job. + * @member {date} [startTime] Gets or sets the start time of the job. + * @member {date} [endTime] Gets or sets the end time of the job. + * @member {string} [exception] Gets or sets the exception of the job. + * @member {date} [lastModifiedTime] Gets or sets the last modified time of the + * job. + * @member {date} [lastStatusModifiedTime] Gets or sets the last status + * modified time of the job. + * @member {object} [parameters] Gets or sets the parameters of the job. + * @member {object} [provisioningState] The provisioning state of a resource. + * @member {string} [provisioningState.provisioningState] The provisioning + * state of the resource. Possible values include: 'Failed', 'Succeeded', + * 'Suspended', 'Processing' + */ +export interface Job extends ProxyResource { + runbook?: RunbookAssociationProperty; + startedBy?: string; + runOn?: string; + jobId?: string; + creationTime?: Date; + status?: string; + statusDetails?: string; + startTime?: Date; + endTime?: Date; + exception?: string; + lastModifiedTime?: Date; + lastStatusModifiedTime?: Date; + parameters?: { [propertyName: string]: string }; + provisioningState?: JobProvisioningStateProperty; +} + +/** + * @class + * Initializes a new instance of the JobCreateParameters class. + * @constructor + * The parameters supplied to the create job operation. + * + * @member {object} runbook Gets or sets the runbook. + * @member {string} [runbook.name] Gets or sets the name of the runbook. + * @member {object} [parameters] Gets or sets the parameters of the job. + * @member {string} [runOn] Gets or sets the runOn which specifies the group + * name where the job is to be executed. + */ +export interface JobCreateParameters { + runbook: RunbookAssociationProperty; + parameters?: { [propertyName: string]: string }; + runOn?: string; +} + +/** + * @class + * Initializes a new instance of the JobListResult class. + * @constructor + * The response model for the list job operation. + * + * @member {array} [value] Gets or sets a list of jobs. + * @member {string} [nextLink] Gets or sets the next link. + */ +export interface JobListResult { + value?: Job[]; + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the ScheduleAssociationProperty class. + * @constructor + * The schedule property associated with the entity. + * + * @member {string} [name] Gets or sets the name of the schedule. + */ +export interface ScheduleAssociationProperty { + name?: string; +} + +/** + * @class + * Initializes a new instance of the JobScheduleCreateParameters class. + * @constructor + * The parameters supplied to the create job schedule operation. + * + * @member {object} schedule Gets or sets the schedule. + * @member {string} [schedule.name] Gets or sets the name of the schedule. + * @member {object} runbook Gets or sets the runbook. + * @member {string} [runbook.name] Gets or sets the name of the runbook. + * @member {string} [runOn] Gets or sets the hybrid worker group that the + * scheduled job should run on. + * @member {object} [parameters] Gets or sets a list of job properties. + */ +export interface JobScheduleCreateParameters { + schedule: ScheduleAssociationProperty; + runbook: RunbookAssociationProperty; + runOn?: string; + parameters?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the JobSchedule class. + * @constructor + * Definition of the job schedule. + * + * @member {string} [id] Gets the id of the resource. + * @member {string} [name] Gets the name of the variable. + * @member {string} [type] Resource type + * @member {string} [jobScheduleId] Gets or sets the id of job schedule. + * @member {object} [schedule] Gets or sets the schedule. + * @member {string} [schedule.name] Gets or sets the name of the schedule. + * @member {object} [runbook] Gets or sets the runbook. + * @member {string} [runbook.name] Gets or sets the name of the runbook. + * @member {string} [runOn] Gets or sets the hybrid worker group that the + * scheduled job should run on. + * @member {object} [parameters] Gets or sets the parameters of the job + * schedule. + */ +export interface JobSchedule { + readonly id?: string; + readonly name?: string; + readonly type?: string; + jobScheduleId?: string; + schedule?: ScheduleAssociationProperty; + runbook?: RunbookAssociationProperty; + runOn?: string; + parameters?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the JobStream class. + * @constructor + * Definition of the job stream. + * + * @member {string} [id] Gets or sets the id of the resource. + * @member {string} [jobStreamId] Gets or sets the id of the job stream. + * @member {date} [time] Gets or sets the creation time of the job. + * @member {string} [streamType] Gets or sets the stream type. Possible values + * include: 'Progress', 'Output', 'Warning', 'Error', 'Debug', 'Verbose', 'Any' + * @member {string} [streamText] Gets or sets the stream text. + * @member {string} [summary] Gets or sets the summary. + * @member {object} [value] Gets or sets the values of the job stream. + */ +export interface JobStream { + id?: string; + jobStreamId?: string; + time?: Date; + streamType?: string; + streamText?: string; + summary?: string; + value?: { [propertyName: string]: any }; +} + +/** + * @class + * Initializes a new instance of the LinkedWorkspace class. + * @constructor + * Definition of the linked workspace. + * + * @member {string} [id] Gets the id of the linked workspace. + */ +export interface LinkedWorkspace { + readonly id?: string; +} + +/** + * @class + * Initializes a new instance of the ModuleCreateOrUpdateParameters class. + * @constructor + * The parameters supplied to the create or update module operation. + * + * @member {object} contentLink Gets or sets the module content link. + * @member {string} [contentLink.uri] Gets or sets the uri of the runbook + * content. + * @member {object} [contentLink.contentHash] Gets or sets the hash. + * @member {string} [contentLink.contentHash.algorithm] Gets or sets the + * content hash algorithm used to hash the content. + * @member {string} [contentLink.contentHash.value] Gets or sets expected hash + * value of the content. + * @member {string} [contentLink.version] Gets or sets the version of the + * content. + * @member {string} [name] Gets or sets name of the resource. + * @member {string} [location] Gets or sets the location of the resource. + * @member {object} [tags] Gets or sets the tags attached to the resource. + */ +export interface ModuleCreateOrUpdateParameters { + contentLink: ContentLink; + name?: string; + location?: string; + tags?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the ModuleUpdateParameters class. + * @constructor + * The parameters supplied to the update module operation. + * + * @member {object} [contentLink] Gets or sets the module content link. + * @member {string} [contentLink.uri] Gets or sets the uri of the runbook + * content. + * @member {object} [contentLink.contentHash] Gets or sets the hash. + * @member {string} [contentLink.contentHash.algorithm] Gets or sets the + * content hash algorithm used to hash the content. + * @member {string} [contentLink.contentHash.value] Gets or sets expected hash + * value of the content. + * @member {string} [contentLink.version] Gets or sets the version of the + * content. + * @member {string} [name] Gets or sets name of the resource. + * @member {string} [location] Gets or sets the location of the resource. + * @member {object} [tags] Gets or sets the tags attached to the resource. + */ +export interface ModuleUpdateParameters { + contentLink?: ContentLink; + name?: string; + location?: string; + tags?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the RunbookDraftUndoEditResult class. + * @constructor + * The response model for the undoedit runbook operation. + * + * @member {string} [statusCode] Possible values include: 'Continue', + * 'SwitchingProtocols', 'OK', 'Created', 'Accepted', + * 'NonAuthoritativeInformation', 'NoContent', 'ResetContent', + * 'PartialContent', 'MultipleChoices', 'Ambiguous', 'MovedPermanently', + * 'Moved', 'Found', 'Redirect', 'SeeOther', 'RedirectMethod', 'NotModified', + * 'UseProxy', 'Unused', 'TemporaryRedirect', 'RedirectKeepVerb', 'BadRequest', + * 'Unauthorized', 'PaymentRequired', 'Forbidden', 'NotFound', + * 'MethodNotAllowed', 'NotAcceptable', 'ProxyAuthenticationRequired', + * 'RequestTimeout', 'Conflict', 'Gone', 'LengthRequired', + * 'PreconditionFailed', 'RequestEntityTooLarge', 'RequestUriTooLong', + * 'UnsupportedMediaType', 'RequestedRangeNotSatisfiable', 'ExpectationFailed', + * 'UpgradeRequired', 'InternalServerError', 'NotImplemented', 'BadGateway', + * 'ServiceUnavailable', 'GatewayTimeout', 'HttpVersionNotSupported' + * @member {string} [requestId] + */ +export interface RunbookDraftUndoEditResult { + statusCode?: string; + requestId?: string; +} + +/** + * @class + * Initializes a new instance of the RunbookCreateOrUpdateParameters class. + * @constructor + * The parameters supplied to the create or update runbook operation. + * + * @member {boolean} [logVerbose] Gets or sets verbose log option. + * @member {boolean} [logProgress] Gets or sets progress log option. + * @member {string} runbookType Gets or sets the type of the runbook. Possible + * values include: 'Script', 'Graph', 'PowerShellWorkflow', 'PowerShell', + * 'GraphPowerShellWorkflow', 'GraphPowerShell' + * @member {object} [draft] Gets or sets the draft runbook properties. + * @member {boolean} [draft.inEdit] Gets or sets whether runbook is in edit + * mode. + * @member {object} [draft.draftContentLink] Gets or sets the draft runbook + * content link. + * @member {string} [draft.draftContentLink.uri] Gets or sets the uri of the + * runbook content. + * @member {object} [draft.draftContentLink.contentHash] Gets or sets the hash. + * @member {string} [draft.draftContentLink.contentHash.algorithm] Gets or sets + * the content hash algorithm used to hash the content. + * @member {string} [draft.draftContentLink.contentHash.value] Gets or sets + * expected hash value of the content. + * @member {string} [draft.draftContentLink.version] Gets or sets the version + * of the content. + * @member {date} [draft.creationTime] Gets or sets the creation time of the + * runbook draft. + * @member {date} [draft.lastModifiedTime] Gets or sets the last modified time + * of the runbook draft. + * @member {object} [draft.parameters] Gets or sets the runbook draft + * parameters. + * @member {array} [draft.outputTypes] Gets or sets the runbook output types. + * @member {object} [publishContentLink] Gets or sets the published runbook + * content link. + * @member {string} [publishContentLink.uri] Gets or sets the uri of the + * runbook content. + * @member {object} [publishContentLink.contentHash] Gets or sets the hash. + * @member {string} [publishContentLink.contentHash.algorithm] Gets or sets the + * content hash algorithm used to hash the content. + * @member {string} [publishContentLink.contentHash.value] Gets or sets + * expected hash value of the content. + * @member {string} [publishContentLink.version] Gets or sets the version of + * the content. + * @member {string} [description] Gets or sets the description of the runbook. + * @member {number} [logActivityTrace] Gets or sets the activity-level tracing + * options of the runbook. + * @member {string} [name] Gets or sets the name of the resource. + * @member {string} [location] Gets or sets the location of the resource. + * @member {object} [tags] Gets or sets the tags attached to the resource. + */ +export interface RunbookCreateOrUpdateParameters { + logVerbose?: boolean; + logProgress?: boolean; + runbookType: string; + draft?: RunbookDraft; + publishContentLink?: ContentLink; + description?: string; + logActivityTrace?: number; + name?: string; + location?: string; + tags?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the RunbookCreateOrUpdateDraftProperties class. + * @constructor + * The parameters supplied to the create or update dratft runbook properties. + * + * @member {boolean} [logVerbose] Gets or sets verbose log option. + * @member {boolean} [logProgress] Gets or sets progress log option. + * @member {string} runbookType Gets or sets the type of the runbook. Possible + * values include: 'Script', 'Graph', 'PowerShellWorkflow', 'PowerShell', + * 'GraphPowerShellWorkflow', 'GraphPowerShell' + * @member {object} draft Gets or sets the draft runbook properties. + * @member {boolean} [draft.inEdit] Gets or sets whether runbook is in edit + * mode. + * @member {object} [draft.draftContentLink] Gets or sets the draft runbook + * content link. + * @member {string} [draft.draftContentLink.uri] Gets or sets the uri of the + * runbook content. + * @member {object} [draft.draftContentLink.contentHash] Gets or sets the hash. + * @member {string} [draft.draftContentLink.contentHash.algorithm] Gets or sets + * the content hash algorithm used to hash the content. + * @member {string} [draft.draftContentLink.contentHash.value] Gets or sets + * expected hash value of the content. + * @member {string} [draft.draftContentLink.version] Gets or sets the version + * of the content. + * @member {date} [draft.creationTime] Gets or sets the creation time of the + * runbook draft. + * @member {date} [draft.lastModifiedTime] Gets or sets the last modified time + * of the runbook draft. + * @member {object} [draft.parameters] Gets or sets the runbook draft + * parameters. + * @member {array} [draft.outputTypes] Gets or sets the runbook output types. + * @member {string} [description] Gets or sets the description of the runbook. + * @member {number} [logActivityTrace] Gets or sets the activity-level tracing + * options of the runbook. + */ +export interface RunbookCreateOrUpdateDraftProperties { + logVerbose?: boolean; + logProgress?: boolean; + runbookType: string; + draft: RunbookDraft; + description?: string; + logActivityTrace?: number; +} + +/** + * @class + * Initializes a new instance of the RunbookCreateOrUpdateDraftParameters class. + * @constructor + * The parameters supplied to the create or update runbook operation. + * + * @member {string} runbookContent Content of the Runbook. + */ +export interface RunbookCreateOrUpdateDraftParameters { + runbookContent: string; +} + +/** + * @class + * Initializes a new instance of the RunbookUpdateParameters class. + * @constructor + * The parameters supplied to the update runbook operation. + * + * @member {string} [description] Gets or sets the description of the runbook. + * @member {boolean} [logVerbose] Gets or sets verbose log option. + * @member {boolean} [logProgress] Gets or sets progress log option. + * @member {number} [logActivityTrace] Gets or sets the activity-level tracing + * options of the runbook. + * @member {string} [name] Gets or sets the name of the resource. + * @member {string} [location] Gets or sets the location of the resource. + * @member {object} [tags] Gets or sets the tags attached to the resource. + */ +export interface RunbookUpdateParameters { + description?: string; + logVerbose?: boolean; + logProgress?: boolean; + logActivityTrace?: number; + name?: string; + location?: string; + tags?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the ScheduleCreateOrUpdateParameters class. + * @constructor + * The parameters supplied to the create or update schedule operation. + * + * @member {string} name Gets or sets the name of the schedule. + * @member {string} [description] Gets or sets the description of the schedule. + * @member {date} startTime Gets or sets the start time of the schedule. + * @member {date} [expiryTime] Gets or sets the end time of the schedule. + * @member {object} [interval] Gets or sets the interval of the schedule. + * @member {string} frequency Possible values include: 'OneTime', 'Day', + * 'Hour', 'Week', 'Month' + * @member {string} [timeZone] Gets or sets the time zone of the schedule. + * @member {object} [advancedSchedule] Gets or sets the AdvancedSchedule. + * @member {array} [advancedSchedule.weekDays] Days of the week that the job + * should execute on. + * @member {array} [advancedSchedule.monthDays] Days of the month that the job + * should execute on. Must be between 1 and 31. + * @member {array} [advancedSchedule.monthlyOccurrences] Occurrences of days + * within a month. + */ +export interface ScheduleCreateOrUpdateParameters { + name: string; + description?: string; + startTime: Date; + expiryTime?: Date; + interval?: any; + frequency: string; + timeZone?: string; + advancedSchedule?: AdvancedSchedule; +} + +/** + * @class + * Initializes a new instance of the ScheduleProperties class. + * @constructor + * Definition of schedule parameters. + * + * @member {date} [startTime] Gets or sets the start time of the schedule. + * @member {number} [startTimeOffsetMinutes] Gets the start time's offset in + * minutes. + * @member {date} [expiryTime] Gets or sets the end time of the schedule. + * @member {number} [expiryTimeOffsetMinutes] Gets or sets the expiry time's + * offset in minutes. + * @member {boolean} [isEnabled] Gets or sets a value indicating whether this + * schedule is enabled. Default value: false . + * @member {date} [nextRun] Gets or sets the next run time of the schedule. + * @member {number} [nextRunOffsetMinutes] Gets or sets the next run time's + * offset in minutes. + * @member {number} [interval] Gets or sets the interval of the schedule. + * @member {string} [frequency] Gets or sets the frequency of the schedule. + * Possible values include: 'OneTime', 'Day', 'Hour', 'Week', 'Month' + * @member {string} [timeZone] Gets or sets the time zone of the schedule. + * @member {object} [advancedSchedule] Gets or sets the advanced schedule. + * @member {array} [advancedSchedule.weekDays] Days of the week that the job + * should execute on. + * @member {array} [advancedSchedule.monthDays] Days of the month that the job + * should execute on. Must be between 1 and 31. + * @member {array} [advancedSchedule.monthlyOccurrences] Occurrences of days + * within a month. + * @member {date} [creationTime] Gets or sets the creation time. + * @member {date} [lastModifiedTime] Gets or sets the last modified time. + * @member {string} [description] Gets or sets the description. + */ +export interface ScheduleProperties { + startTime?: Date; + readonly startTimeOffsetMinutes?: number; + expiryTime?: Date; + expiryTimeOffsetMinutes?: number; + isEnabled?: boolean; + nextRun?: Date; + nextRunOffsetMinutes?: number; + interval?: number; + frequency?: string; + timeZone?: string; + advancedSchedule?: AdvancedSchedule; + creationTime?: Date; + lastModifiedTime?: Date; + description?: string; +} + +/** + * @class + * Initializes a new instance of the Schedule class. + * @constructor + * Definition of the schedule. + * + * @member {string} [id] Gets the id of the resource. + * @member {string} [name] Gets name of the schedule. + * @member {string} [type] Resource type + * @member {date} [startTime] Gets or sets the start time of the schedule. + * @member {number} [startTimeOffsetMinutes] Gets the start time's offset in + * minutes. + * @member {date} [expiryTime] Gets or sets the end time of the schedule. + * @member {number} [expiryTimeOffsetMinutes] Gets or sets the expiry time's + * offset in minutes. + * @member {boolean} [isEnabled] Gets or sets a value indicating whether this + * schedule is enabled. Default value: false . + * @member {date} [nextRun] Gets or sets the next run time of the schedule. + * @member {number} [nextRunOffsetMinutes] Gets or sets the next run time's + * offset in minutes. + * @member {number} [interval] Gets or sets the interval of the schedule. + * @member {string} [frequency] Gets or sets the frequency of the schedule. + * Possible values include: 'OneTime', 'Day', 'Hour', 'Week', 'Month' + * @member {string} [timeZone] Gets or sets the time zone of the schedule. + * @member {object} [advancedSchedule] Gets or sets the advanced schedule. + * @member {array} [advancedSchedule.weekDays] Days of the week that the job + * should execute on. + * @member {array} [advancedSchedule.monthDays] Days of the month that the job + * should execute on. Must be between 1 and 31. + * @member {array} [advancedSchedule.monthlyOccurrences] Occurrences of days + * within a month. + * @member {date} [creationTime] Gets or sets the creation time. + * @member {date} [lastModifiedTime] Gets or sets the last modified time. + * @member {string} [description] Gets or sets the description. + */ +export interface Schedule { + readonly id?: string; + readonly name?: string; + readonly type?: string; + startTime?: Date; + readonly startTimeOffsetMinutes?: number; + expiryTime?: Date; + expiryTimeOffsetMinutes?: number; + isEnabled?: boolean; + nextRun?: Date; + nextRunOffsetMinutes?: number; + interval?: number; + frequency?: string; + timeZone?: string; + advancedSchedule?: AdvancedSchedule; + creationTime?: Date; + lastModifiedTime?: Date; + description?: string; +} + +/** + * @class + * Initializes a new instance of the ScheduleUpdateParameters class. + * @constructor + * The parameters supplied to the update schedule operation. + * + * @member {string} [name] Gets or sets the name of the schedule. + * @member {string} [description] Gets or sets the description of the schedule. + * @member {boolean} [isEnabled] Gets or sets a value indicating whether this + * schedule is enabled. + */ +export interface ScheduleUpdateParameters { + name?: string; + description?: string; + isEnabled?: boolean; +} + +/** + * @class + * Initializes a new instance of the SubResource class. + * @constructor + * The Sub Resource definition. + * + * @member {string} [id] Resource Id + */ +export interface SubResource extends BaseResource { + id?: string; +} + +/** + * @class + * Initializes a new instance of the TestJobCreateParameters class. + * @constructor + * The parameters supplied to the create test job operation. + * + * @member {object} [parameters] Gets or sets the parameters of the test job. + * @member {string} [runOn] Gets or sets the runOn which specifies the group + * name where the job is to be executed. + */ +export interface TestJobCreateParameters { + parameters?: { [propertyName: string]: string }; + runOn?: string; +} + +/** + * @class + * Initializes a new instance of the TestJob class. + * @constructor + * Definition of the test job. + * + * @member {date} [creationTime] Gets or sets the creation time of the test + * job. + * @member {string} [status] Gets or sets the status of the test job. + * @member {string} [statusDetails] Gets or sets the status details of the test + * job. + * @member {string} [runOn] Gets or sets the runOn which specifies the group + * name where the job is to be executed. + * @member {date} [startTime] Gets or sets the start time of the test job. + * @member {date} [endTime] Gets or sets the end time of the test job. + * @member {string} [exception] Gets or sets the exception of the test job. + * @member {date} [lastModifiedTime] Gets or sets the last modified time of the + * test job. + * @member {date} [lastStatusModifiedTime] Gets or sets the last status + * modified time of the test job. + * @member {object} [parameters] Gets or sets the parameters of the test job. + * @member {number} [logActivityTrace] The activity-level tracing options of + * the runbook. + */ +export interface TestJob { + creationTime?: Date; + status?: string; + statusDetails?: string; + runOn?: string; + startTime?: Date; + endTime?: Date; + exception?: string; + lastModifiedTime?: Date; + lastStatusModifiedTime?: Date; + parameters?: { [propertyName: string]: string }; + logActivityTrace?: number; +} + +/** + * @class + * Initializes a new instance of the TypeField class. + * @constructor + * Information about a field of a type. + * + * @member {string} [name] Gets or sets the name of the field. + * @member {string} [type] Gets or sets the type of the field. + */ +export interface TypeField { + name?: string; + type?: string; +} + +/** + * @class + * Initializes a new instance of the VariableCreateOrUpdateParameters class. + * @constructor + * The parameters supplied to the create or update variable operation. + * + * @member {string} name Gets or sets the name of the variable. + * @member {string} [value] Gets or sets the value of the variable. + * @member {string} [description] Gets or sets the description of the variable. + * @member {boolean} [isEncrypted] Gets or sets the encrypted flag of the + * variable. + */ +export interface VariableCreateOrUpdateParameters { + name: string; + value?: string; + description?: string; + isEncrypted?: boolean; +} + +/** + * @class + * Initializes a new instance of the VariableUpdateParameters class. + * @constructor + * The parameters supplied to the update variable operation. + * + * @member {string} [name] Gets or sets the name of the variable. + * @member {string} [value] Gets or sets the value of the variable. + * @member {string} [description] Gets or sets the description of the variable. + */ +export interface VariableUpdateParameters { + name?: string; + value?: string; + description?: string; +} + +/** + * @class + * Initializes a new instance of the WebhookCreateOrUpdateParameters class. + * @constructor + * The parameters supplied to the create or update webhook operation. + * + * @member {string} name Gets or sets the name of the webhook. + * @member {boolean} [isEnabled] Gets or sets the value of the enabled flag of + * webhook. + * @member {string} [uri] Gets or sets the uri. + * @member {date} [expiryTime] Gets or sets the expiry time. + * @member {object} [parameters] Gets or sets the parameters of the job. + * @member {object} [runbook] Gets or sets the runbook. + * @member {string} [runbook.name] Gets or sets the name of the runbook. + * @member {string} [runOn] Gets or sets the name of the hybrid worker group + * the webhook job will run on. + */ +export interface WebhookCreateOrUpdateParameters { + name: string; + isEnabled?: boolean; + uri?: string; + expiryTime?: Date; + parameters?: { [propertyName: string]: string }; + runbook?: RunbookAssociationProperty; + runOn?: string; +} + +/** + * @class + * Initializes a new instance of the WebhookUpdateParameters class. + * @constructor + * The parameters supplied to the update webhook operation. + * + * @member {string} [name] Gets or sets the name of the webhook. + * @member {boolean} [isEnabled] Gets or sets the value of the enabled flag of + * webhook. + * @member {string} [runOn] Gets or sets the name of the hybrid worker group + * the webhook job will run on. + * @member {object} [parameters] Gets or sets the parameters of the job. + * @member {string} [description] Gets or sets the description of the webhook. + */ +export interface WebhookUpdateParameters { + name?: string; + isEnabled?: boolean; + runOn?: string; + parameters?: { [propertyName: string]: string }; + description?: string; +} + +/** + * @class + * Initializes a new instance of the JobCollectionItem class. + * @constructor + * Job collection item properties. + * + * @member {object} [runbook] The runbook association. + * @member {string} [runbook.name] Gets or sets the name of the runbook. + * @member {uuid} [jobId] The id of the job. + * @member {date} [creationTime] The creation time of the job. + * @member {string} [status] The status of the job. Possible values include: + * 'New', 'Activating', 'Running', 'Completed', 'Failed', 'Stopped', 'Blocked', + * 'Suspended', 'Disconnected', 'Suspending', 'Stopping', 'Resuming', + * 'Removing' + * @member {date} [startTime] The start time of the job. + * @member {date} [endTime] The end time of the job. + * @member {date} [lastModifiedTime] The last modified time of the job. + * @member {object} [provisioningState] The current provisioning state of the + * job. + * @member {string} [provisioningState.provisioningState] The provisioning + * state of the resource. Possible values include: 'Failed', 'Succeeded', + * 'Suspended', 'Processing' + */ +export interface JobCollectionItem extends ProxyResource { + readonly runbook?: RunbookAssociationProperty; + readonly jobId?: string; + readonly creationTime?: Date; + readonly status?: string; + readonly startTime?: Date; + readonly endTime?: Date; + readonly lastModifiedTime?: Date; + provisioningState?: JobProvisioningStateProperty; +} + +/** + * @class + * Initializes a new instance of the WindowsProperties class. + * @constructor + * Windows specific update configuration. + * + * @member {string} [includedUpdateClassifications] Update classification + * included in the software update configuration. A comma separated string with + * required values. Possible values include: 'Unclassified', 'Critical', + * 'Security', 'UpdateRollup', 'FeaturePack', 'ServicePack', 'Definition', + * 'Tools', 'Updates' + * @member {array} [excludedKbNumbers] KB numbers excluded from the software + * update configuration. + */ +export interface WindowsProperties { + includedUpdateClassifications?: string; + excludedKbNumbers?: string[]; +} + +/** + * @class + * Initializes a new instance of the LinuxProperties class. + * @constructor + * Linux specific update configuration. + * + * @member {string} [includedPackageClassifications] Update classifications + * included in the software update configuration. Possible values include: + * 'Unclassified', 'Critical', 'Security', 'Other' + * @member {array} [excludedPackageNameMasks] packages excluded from the + * software update configuration. + */ +export interface LinuxProperties { + includedPackageClassifications?: string; + excludedPackageNameMasks?: string[]; +} + +/** + * @class + * Initializes a new instance of the UpdateConfiguration class. + * @constructor + * Update specifc properties of the software update configuration. + * + * @member {string} operatingSystem operating system of target machines. + * Possible values include: 'Windows', 'Linux' + * @member {object} [windows] Windows specific update configuration. + * @member {string} [windows.includedUpdateClassifications] Update + * classification included in the software update configuration. A comma + * separated string with required values. Possible values include: + * 'Unclassified', 'Critical', 'Security', 'UpdateRollup', 'FeaturePack', + * 'ServicePack', 'Definition', 'Tools', 'Updates' + * @member {array} [windows.excludedKbNumbers] KB numbers excluded from the + * software update configuration. + * @member {object} [linux] Linux specific update configuration. + * @member {string} [linux.includedPackageClassifications] Update + * classifications included in the software update configuration. Possible + * values include: 'Unclassified', 'Critical', 'Security', 'Other' + * @member {array} [linux.excludedPackageNameMasks] packages excluded from the + * software update configuration. + * @member {moment.duration} [duration] Maximum time allowed for the software + * update configuration run. Duration needs to be specified using the format + * PT[n]H[n]M[n]S as per ISO8601 + * @member {array} [azureVirtualMachines] List of azure resource Ids for azure + * virtual machines targeted by the software update configuration. + * @member {array} [nonAzureComputerNames] List of names of non-azure machines + * targeted by the software update configuration. + */ +export interface UpdateConfiguration { + operatingSystem: string; + windows?: WindowsProperties; + linux?: LinuxProperties; + duration?: moment.Duration; + azureVirtualMachines?: string[]; + nonAzureComputerNames?: string[]; +} + +/** + * @class + * Initializes a new instance of the SoftwareUpdateConfiguration class. + * @constructor + * Software update configuration properties. + * + * @member {string} [name] Resource name. + * @member {string} [id] Resource Id. + * @member {string} [type] Resource type + * @member {object} updateConfiguration update specific properties for the + * Software update configuration + * @member {string} [updateConfiguration.operatingSystem] operating system of + * target machines. Possible values include: 'Windows', 'Linux' + * @member {object} [updateConfiguration.windows] Windows specific update + * configuration. + * @member {string} [updateConfiguration.windows.includedUpdateClassifications] + * Update classification included in the software update configuration. A comma + * separated string with required values. Possible values include: + * 'Unclassified', 'Critical', 'Security', 'UpdateRollup', 'FeaturePack', + * 'ServicePack', 'Definition', 'Tools', 'Updates' + * @member {array} [updateConfiguration.windows.excludedKbNumbers] KB numbers + * excluded from the software update configuration. + * @member {object} [updateConfiguration.linux] Linux specific update + * configuration. + * @member {string} [updateConfiguration.linux.includedPackageClassifications] + * Update classifications included in the software update configuration. + * Possible values include: 'Unclassified', 'Critical', 'Security', 'Other' + * @member {array} [updateConfiguration.linux.excludedPackageNameMasks] + * packages excluded from the software update configuration. + * @member {moment.duration} [updateConfiguration.duration] Maximum time + * allowed for the software update configuration run. Duration needs to be + * specified using the format PT[n]H[n]M[n]S as per ISO8601 + * @member {array} [updateConfiguration.azureVirtualMachines] List of azure + * resource Ids for azure virtual machines targeted by the software update + * configuration. + * @member {array} [updateConfiguration.nonAzureComputerNames] List of names of + * non-azure machines targeted by the software update configuration. + * @member {object} scheduleInfo Schedule information for the Software update + * configuration + * @member {date} [scheduleInfo.startTime] Gets or sets the start time of the + * schedule. + * @member {number} [scheduleInfo.startTimeOffsetMinutes] Gets the start time's + * offset in minutes. + * @member {date} [scheduleInfo.expiryTime] Gets or sets the end time of the + * schedule. + * @member {number} [scheduleInfo.expiryTimeOffsetMinutes] Gets or sets the + * expiry time's offset in minutes. + * @member {boolean} [scheduleInfo.isEnabled] Gets or sets a value indicating + * whether this schedule is enabled. + * @member {date} [scheduleInfo.nextRun] Gets or sets the next run time of the + * schedule. + * @member {number} [scheduleInfo.nextRunOffsetMinutes] Gets or sets the next + * run time's offset in minutes. + * @member {number} [scheduleInfo.interval] Gets or sets the interval of the + * schedule. + * @member {string} [scheduleInfo.frequency] Gets or sets the frequency of the + * schedule. Possible values include: 'OneTime', 'Day', 'Hour', 'Week', 'Month' + * @member {string} [scheduleInfo.timeZone] Gets or sets the time zone of the + * schedule. + * @member {object} [scheduleInfo.advancedSchedule] Gets or sets the advanced + * schedule. + * @member {array} [scheduleInfo.advancedSchedule.weekDays] Days of the week + * that the job should execute on. + * @member {array} [scheduleInfo.advancedSchedule.monthDays] Days of the month + * that the job should execute on. Must be between 1 and 31. + * @member {array} [scheduleInfo.advancedSchedule.monthlyOccurrences] + * Occurrences of days within a month. + * @member {date} [scheduleInfo.creationTime] Gets or sets the creation time. + * @member {date} [scheduleInfo.lastModifiedTime] Gets or sets the last + * modified time. + * @member {string} [scheduleInfo.description] Gets or sets the description. + * @member {string} [provisioningState] Provisioning state for the software + * update configuration, which only appears in the response. + * @member {object} [error] detailes of provisioning error + * @member {string} [error.code] Error code + * @member {string} [error.message] Error message indicating why the operation + * failed. + * @member {date} [creationTime] Creation time of theresource, which only + * appears in the response. + * @member {string} [createdBy] createdBy property, which only appears in the + * response. + * @member {date} [lastModifiedTime] Last time resource was modified, which + * only appears in the response. + * @member {string} [lastModifiedBy] lastModifiedBy property, which only + * appears in the response. + */ +export interface SoftwareUpdateConfiguration extends BaseResource { + readonly name?: string; + readonly id?: string; + readonly type?: string; + updateConfiguration: UpdateConfiguration; + scheduleInfo: ScheduleProperties; + readonly provisioningState?: string; + error?: ErrorResponse; + readonly creationTime?: Date; + readonly createdBy?: string; + readonly lastModifiedTime?: Date; + readonly lastModifiedBy?: string; +} + +/** + * @class + * Initializes a new instance of the CollectionItemUpdateConfiguration class. + * @constructor + * object returned when requesting a collection of software update + * configuration + * + * @member {array} [azureVirtualMachines] List of azure resource Ids for azure + * virtual machines targeted by the software update configuration. + * @member {moment.duration} [duration] Maximum time allowed for the software + * update configuration run. Duration needs to be specified using the format + * PT[n]H[n]M[n]S as per ISO8601 + */ +export interface CollectionItemUpdateConfiguration { + azureVirtualMachines?: string[]; + duration?: moment.Duration; +} + +/** + * @class + * Initializes a new instance of the SoftwareUpdateConfigurationCollectionItem class. + * @constructor + * Software update configuration collection item properties. + * + * @member {string} [name] Name of the software update configuration. + * @member {string} [id] Resource Id of the software update configuration + * @member {object} [updateConfiguration] Update specific properties of the + * software update configuration. + * @member {array} [updateConfiguration.azureVirtualMachines] List of azure + * resource Ids for azure virtual machines targeted by the software update + * configuration. + * @member {moment.duration} [updateConfiguration.duration] Maximum time + * allowed for the software update configuration run. Duration needs to be + * specified using the format PT[n]H[n]M[n]S as per ISO8601 + * @member {string} [frequency] execution frequency of the schedule associated + * with the software update configuration. Possible values include: 'OneTime', + * 'Day', 'Hour', 'Week', 'Month' + * @member {date} [startTime] the start time of the update. + * @member {date} [creationTime] Creation time of the software update + * configuration, which only appears in the response. + * @member {date} [lastModifiedTime] Last time software update configuration + * was modified, which only appears in the response. + * @member {string} [provisioningState] Provisioning state for the software + * update configuration, which only appears in the response. + * @member {date} [nextRun] ext run time of the update. + */ +export interface SoftwareUpdateConfigurationCollectionItem { + readonly name?: string; + readonly id?: string; + updateConfiguration?: CollectionItemUpdateConfiguration; + frequency?: string; + startTime?: Date; + readonly creationTime?: Date; + readonly lastModifiedTime?: Date; + readonly provisioningState?: string; + nextRun?: Date; +} + +/** + * @class + * Initializes a new instance of the SoftwareUpdateConfigurationListResult class. + * @constructor + * result of listing all software update configuration + * + * @member {array} [value] outer object returned when listing all software + * update configurations + */ +export interface SoftwareUpdateConfigurationListResult { + value?: SoftwareUpdateConfigurationCollectionItem[]; +} + +/** + * @class + * Initializes a new instance of the UpdateConfigurationNavigation class. + * @constructor + * Software update configuration Run Navigation model. + * + * @member {string} [name] Name of the software update configuration triggered + * the software update configuration run + */ +export interface UpdateConfigurationNavigation { + readonly name?: string; +} + +/** + * @class + * Initializes a new instance of the JobNavigation class. + * @constructor + * Software update configuration machine run job navigation properties. + * + * @member {string} [id] Id of the job associated with the software update + * configuration run + */ +export interface JobNavigation { + readonly id?: string; +} + +/** + * @class + * Initializes a new instance of the SoftwareUpdateConfigurationRun class. + * @constructor + * Software update configuration Run properties. + * + * @member {string} [name] Name of the software update configuration run. + * @member {string} [id] Resource Id of the software update configuration run + * @member {object} [softwareUpdateConfiguration] software update configuration + * triggered this run + * @member {string} [softwareUpdateConfiguration.name] Name of the software + * update configuration triggered the software update configuration run + * @member {string} [status] Status of the software update configuration run. + * @member {string} [configuredDuration] configured duration for the software + * update configuration run. + * @member {string} [osType] Operating system target of the software update + * configuration triggered this run + * @member {date} [startTime] Etart time of the software update configuration + * run. + * @member {date} [endTime] End time of the software update configuration run. + * @member {number} [computerCount] Number of computers in the software update + * configuration run. + * @member {number} [failedCount] Number of computers with failed status. + * @member {date} [creationTime] Creation time of theresource, which only + * appears in the response. + * @member {string} [createdBy] createdBy property, which only appears in the + * response. + * @member {date} [lastModifiedTime] Last time resource was modified, which + * only appears in the response. + * @member {string} [lastModifiedBy] lastModifiedBy property, which only + * appears in the response. + */ +export interface SoftwareUpdateConfigurationRun { + readonly name?: string; + readonly id?: string; + softwareUpdateConfiguration?: UpdateConfigurationNavigation; + readonly status?: string; + readonly configuredDuration?: string; + readonly osType?: string; + readonly startTime?: Date; + readonly endTime?: Date; + readonly computerCount?: number; + readonly failedCount?: number; + readonly creationTime?: Date; + readonly createdBy?: string; + readonly lastModifiedTime?: Date; + readonly lastModifiedBy?: string; +} + +/** + * @class + * Initializes a new instance of the SoftwareUpdateConfigurationRunListResult class. + * @constructor + * result of listing all software update configuration runs + * + * @member {array} [value] outer object returned when listing all software + * update configuration runs + * @member {string} [nextLink] link to next page of results. + */ +export interface SoftwareUpdateConfigurationRunListResult { + value?: SoftwareUpdateConfigurationRun[]; + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the SoftwareUpdateConfigurationMachineRun class. + * @constructor + * Software update configuration machine run model. + * + * @member {string} [name] Name of the software update configuration machine + * run + * @member {string} [id] Resource Id of the software update configuration + * machine run + * @member {string} [targetComputer] name of the updated computer + * @member {string} [targetComputerType] type of the updated computer. + * @member {object} [softwareUpdateConfiguration] software update configuration + * triggered this run + * @member {string} [softwareUpdateConfiguration.name] Name of the software + * update configuration triggered the software update configuration run + * @member {string} [status] Status of the software update configuration + * machine run. + * @member {string} [osType] Operating system target of the software update + * configuration triggered this run + * @member {uuid} [correlationId] correlation id of the software update + * configuration machine run + * @member {uuid} [sourceComputerId] source computer id of the software update + * configuration machine run + * @member {date} [startTime] Start time of the software update configuration + * machine run. + * @member {date} [endTime] End time of the software update configuration + * machine run. + * @member {string} [configuredDuration] configured duration for the software + * update configuration run. + * @member {object} [job] Job associated with the software update configuration + * machine run + * @member {string} [job.id] Id of the job associated with the software update + * configuration run + * @member {date} [creationTime] Creation time of theresource, which only + * appears in the response. + * @member {string} [createdBy] createdBy property, which only appears in the + * response. + * @member {date} [lastModifiedTime] Last time resource was modified, which + * only appears in the response. + * @member {string} [lastModifiedBy] lastModifiedBy property, which only + * appears in the response. + */ +export interface SoftwareUpdateConfigurationMachineRun { + readonly name?: string; + readonly id?: string; + readonly targetComputer?: string; + readonly targetComputerType?: string; + softwareUpdateConfiguration?: UpdateConfigurationNavigation; + readonly status?: string; + readonly osType?: string; + readonly correlationId?: string; + readonly sourceComputerId?: string; + readonly startTime?: Date; + readonly endTime?: Date; + readonly configuredDuration?: string; + job?: JobNavigation; + readonly creationTime?: Date; + readonly createdBy?: string; + readonly lastModifiedTime?: Date; + readonly lastModifiedBy?: string; +} + +/** + * @class + * Initializes a new instance of the SoftwareUpdateConfigurationMachineRunListResult class. + * @constructor + * result of listing all software update configuration machine runs + * + * @member {array} [value] outer object returned when listing all software + * update configuration machine runs + * @member {string} [nextLink] link to next page of results. + */ +export interface SoftwareUpdateConfigurationMachineRunListResult { + value?: SoftwareUpdateConfigurationMachineRun[]; + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the SourceControlCreateOrUpdateParameters class. + * @constructor + * The parameters supplied to the create or update source control operation. + * + * @member {string} [repoUrl] Gets or sets the repo url of the source control. + * @member {string} [branch] Gets or sets the repo branch of the source + * control. Include branch as empty string for VsoTfvc. + * @member {string} [folderPath] Gets or sets the folder path of the source + * control. Path must be relative. + * @member {boolean} [autoSync] Gets or sets auto async of the source control. + * Default is false. + * @member {boolean} [publishRunbook] Gets or sets the auto publish of the + * source control. Default is true. + * @member {string} [sourceType] The source type. Must be one of VsoGit, + * VsoTfvc, GitHub, case sensitive. Possible values include: 'VsoGit', + * 'VsoTfvc', 'GitHub' + * @member {string} [securityToken] Gets or sets the authorization token for + * the repo of the source control. + * @member {string} [description] Gets or sets the user description of the + * source control. + */ +export interface SourceControlCreateOrUpdateParameters { + repoUrl?: string; + branch?: string; + folderPath?: string; + autoSync?: boolean; + publishRunbook?: boolean; + sourceType?: string; + securityToken?: string; + description?: string; +} + +/** + * @class + * Initializes a new instance of the SourceControl class. + * @constructor + * Definition of the source control. + * + * @member {string} [name] Resource name. + * @member {string} [id] Resource Id. + * @member {string} [type] Resource type. + * @member {string} [repoUrl] Gets or sets the repo url of the source control. + * @member {string} [branch] Gets or sets the repo branch of the source + * control. Include branch as empty string for VsoTfvc. + * @member {string} [folderPath] Gets or sets the folder path of the source + * control. + * @member {boolean} [autoSync] Gets or sets auto async of the source control. + * Default is false. + * @member {boolean} [publishRunbook] Gets or sets the auto publish of the + * source control. Default is true. + * @member {string} [sourceType] The source type. Must be one of VsoGit, + * VsoTfvc, GitHub. Possible values include: 'VsoGit', 'VsoTfvc', 'GitHub' + * @member {string} [description] Gets or sets the description. + * @member {date} [creationTime] Gets or sets the creation time. + * @member {date} [lastModifiedTime] Gets or sets the last modified time. + */ +export interface SourceControl extends BaseResource { + readonly name?: string; + readonly id?: string; + readonly type?: string; + repoUrl?: string; + branch?: string; + folderPath?: string; + autoSync?: boolean; + publishRunbook?: boolean; + sourceType?: string; + description?: string; + creationTime?: Date; + lastModifiedTime?: Date; +} + +/** + * @class + * Initializes a new instance of the SourceControlUpdateParameters class. + * @constructor + * The parameters supplied to the update source control operation. + * + * @member {string} [branch] Gets or sets the repo branch of the source + * control. + * @member {string} [folderPath] Gets or sets the folder path of the source + * control. Path must be relative. + * @member {boolean} [autoSync] Gets or sets auto async of the source control. + * Default is false. + * @member {boolean} [publishRunbook] Gets or sets the auto publish of the + * source control. Default is true. + * @member {string} [securityToken] Gets or sets the authorization token for + * the repo of the source control. + * @member {string} [description] Gets or sets the user description of the + * source control. + */ +export interface SourceControlUpdateParameters { + branch?: string; + folderPath?: string; + autoSync?: boolean; + publishRunbook?: boolean; + securityToken?: string; + description?: string; +} + +/** + * @class + * Initializes a new instance of the SourceControlSyncJob class. + * @constructor + * Definition of the source control sync job. + * + * @member {string} [name] Resource name. + * @member {string} [type] Resource type. + * @member {string} [id] Resource id. + * @member {string} [sourceControlSyncJobId] Gets the source control sync job + * id. + * @member {date} [creationTime] Gets the creation time of the job. + * @member {string} [provisioningState] Gets the provisioning state of the job. + * Possible values include: 'Completed', 'Failed', 'Running' + * @member {date} [startTime] Gets the start time of the job. + * @member {date} [endTime] Gets the end time of the job. + * @member {string} [startedBy] Gets the user who started the sync job. + */ +export interface SourceControlSyncJob { + readonly name?: string; + readonly type?: string; + readonly id?: string; + sourceControlSyncJobId?: string; + readonly creationTime?: Date; + provisioningState?: string; + readonly startTime?: Date; + readonly endTime?: Date; + startedBy?: string; +} + +/** + * @class + * Initializes a new instance of the SourceControlSyncJobByIdErrors class. + * @constructor + * Error details of the source control sync job. + * + * @member {string} [code] Gets the error code for the job. + * @member {string} [message] Gets the error message for the job. + */ +export interface SourceControlSyncJobByIdErrors { + code?: string; + message?: string; +} + +/** + * @class + * Initializes a new instance of the SourceControlSyncJobById class. + * @constructor + * Definition of the source control sync job. + * + * @member {string} [id] Gets the id of the job. + * @member {string} [sourceControlSyncJobId] Gets the source control sync job + * id. + * @member {date} [creationTime] Gets the creation time of the job. + * @member {string} [provisioningState] Gets the provisioning state of the job. + * Possible values include: 'Completed', 'Failed', 'Running' + * @member {date} [startTime] Gets the start time of the job. + * @member {date} [endTime] Gets the end time of the job. + * @member {string} [startedBy] Gets the user who started the sync job. + * @member {object} [errors] Error details of the source control sync job. + * @member {string} [errors.code] Gets the error code for the job. + * @member {string} [errors.message] Gets the error message for the job. + */ +export interface SourceControlSyncJobById { + id?: string; + sourceControlSyncJobId?: string; + readonly creationTime?: Date; + provisioningState?: string; + readonly startTime?: Date; + readonly endTime?: Date; + startedBy?: string; + errors?: SourceControlSyncJobByIdErrors; +} + +/** + * @class + * Initializes a new instance of the DscNode class. + * @constructor + * Definition of a DscNode + * + * @member {date} [lastSeen] Gets or sets the last seen time of the node. + * @member {date} [registrationTime] Gets or sets the registration time of the + * node. + * @member {string} [ip] Gets or sets the ip of the node. + * @member {string} [accountId] Gets or sets the account id of the node. + * @member {string} [dscNodeName] Gets or sets the name of the dsc + * nodeconfiguration. + * @member {string} [status] Gets or sets the status of the node. + * @member {string} [nodeId] Gets or sets the node id. + * @member {string} [etag] Gets or sets the etag of the resource. + * @member {array} [extensionHandler] Gets or sets the list of extensionHandler + * properties for a Node. + */ +export interface DscNode extends ProxyResource { + lastSeen?: Date; + registrationTime?: Date; + ip?: string; + accountId?: string; + dscNodeName?: string; + status?: string; + nodeId?: string; + etag?: string; + extensionHandler?: DscNodeExtensionHandlerAssociationProperty[]; +} + +/** + * @class + * Initializes a new instance of the DscNodeConfiguration class. + * @constructor + * Definition of the dsc node configuration. + * + * @member {date} [lastModifiedTime] Gets or sets the last modified time. + * @member {date} [creationTime] Gets or sets creation time. + * @member {object} [configuration] Gets or sets the configuration of the node. + * @member {string} [configuration.name] Gets or sets the name of the Dsc + * configuration. + * @member {string} [source] Source of node configuration. + * @member {number} [nodeCount] Number of nodes with this nodeconfiguration + * assigned + * @member {boolean} [incrementNodeConfigurationBuild] If a new build version + * of NodeConfiguration is required. + */ +export interface DscNodeConfiguration extends ProxyResource { + lastModifiedTime?: Date; + creationTime?: Date; + configuration?: DscConfigurationAssociationProperty; + source?: string; + nodeCount?: number; + incrementNodeConfigurationBuild?: boolean; +} + +/** + * @class + * Initializes a new instance of the DscNodeConfigurationCreateOrUpdateParametersProperties class. + * @constructor + * The parameters supplied to the create or update node configuration + * operation. + * + * @member {object} source Gets or sets the source. + * @member {object} [source.hash] Gets or sets the hash. + * @member {string} [source.hash.algorithm] Gets or sets the content hash + * algorithm used to hash the content. + * @member {string} [source.hash.value] Gets or sets expected hash value of the + * content. + * @member {string} [source.type] Gets or sets the content source type. + * Possible values include: 'embeddedContent', 'uri' + * @member {string} [source.value] Gets or sets the value of the content. This + * is based on the content source type. + * @member {string} [source.version] Gets or sets the version of the content. + * @member {string} name Gets or sets the type of the parameter. + * @member {object} configuration Gets or sets the configuration of the node. + * @member {string} [configuration.name] Gets or sets the name of the Dsc + * configuration. + * @member {boolean} [incrementNodeConfigurationBuild] If a new build version + * of NodeConfiguration is required. + */ +export interface DscNodeConfigurationCreateOrUpdateParametersProperties { + source: ContentSource; + name: string; + configuration: DscConfigurationAssociationProperty; + incrementNodeConfigurationBuild?: boolean; +} + + +/** + * @class + * Initializes a new instance of the AutomationAccountListResult class. + * @constructor + * The response model for the list account operation. + * + * @member {string} [nextLink] Gets or sets the next link. + */ +export interface AutomationAccountListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the OperationListResult class. + * @constructor + * The response model for the list of Automation operations + * + */ +export interface OperationListResult extends Array { +} + +/** + * @class + * Initializes a new instance of the StatisticsListResult class. + * @constructor + * The response model for the list statistics operation. + * + */ +export interface StatisticsListResult extends Array { +} + +/** + * @class + * Initializes a new instance of the UsageListResult class. + * @constructor + * The response model for the get usage operation. + * + */ +export interface UsageListResult extends Array { +} + +/** + * @class + * Initializes a new instance of the KeyListResult class. + * @constructor + */ +export interface KeyListResult extends Array { +} + +/** + * @class + * Initializes a new instance of the CertificateListResult class. + * @constructor + * The response model for the list certificate operation. + * + * @member {string} [nextLink] Gets or sets the next link. + */ +export interface CertificateListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the ConnectionListResult class. + * @constructor + * The response model for the list connection operation. + * + * @member {string} [nextLink] Gets or sets the next link. + */ +export interface ConnectionListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the ConnectionTypeListResult class. + * @constructor + * The response model for the list connection type operation. + * + * @member {string} [nextLink] Gets or sets the next link. + */ +export interface ConnectionTypeListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the CredentialListResult class. + * @constructor + * The response model for the list credential operation. + * + * @member {string} [nextLink] Gets or sets the next link. + */ +export interface CredentialListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the DscConfigurationListResult class. + * @constructor + * The response model for the list configuration operation. + * + * @member {string} [nextLink] Gets or sets the next link. + */ +export interface DscConfigurationListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the HybridRunbookWorkerGroupsListResult class. + * @constructor + * The response model for the list hybrid runbook worker groups. + * + * @member {string} [nextLink] Gets or sets the next link. + */ +export interface HybridRunbookWorkerGroupsListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the JobScheduleListResult class. + * @constructor + * The response model for the list job schedule operation. + * + * @member {string} [nextLink] Gets or sets the next link. + */ +export interface JobScheduleListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the ActivityListResult class. + * @constructor + * The response model for the list activity operation. + * + * @member {string} [nextLink] Gets or sets the next link. + */ +export interface ActivityListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the ModuleListResult class. + * @constructor + * The response model for the list module operation. + * + * @member {string} [nextLink] Gets or sets the next link. + */ +export interface ModuleListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the TypeFieldListResult class. + * @constructor + * The response model for the list fields operation. + * + */ +export interface TypeFieldListResult extends Array { +} + +/** + * @class + * Initializes a new instance of the RunbookListResult class. + * @constructor + * The response model for the list runbook operation. + * + * @member {string} [nextLink] Gets or sets the next link. + */ +export interface RunbookListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the JobStreamListResult class. + * @constructor + * The response model for the list job stream operation. + * + * @member {string} [nextLink] Gets or sets the next link. + */ +export interface JobStreamListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the ScheduleListResult class. + * @constructor + * The response model for the list schedule operation. + * + * @member {string} [nextLink] Gets or sets the next link. + */ +export interface ScheduleListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the VariableListResult class. + * @constructor + * The response model for the list variables operation. + * + * @member {string} [nextLink] Gets or sets the next link. + */ +export interface VariableListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the WebhookListResult class. + * @constructor + * The response model for the list webhook operation. + * + * @member {string} [nextLink] Gets or sets the next link. + */ +export interface WebhookListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the SourceControlListResult class. + * @constructor + * The response model for the list source controls operation. + * + * @member {string} [nextLink] Gets or sets the next link. + */ +export interface SourceControlListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the SourceControlSyncJobListResult class. + * @constructor + * The response model for the list source control sync jobs operation. + * + * @member {string} [nextLink] Gets or sets the next link. + */ +export interface SourceControlSyncJobListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the JobListResultV2 class. + * @constructor + * The response model for the list job operation. + * + * @member {string} [nextLink] The link to the next page. + */ +export interface JobListResultV2 extends Array { + readonly nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the DscNodeListResult class. + * @constructor + * The response model for the list dsc nodes operation. + * + * @member {string} [nextLink] Gets or sets the next link. + */ +export interface DscNodeListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the DscNodeReportListResult class. + * @constructor + * The response model for the list dsc nodes operation. + * + * @member {string} [nextLink] Gets or sets the next link. + */ +export interface DscNodeReportListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the DscCompilationJobListResult class. + * @constructor + * The response model for the list job operation. + * + * @member {string} [nextLink] Gets or sets the next link. + */ +export interface DscCompilationJobListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the DscNodeConfigurationListResult class. + * @constructor + * The response model for the list job operation. + * + * @member {string} [nextLink] Gets or sets the next link. + */ +export interface DscNodeConfigurationListResult extends Array { + nextLink?: string; +} diff --git a/lib/services/automationManagement/lib/lib/models/index.js b/lib/services/automationManagement/lib/lib/models/index.js new file mode 100644 index 0000000000..30ffdfbf07 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/index.js @@ -0,0 +1,166 @@ +/* + * 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.ErrorResponse = require('./errorResponse'); +exports.Key = require('./key'); +exports.UsageCounterName = require('./usageCounterName'); +exports.Usage = require('./usage'); +exports.Statistics = require('./statistics'); +exports.RunbookAssociationProperty = require('./runbookAssociationProperty'); +exports.Resource = require('./resource'); +exports.ProxyResource = require('./proxyResource'); +exports.Webhook = require('./webhook'); +exports.Variable = require('./variable'); +exports.JobProvisioningStateProperty = require('./jobProvisioningStateProperty'); +exports.DscConfigurationAssociationProperty = require('./dscConfigurationAssociationProperty'); +exports.DscCompilationJob = require('./dscCompilationJob'); +exports.Credential = require('./credential'); +exports.ConnectionTypeAssociationProperty = require('./connectionTypeAssociationProperty'); +exports.Connection = require('./connection'); +exports.Certificate = require('./certificate'); +exports.RunbookParameter = require('./runbookParameter'); +exports.ContentHash = require('./contentHash'); +exports.ContentLink = require('./contentLink'); +exports.RunbookDraft = require('./runbookDraft'); +exports.TrackedResource = require('./trackedResource'); +exports.Runbook = require('./runbook'); +exports.ModuleErrorInfo = require('./moduleErrorInfo'); +exports.Module = require('./module'); +exports.ContentSource = require('./contentSource'); +exports.DscConfigurationParameter = require('./dscConfigurationParameter'); +exports.DscConfiguration = require('./dscConfiguration'); +exports.Sku = require('./sku'); +exports.AutomationAccount = require('./automationAccount'); +exports.OperationDisplay = require('./operationDisplay'); +exports.Operation = require('./operation'); +exports.AutomationAccountCreateOrUpdateParameters = require('./automationAccountCreateOrUpdateParameters'); +exports.AutomationAccountUpdateParameters = require('./automationAccountUpdateParameters'); +exports.CertificateUpdateParameters = require('./certificateUpdateParameters'); +exports.CertificateCreateOrUpdateParameters = require('./certificateCreateOrUpdateParameters'); +exports.ConnectionUpdateParameters = require('./connectionUpdateParameters'); +exports.ConnectionCreateOrUpdateParameters = require('./connectionCreateOrUpdateParameters'); +exports.FieldDefinition = require('./fieldDefinition'); +exports.ConnectionType = require('./connectionType'); +exports.ConnectionTypeCreateOrUpdateParameters = require('./connectionTypeCreateOrUpdateParameters'); +exports.CredentialUpdateParameters = require('./credentialUpdateParameters'); +exports.CredentialCreateOrUpdateParameters = require('./credentialCreateOrUpdateParameters'); +exports.ActivityParameter = require('./activityParameter'); +exports.ActivityParameterSet = require('./activityParameterSet'); +exports.ActivityOutputType = require('./activityOutputType'); +exports.Activity = require('./activity'); +exports.AdvancedScheduleMonthlyOccurrence = require('./advancedScheduleMonthlyOccurrence'); +exports.AdvancedSchedule = require('./advancedSchedule'); +exports.AgentRegistrationKeys = require('./agentRegistrationKeys'); +exports.AgentRegistration = require('./agentRegistration'); +exports.AgentRegistrationRegenerateKeyParameter = require('./agentRegistrationRegenerateKeyParameter'); +exports.DscCompilationJobCreateParameters = require('./dscCompilationJobCreateParameters'); +exports.DscConfigurationCreateOrUpdateParameters = require('./dscConfigurationCreateOrUpdateParameters'); +exports.DscConfigurationUpdateParameters = require('./dscConfigurationUpdateParameters'); +exports.DscMetaConfiguration = require('./dscMetaConfiguration'); +exports.DscNodeConfigurationCreateOrUpdateParameters = require('./dscNodeConfigurationCreateOrUpdateParameters'); +exports.DscNodeConfigurationAssociationProperty = require('./dscNodeConfigurationAssociationProperty'); +exports.DscNodeExtensionHandlerAssociationProperty = require('./dscNodeExtensionHandlerAssociationProperty'); +exports.DscNodeUpdateParametersProperties = require('./dscNodeUpdateParametersProperties'); +exports.DscNodeUpdateParameters = require('./dscNodeUpdateParameters'); +exports.DscReportError = require('./dscReportError'); +exports.DscReportResourceNavigation = require('./dscReportResourceNavigation'); +exports.DscReportResource = require('./dscReportResource'); +exports.DscNodeReport = require('./dscNodeReport'); +exports.HybridRunbookWorker = require('./hybridRunbookWorker'); +exports.RunAsCredentialAssociationProperty = require('./runAsCredentialAssociationProperty'); +exports.HybridRunbookWorkerGroup = require('./hybridRunbookWorkerGroup'); +exports.HybridRunbookWorkerGroupUpdateParameters = require('./hybridRunbookWorkerGroupUpdateParameters'); +exports.Job = require('./job'); +exports.JobCreateParameters = require('./jobCreateParameters'); +exports.JobListResult = require('./jobListResult'); +exports.ScheduleAssociationProperty = require('./scheduleAssociationProperty'); +exports.JobScheduleCreateParameters = require('./jobScheduleCreateParameters'); +exports.JobSchedule = require('./jobSchedule'); +exports.JobStream = require('./jobStream'); +exports.LinkedWorkspace = require('./linkedWorkspace'); +exports.ModuleCreateOrUpdateParameters = require('./moduleCreateOrUpdateParameters'); +exports.ModuleUpdateParameters = require('./moduleUpdateParameters'); +exports.RunbookDraftUndoEditResult = require('./runbookDraftUndoEditResult'); +exports.RunbookCreateOrUpdateParameters = require('./runbookCreateOrUpdateParameters'); +exports.RunbookCreateOrUpdateDraftProperties = require('./runbookCreateOrUpdateDraftProperties'); +exports.RunbookCreateOrUpdateDraftParameters = require('./runbookCreateOrUpdateDraftParameters'); +exports.RunbookUpdateParameters = require('./runbookUpdateParameters'); +exports.ScheduleCreateOrUpdateParameters = require('./scheduleCreateOrUpdateParameters'); +exports.ScheduleProperties = require('./scheduleProperties'); +exports.Schedule = require('./schedule'); +exports.ScheduleUpdateParameters = require('./scheduleUpdateParameters'); +exports.SubResource = require('./subResource'); +exports.TestJobCreateParameters = require('./testJobCreateParameters'); +exports.TestJob = require('./testJob'); +exports.TypeField = require('./typeField'); +exports.VariableCreateOrUpdateParameters = require('./variableCreateOrUpdateParameters'); +exports.VariableUpdateParameters = require('./variableUpdateParameters'); +exports.WebhookCreateOrUpdateParameters = require('./webhookCreateOrUpdateParameters'); +exports.WebhookUpdateParameters = require('./webhookUpdateParameters'); +exports.JobCollectionItem = require('./jobCollectionItem'); +exports.WindowsProperties = require('./windowsProperties'); +exports.LinuxProperties = require('./linuxProperties'); +exports.UpdateConfiguration = require('./updateConfiguration'); +exports.SoftwareUpdateConfiguration = require('./softwareUpdateConfiguration'); +exports.CollectionItemUpdateConfiguration = require('./collectionItemUpdateConfiguration'); +exports.SoftwareUpdateConfigurationCollectionItem = require('./softwareUpdateConfigurationCollectionItem'); +exports.SoftwareUpdateConfigurationListResult = require('./softwareUpdateConfigurationListResult'); +exports.UpdateConfigurationNavigation = require('./updateConfigurationNavigation'); +exports.JobNavigation = require('./jobNavigation'); +exports.SoftwareUpdateConfigurationRun = require('./softwareUpdateConfigurationRun'); +exports.SoftwareUpdateConfigurationRunListResult = require('./softwareUpdateConfigurationRunListResult'); +exports.SoftwareUpdateConfigurationMachineRun = require('./softwareUpdateConfigurationMachineRun'); +exports.SoftwareUpdateConfigurationMachineRunListResult = require('./softwareUpdateConfigurationMachineRunListResult'); +exports.SourceControlCreateOrUpdateParameters = require('./sourceControlCreateOrUpdateParameters'); +exports.SourceControl = require('./sourceControl'); +exports.SourceControlUpdateParameters = require('./sourceControlUpdateParameters'); +exports.SourceControlSyncJob = require('./sourceControlSyncJob'); +exports.SourceControlSyncJobByIdErrors = require('./sourceControlSyncJobByIdErrors'); +exports.SourceControlSyncJobById = require('./sourceControlSyncJobById'); +exports.DscNode = require('./dscNode'); +exports.DscNodeConfiguration = require('./dscNodeConfiguration'); +exports.DscNodeConfigurationCreateOrUpdateParametersProperties = require('./dscNodeConfigurationCreateOrUpdateParametersProperties'); +exports.AutomationAccountListResult = require('./automationAccountListResult'); +exports.OperationListResult = require('./operationListResult'); +exports.StatisticsListResult = require('./statisticsListResult'); +exports.UsageListResult = require('./usageListResult'); +exports.KeyListResult = require('./keyListResult'); +exports.CertificateListResult = require('./certificateListResult'); +exports.ConnectionListResult = require('./connectionListResult'); +exports.ConnectionTypeListResult = require('./connectionTypeListResult'); +exports.CredentialListResult = require('./credentialListResult'); +exports.DscConfigurationListResult = require('./dscConfigurationListResult'); +exports.HybridRunbookWorkerGroupsListResult = require('./hybridRunbookWorkerGroupsListResult'); +exports.JobScheduleListResult = require('./jobScheduleListResult'); +exports.ActivityListResult = require('./activityListResult'); +exports.ModuleListResult = require('./moduleListResult'); +exports.TypeFieldListResult = require('./typeFieldListResult'); +exports.RunbookListResult = require('./runbookListResult'); +exports.JobStreamListResult = require('./jobStreamListResult'); +exports.ScheduleListResult = require('./scheduleListResult'); +exports.VariableListResult = require('./variableListResult'); +exports.WebhookListResult = require('./webhookListResult'); +exports.SourceControlListResult = require('./sourceControlListResult'); +exports.SourceControlSyncJobListResult = require('./sourceControlSyncJobListResult'); +exports.JobListResultV2 = require('./jobListResultV2'); +exports.DscNodeListResult = require('./dscNodeListResult'); +exports.DscNodeReportListResult = require('./dscNodeReportListResult'); +exports.DscCompilationJobListResult = require('./dscCompilationJobListResult'); +exports.DscNodeConfigurationListResult = require('./dscNodeConfigurationListResult'); diff --git a/lib/services/automationManagement/lib/lib/models/job.js b/lib/services/automationManagement/lib/lib/models/job.js new file mode 100644 index 0000000000..b75467cfad --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/job.js @@ -0,0 +1,204 @@ +/* + * 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'); + +/** + * Definition of the job. + * + * @extends models['ProxyResource'] + */ +class Job extends models['ProxyResource'] { + /** + * Create a Job. + * @member {object} [runbook] Gets or sets the runbook. + * @member {string} [runbook.name] Gets or sets the name of the runbook. + * @member {string} [startedBy] Gets or sets the job started by. + * @member {string} [runOn] Gets or sets the runOn which specifies the group + * name where the job is to be executed. + * @member {uuid} [jobId] Gets or sets the id of the job. + * @member {date} [creationTime] Gets or sets the creation time of the job. + * @member {string} [status] Gets or sets the status of the job. Possible + * values include: 'New', 'Activating', 'Running', 'Completed', 'Failed', + * 'Stopped', 'Blocked', 'Suspended', 'Disconnected', 'Suspending', + * 'Stopping', 'Resuming', 'Removing' + * @member {string} [statusDetails] Gets or sets the status details of the + * job. + * @member {date} [startTime] Gets or sets the start time of the job. + * @member {date} [endTime] Gets or sets the end time of the job. + * @member {string} [exception] Gets or sets the exception of the job. + * @member {date} [lastModifiedTime] Gets or sets the last modified time of + * the job. + * @member {date} [lastStatusModifiedTime] Gets or sets the last status + * modified time of the job. + * @member {object} [parameters] Gets or sets the parameters of the job. + * @member {object} [provisioningState] The provisioning state of a resource. + * @member {string} [provisioningState.provisioningState] The provisioning + * state of the resource. Possible values include: 'Failed', 'Succeeded', + * 'Suspended', 'Processing' + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Job + * + * @returns {object} metadata of Job + * + */ + mapper() { + return { + required: false, + serializedName: 'Job', + type: { + name: 'Composite', + className: 'Job', + 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' + } + }, + runbook: { + required: false, + serializedName: 'properties.runbook', + type: { + name: 'Composite', + className: 'RunbookAssociationProperty' + } + }, + startedBy: { + required: false, + serializedName: 'properties.startedBy', + type: { + name: 'String' + } + }, + runOn: { + required: false, + serializedName: 'properties.runOn', + type: { + name: 'String' + } + }, + jobId: { + required: false, + serializedName: 'properties.jobId', + type: { + name: 'String' + } + }, + creationTime: { + required: false, + serializedName: 'properties.creationTime', + type: { + name: 'DateTime' + } + }, + status: { + required: false, + serializedName: 'properties.status', + type: { + name: 'String' + } + }, + statusDetails: { + required: false, + serializedName: 'properties.statusDetails', + type: { + name: 'String' + } + }, + startTime: { + required: false, + serializedName: 'properties.startTime', + type: { + name: 'DateTime' + } + }, + endTime: { + required: false, + serializedName: 'properties.endTime', + type: { + name: 'DateTime' + } + }, + exception: { + required: false, + serializedName: 'properties.exception', + type: { + name: 'String' + } + }, + lastModifiedTime: { + required: false, + serializedName: 'properties.lastModifiedTime', + type: { + name: 'DateTime' + } + }, + lastStatusModifiedTime: { + required: false, + serializedName: 'properties.lastStatusModifiedTime', + type: { + name: 'DateTime' + } + }, + parameters: { + required: false, + serializedName: 'properties.parameters', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'Composite', + className: 'JobProvisioningStateProperty' + } + } + } + } + }; + } +} + +module.exports = Job; diff --git a/lib/services/automationManagement/lib/lib/models/jobCollectionItem.js b/lib/services/automationManagement/lib/lib/models/jobCollectionItem.js new file mode 100644 index 0000000000..cec5e91389 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/jobCollectionItem.js @@ -0,0 +1,153 @@ +/* + * 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'); + +/** + * Job collection item properties. + * + * @extends models['ProxyResource'] + */ +class JobCollectionItem extends models['ProxyResource'] { + /** + * Create a JobCollectionItem. + * @member {object} [runbook] The runbook association. + * @member {string} [runbook.name] Gets or sets the name of the runbook. + * @member {uuid} [jobId] The id of the job. + * @member {date} [creationTime] The creation time of the job. + * @member {string} [status] The status of the job. Possible values include: + * 'New', 'Activating', 'Running', 'Completed', 'Failed', 'Stopped', + * 'Blocked', 'Suspended', 'Disconnected', 'Suspending', 'Stopping', + * 'Resuming', 'Removing' + * @member {date} [startTime] The start time of the job. + * @member {date} [endTime] The end time of the job. + * @member {date} [lastModifiedTime] The last modified time of the job. + * @member {object} [provisioningState] The current provisioning state of the + * job. + * @member {string} [provisioningState.provisioningState] The provisioning + * state of the resource. Possible values include: 'Failed', 'Succeeded', + * 'Suspended', 'Processing' + */ + constructor() { + super(); + } + + /** + * Defines the metadata of JobCollectionItem + * + * @returns {object} metadata of JobCollectionItem + * + */ + mapper() { + return { + required: false, + serializedName: 'JobCollectionItem', + type: { + name: 'Composite', + className: 'JobCollectionItem', + 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' + } + }, + runbook: { + required: false, + readOnly: true, + serializedName: 'properties.runbook', + type: { + name: 'Composite', + className: 'RunbookAssociationProperty' + } + }, + jobId: { + required: false, + readOnly: true, + serializedName: 'properties.jobId', + type: { + name: 'String' + } + }, + creationTime: { + required: false, + readOnly: true, + serializedName: 'properties.creationTime', + type: { + name: 'DateTime' + } + }, + status: { + required: false, + readOnly: true, + serializedName: 'properties.status', + type: { + name: 'String' + } + }, + startTime: { + required: false, + readOnly: true, + serializedName: 'properties.startTime', + type: { + name: 'DateTime' + } + }, + endTime: { + required: false, + readOnly: true, + serializedName: 'properties.endTime', + type: { + name: 'DateTime' + } + }, + lastModifiedTime: { + required: false, + readOnly: true, + serializedName: 'properties.lastModifiedTime', + type: { + name: 'DateTime' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'Composite', + className: 'JobProvisioningStateProperty' + } + } + } + } + }; + } +} + +module.exports = JobCollectionItem; diff --git a/lib/services/automationManagement/lib/lib/models/jobCreateParameters.js b/lib/services/automationManagement/lib/lib/models/jobCreateParameters.js new file mode 100644 index 0000000000..b60f054efd --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/jobCreateParameters.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 parameters supplied to the create job operation. + * + */ +class JobCreateParameters { + /** + * Create a JobCreateParameters. + * @member {object} runbook Gets or sets the runbook. + * @member {string} [runbook.name] Gets or sets the name of the runbook. + * @member {object} [parameters] Gets or sets the parameters of the job. + * @member {string} [runOn] Gets or sets the runOn which specifies the group + * name where the job is to be executed. + */ + constructor() { + } + + /** + * Defines the metadata of JobCreateParameters + * + * @returns {object} metadata of JobCreateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'JobCreateParameters', + type: { + name: 'Composite', + className: 'JobCreateParameters', + modelProperties: { + runbook: { + required: true, + serializedName: 'properties.runbook', + type: { + name: 'Composite', + className: 'RunbookAssociationProperty' + } + }, + parameters: { + required: false, + serializedName: 'properties.parameters', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + runOn: { + required: false, + serializedName: 'properties.runOn', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = JobCreateParameters; diff --git a/lib/services/automationManagement/lib/lib/models/jobListResult.js b/lib/services/automationManagement/lib/lib/models/jobListResult.js new file mode 100644 index 0000000000..227b185fd5 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/jobListResult.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'; + +const models = require('./index'); + +/** + * The response model for the list job operation. + * + */ +class JobListResult { + /** + * Create a JobListResult. + * @member {array} [value] Gets or sets a list of jobs. + * @member {string} [nextLink] Gets or sets the next link. + */ + constructor() { + } + + /** + * Defines the metadata of JobListResult + * + * @returns {object} metadata of JobListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'JobListResult', + type: { + name: 'Composite', + className: 'JobListResult', + modelProperties: { + value: { + required: false, + serializedName: 'value', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'JobElementType', + type: { + name: 'Composite', + className: 'Job' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = JobListResult; diff --git a/lib/services/automationManagement/lib/lib/models/jobListResultV2.js b/lib/services/automationManagement/lib/lib/models/jobListResultV2.js new file mode 100644 index 0000000000..7124a7c22b --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/jobListResultV2.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'; + +/** + * The response model for the list job operation. + */ +class JobListResultV2 extends Array { + /** + * Create a JobListResultV2. + * @member {string} [nextLink] The link to the next page. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of JobListResultV2 + * + * @returns {object} metadata of JobListResultV2 + * + */ + mapper() { + return { + required: false, + serializedName: 'JobListResultV2', + type: { + name: 'Composite', + className: 'JobListResultV2', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'JobCollectionItemElementType', + type: { + name: 'Composite', + className: 'JobCollectionItem' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = JobListResultV2; diff --git a/lib/services/automationManagement/lib/lib/models/jobNavigation.js b/lib/services/automationManagement/lib/lib/models/jobNavigation.js new file mode 100644 index 0000000000..a2aba8b978 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/jobNavigation.js @@ -0,0 +1,54 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Software update configuration machine run job navigation properties. + * + */ +class JobNavigation { + /** + * Create a JobNavigation. + * @member {string} [id] Id of the job associated with the software update + * configuration run + */ + constructor() { + } + + /** + * Defines the metadata of JobNavigation + * + * @returns {object} metadata of JobNavigation + * + */ + mapper() { + return { + required: false, + serializedName: 'jobNavigation', + type: { + name: 'Composite', + className: 'JobNavigation', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = JobNavigation; diff --git a/lib/services/automationManagement/lib/lib/models/jobProvisioningStateProperty.js b/lib/services/automationManagement/lib/lib/models/jobProvisioningStateProperty.js new file mode 100644 index 0000000000..07d50308d4 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/jobProvisioningStateProperty.js @@ -0,0 +1,55 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The provisioning state property. + * + */ +class JobProvisioningStateProperty { + /** + * Create a JobProvisioningStateProperty. + * @member {string} [provisioningState] The provisioning state of the + * resource. Possible values include: 'Failed', 'Succeeded', 'Suspended', + * 'Processing' + */ + constructor() { + } + + /** + * Defines the metadata of JobProvisioningStateProperty + * + * @returns {object} metadata of JobProvisioningStateProperty + * + */ + mapper() { + return { + required: false, + serializedName: 'JobProvisioningStateProperty', + type: { + name: 'Composite', + className: 'JobProvisioningStateProperty', + modelProperties: { + provisioningState: { + required: false, + readOnly: true, + serializedName: 'provisioningState', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = JobProvisioningStateProperty; diff --git a/lib/services/automationManagement/lib/lib/models/jobSchedule.js b/lib/services/automationManagement/lib/lib/models/jobSchedule.js new file mode 100644 index 0000000000..f608fc5495 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/jobSchedule.js @@ -0,0 +1,126 @@ +/* + * 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'); + +/** + * Definition of the job schedule. + * + */ +class JobSchedule { + /** + * Create a JobSchedule. + * @member {string} [id] Gets the id of the resource. + * @member {string} [name] Gets the name of the variable. + * @member {string} [type] Resource type + * @member {string} [jobScheduleId] Gets or sets the id of job schedule. + * @member {object} [schedule] Gets or sets the schedule. + * @member {string} [schedule.name] Gets or sets the name of the schedule. + * @member {object} [runbook] Gets or sets the runbook. + * @member {string} [runbook.name] Gets or sets the name of the runbook. + * @member {string} [runOn] Gets or sets the hybrid worker group that the + * scheduled job should run on. + * @member {object} [parameters] Gets or sets the parameters of the job + * schedule. + */ + constructor() { + } + + /** + * Defines the metadata of JobSchedule + * + * @returns {object} metadata of JobSchedule + * + */ + mapper() { + return { + required: false, + serializedName: 'JobSchedule', + type: { + name: 'Composite', + className: 'JobSchedule', + 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' + } + }, + jobScheduleId: { + required: false, + serializedName: 'properties.jobScheduleId', + type: { + name: 'String' + } + }, + schedule: { + required: false, + serializedName: 'properties.schedule', + type: { + name: 'Composite', + className: 'ScheduleAssociationProperty' + } + }, + runbook: { + required: false, + serializedName: 'properties.runbook', + type: { + name: 'Composite', + className: 'RunbookAssociationProperty' + } + }, + runOn: { + required: false, + serializedName: 'properties.runOn', + type: { + name: 'String' + } + }, + parameters: { + required: false, + serializedName: 'properties.parameters', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = JobSchedule; diff --git a/lib/services/automationManagement/lib/lib/models/jobScheduleCreateParameters.js b/lib/services/automationManagement/lib/lib/models/jobScheduleCreateParameters.js new file mode 100644 index 0000000000..f49878f3f3 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/jobScheduleCreateParameters.js @@ -0,0 +1,90 @@ +/* + * 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 parameters supplied to the create job schedule operation. + * + */ +class JobScheduleCreateParameters { + /** + * Create a JobScheduleCreateParameters. + * @member {object} schedule Gets or sets the schedule. + * @member {string} [schedule.name] Gets or sets the name of the schedule. + * @member {object} runbook Gets or sets the runbook. + * @member {string} [runbook.name] Gets or sets the name of the runbook. + * @member {string} [runOn] Gets or sets the hybrid worker group that the + * scheduled job should run on. + * @member {object} [parameters] Gets or sets a list of job properties. + */ + constructor() { + } + + /** + * Defines the metadata of JobScheduleCreateParameters + * + * @returns {object} metadata of JobScheduleCreateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'JobScheduleCreateParameters', + type: { + name: 'Composite', + className: 'JobScheduleCreateParameters', + modelProperties: { + schedule: { + required: true, + serializedName: 'properties.schedule', + type: { + name: 'Composite', + className: 'ScheduleAssociationProperty' + } + }, + runbook: { + required: true, + serializedName: 'properties.runbook', + type: { + name: 'Composite', + className: 'RunbookAssociationProperty' + } + }, + runOn: { + required: false, + serializedName: 'properties.runOn', + type: { + name: 'String' + } + }, + parameters: { + required: false, + serializedName: 'properties.parameters', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = JobScheduleCreateParameters; diff --git a/lib/services/automationManagement/lib/lib/models/jobScheduleListResult.js b/lib/services/automationManagement/lib/lib/models/jobScheduleListResult.js new file mode 100644 index 0000000000..73ec7a3f69 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/jobScheduleListResult.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'; + +/** + * The response model for the list job schedule operation. + */ +class JobScheduleListResult extends Array { + /** + * Create a JobScheduleListResult. + * @member {string} [nextLink] Gets or sets the next link. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of JobScheduleListResult + * + * @returns {object} metadata of JobScheduleListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'JobScheduleListResult', + type: { + name: 'Composite', + className: 'JobScheduleListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'JobScheduleElementType', + type: { + name: 'Composite', + className: 'JobSchedule' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = JobScheduleListResult; diff --git a/lib/services/automationManagement/lib/lib/models/jobStream.js b/lib/services/automationManagement/lib/lib/models/jobStream.js new file mode 100644 index 0000000000..84fe18c918 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/jobStream.js @@ -0,0 +1,109 @@ +/* + * 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'; + +/** + * Definition of the job stream. + * + */ +class JobStream { + /** + * Create a JobStream. + * @member {string} [id] Gets or sets the id of the resource. + * @member {string} [jobStreamId] Gets or sets the id of the job stream. + * @member {date} [time] Gets or sets the creation time of the job. + * @member {string} [streamType] Gets or sets the stream type. Possible + * values include: 'Progress', 'Output', 'Warning', 'Error', 'Debug', + * 'Verbose', 'Any' + * @member {string} [streamText] Gets or sets the stream text. + * @member {string} [summary] Gets or sets the summary. + * @member {object} [value] Gets or sets the values of the job stream. + */ + constructor() { + } + + /** + * Defines the metadata of JobStream + * + * @returns {object} metadata of JobStream + * + */ + mapper() { + return { + required: false, + serializedName: 'JobStream', + type: { + name: 'Composite', + className: 'JobStream', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + jobStreamId: { + required: false, + serializedName: 'properties.jobStreamId', + type: { + name: 'String' + } + }, + time: { + required: false, + serializedName: 'properties.time', + type: { + name: 'DateTime' + } + }, + streamType: { + required: false, + serializedName: 'properties.streamType', + type: { + name: 'String' + } + }, + streamText: { + required: false, + serializedName: 'properties.streamText', + type: { + name: 'String' + } + }, + summary: { + required: false, + serializedName: 'properties.summary', + type: { + name: 'String' + } + }, + value: { + required: false, + serializedName: 'properties.value', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'ObjectElementType', + type: { + name: 'Object' + } + } + } + } + } + } + }; + } +} + +module.exports = JobStream; diff --git a/lib/services/automationManagement/lib/lib/models/jobStreamListResult.js b/lib/services/automationManagement/lib/lib/models/jobStreamListResult.js new file mode 100644 index 0000000000..c06dda8b0a --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/jobStreamListResult.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'; + +/** + * The response model for the list job stream operation. + */ +class JobStreamListResult extends Array { + /** + * Create a JobStreamListResult. + * @member {string} [nextLink] Gets or sets the next link. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of JobStreamListResult + * + * @returns {object} metadata of JobStreamListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'JobStreamListResult', + type: { + name: 'Composite', + className: 'JobStreamListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'JobStreamElementType', + type: { + name: 'Composite', + className: 'JobStream' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = JobStreamListResult; diff --git a/lib/services/automationManagement/lib/lib/models/key.js b/lib/services/automationManagement/lib/lib/models/key.js new file mode 100644 index 0000000000..95e57f9318 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/key.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'; + +/** + * Automation key which is used to register a DSC Node + * + */ +class Key { + /** + * Create a Key. + * @member {string} [keyName] Automation key name. Possible values include: + * 'primary', 'secondary' + * @member {string} [permissions] Automation key permissions. Possible values + * include: 'Full' + * @member {string} [value] Value of the Automation Key used for + * registration. + */ + constructor() { + } + + /** + * Defines the metadata of Key + * + * @returns {object} metadata of Key + * + */ + mapper() { + return { + required: false, + serializedName: 'Key', + type: { + name: 'Composite', + className: 'Key', + modelProperties: { + keyName: { + required: false, + serializedName: 'keyName', + type: { + name: 'String' + } + }, + permissions: { + required: false, + serializedName: 'permissions', + type: { + name: 'String' + } + }, + value: { + required: false, + serializedName: 'value', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Key; diff --git a/lib/services/automationManagement/lib/lib/models/keyListResult.js b/lib/services/automationManagement/lib/lib/models/keyListResult.js new file mode 100644 index 0000000000..3bacb69713 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/keyListResult.js @@ -0,0 +1,59 @@ +/* + * 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'; + +/** + * Class representing a KeyListResult. + */ +class KeyListResult extends Array { + /** + * Create a KeyListResult. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of KeyListResult + * + * @returns {object} metadata of KeyListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'KeyListResult', + type: { + name: 'Composite', + className: 'KeyListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'KeyElementType', + type: { + name: 'Composite', + className: 'Key' + } + } + } + } + } + } + }; + } +} + +module.exports = KeyListResult; diff --git a/lib/services/automationManagement/lib/lib/models/linkedWorkspace.js b/lib/services/automationManagement/lib/lib/models/linkedWorkspace.js new file mode 100644 index 0000000000..5daf95ac28 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/linkedWorkspace.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'; + +/** + * Definition of the linked workspace. + * + */ +class LinkedWorkspace { + /** + * Create a LinkedWorkspace. + * @member {string} [id] Gets the id of the linked workspace. + */ + constructor() { + } + + /** + * Defines the metadata of LinkedWorkspace + * + * @returns {object} metadata of LinkedWorkspace + * + */ + mapper() { + return { + required: false, + serializedName: 'LinkedWorkspace', + type: { + name: 'Composite', + className: 'LinkedWorkspace', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = LinkedWorkspace; diff --git a/lib/services/automationManagement/lib/lib/models/linuxProperties.js b/lib/services/automationManagement/lib/lib/models/linuxProperties.js new file mode 100644 index 0000000000..3e25b2be22 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/linuxProperties.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'; + +/** + * Linux specific update configuration. + * + */ +class LinuxProperties { + /** + * Create a LinuxProperties. + * @member {string} [includedPackageClassifications] Update classifications + * included in the software update configuration. Possible values include: + * 'Unclassified', 'Critical', 'Security', 'Other' + * @member {array} [excludedPackageNameMasks] packages excluded from the + * software update configuration. + */ + constructor() { + } + + /** + * Defines the metadata of LinuxProperties + * + * @returns {object} metadata of LinuxProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'LinuxProperties', + type: { + name: 'Composite', + className: 'LinuxProperties', + modelProperties: { + includedPackageClassifications: { + required: false, + serializedName: 'includedPackageClassifications', + type: { + name: 'String' + } + }, + excludedPackageNameMasks: { + required: false, + serializedName: 'excludedPackageNameMasks', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = LinuxProperties; diff --git a/lib/services/automationManagement/lib/lib/models/module.js b/lib/services/automationManagement/lib/lib/models/module.js new file mode 100644 index 0000000000..0aab08f1df --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/module.js @@ -0,0 +1,203 @@ +/* + * 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'); + +/** + * Definition of the module type. + * + * @extends models['TrackedResource'] + */ +class Module extends models['TrackedResource'] { + /** + * Create a Module. + * @member {boolean} [isGlobal] Gets or sets the isGlobal flag of the module. + * @member {string} [version] Gets or sets the version of the module. + * @member {number} [sizeInBytes] Gets or sets the size in bytes of the + * module. + * @member {number} [activityCount] Gets or sets the activity count of the + * module. + * @member {string} [provisioningState] Gets or sets the provisioning state + * of the module. Possible values include: 'Created', 'Creating', + * 'StartingImportModuleRunbook', 'RunningImportModuleRunbook', + * 'ContentRetrieved', 'ContentDownloaded', 'ContentValidated', + * 'ConnectionTypeImported', 'ContentStored', 'ModuleDataStored', + * 'ActivitiesStored', 'ModuleImportRunbookComplete', 'Succeeded', 'Failed', + * 'Cancelled', 'Updating' + * @member {object} [contentLink] Gets or sets the contentLink of the module. + * @member {string} [contentLink.uri] Gets or sets the uri of the runbook + * content. + * @member {object} [contentLink.contentHash] Gets or sets the hash. + * @member {string} [contentLink.contentHash.algorithm] Gets or sets the + * content hash algorithm used to hash the content. + * @member {string} [contentLink.contentHash.value] Gets or sets expected + * hash value of the content. + * @member {string} [contentLink.version] Gets or sets the version of the + * content. + * @member {object} [error] Gets or sets the error info of the module. + * @member {string} [error.code] Gets or sets the error code. + * @member {string} [error.message] Gets or sets the error message. + * @member {date} [creationTime] Gets or sets the creation time. + * @member {date} [lastModifiedTime] Gets or sets the last modified time. + * @member {string} [description] Gets or sets the description. + * @member {string} [etag] Gets or sets the etag of the resource. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Module + * + * @returns {object} metadata of Module + * + */ + mapper() { + return { + required: false, + serializedName: 'Module', + type: { + name: 'Composite', + className: 'Module', + 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' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + isGlobal: { + required: false, + serializedName: 'properties.isGlobal', + type: { + name: 'Boolean' + } + }, + version: { + required: false, + serializedName: 'properties.version', + type: { + name: 'String' + } + }, + sizeInBytes: { + required: false, + serializedName: 'properties.sizeInBytes', + type: { + name: 'Number' + } + }, + activityCount: { + required: false, + serializedName: 'properties.activityCount', + type: { + name: 'Number' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'Enum', + allowedValues: [ 'Created', 'Creating', 'StartingImportModuleRunbook', 'RunningImportModuleRunbook', 'ContentRetrieved', 'ContentDownloaded', 'ContentValidated', 'ConnectionTypeImported', 'ContentStored', 'ModuleDataStored', 'ActivitiesStored', 'ModuleImportRunbookComplete', 'Succeeded', 'Failed', 'Cancelled', 'Updating' ] + } + }, + contentLink: { + required: false, + serializedName: 'properties.contentLink', + type: { + name: 'Composite', + className: 'ContentLink' + } + }, + error: { + required: false, + serializedName: 'properties.error', + type: { + name: 'Composite', + className: 'ModuleErrorInfo' + } + }, + creationTime: { + required: false, + serializedName: 'properties.creationTime', + type: { + name: 'DateTime' + } + }, + lastModifiedTime: { + required: false, + serializedName: 'properties.lastModifiedTime', + type: { + name: 'DateTime' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Module; diff --git a/lib/services/automationManagement/lib/lib/models/moduleCreateOrUpdateParameters.js b/lib/services/automationManagement/lib/lib/models/moduleCreateOrUpdateParameters.js new file mode 100644 index 0000000000..0bbb36ad06 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/moduleCreateOrUpdateParameters.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 parameters supplied to the create or update module operation. + * + */ +class ModuleCreateOrUpdateParameters { + /** + * Create a ModuleCreateOrUpdateParameters. + * @member {object} contentLink Gets or sets the module content link. + * @member {string} [contentLink.uri] Gets or sets the uri of the runbook + * content. + * @member {object} [contentLink.contentHash] Gets or sets the hash. + * @member {string} [contentLink.contentHash.algorithm] Gets or sets the + * content hash algorithm used to hash the content. + * @member {string} [contentLink.contentHash.value] Gets or sets expected + * hash value of the content. + * @member {string} [contentLink.version] Gets or sets the version of the + * content. + * @member {string} [name] Gets or sets name of the resource. + * @member {string} [location] Gets or sets the location of the resource. + * @member {object} [tags] Gets or sets the tags attached to the resource. + */ + constructor() { + } + + /** + * Defines the metadata of ModuleCreateOrUpdateParameters + * + * @returns {object} metadata of ModuleCreateOrUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'ModuleCreateOrUpdateParameters', + type: { + name: 'Composite', + className: 'ModuleCreateOrUpdateParameters', + modelProperties: { + contentLink: { + required: true, + serializedName: 'properties.contentLink', + type: { + name: 'Composite', + className: 'ContentLink' + } + }, + name: { + required: false, + serializedName: 'name', + 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 = ModuleCreateOrUpdateParameters; diff --git a/lib/services/automationManagement/lib/lib/models/moduleErrorInfo.js b/lib/services/automationManagement/lib/lib/models/moduleErrorInfo.js new file mode 100644 index 0000000000..ecd1cce50a --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/moduleErrorInfo.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'; + +/** + * Definition of the module error info type. + * + */ +class ModuleErrorInfo { + /** + * Create a ModuleErrorInfo. + * @member {string} [code] Gets or sets the error code. + * @member {string} [message] Gets or sets the error message. + */ + constructor() { + } + + /** + * Defines the metadata of ModuleErrorInfo + * + * @returns {object} metadata of ModuleErrorInfo + * + */ + mapper() { + return { + required: false, + serializedName: 'ModuleErrorInfo', + type: { + name: 'Composite', + className: 'ModuleErrorInfo', + modelProperties: { + code: { + required: false, + serializedName: 'code', + type: { + name: 'String' + } + }, + message: { + required: false, + serializedName: 'message', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ModuleErrorInfo; diff --git a/lib/services/automationManagement/lib/lib/models/moduleListResult.js b/lib/services/automationManagement/lib/lib/models/moduleListResult.js new file mode 100644 index 0000000000..202318930e --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/moduleListResult.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'; + +/** + * The response model for the list module operation. + */ +class ModuleListResult extends Array { + /** + * Create a ModuleListResult. + * @member {string} [nextLink] Gets or sets the next link. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ModuleListResult + * + * @returns {object} metadata of ModuleListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ModuleListResult', + type: { + name: 'Composite', + className: 'ModuleListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ModuleElementType', + type: { + name: 'Composite', + className: 'Module' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ModuleListResult; diff --git a/lib/services/automationManagement/lib/lib/models/moduleUpdateParameters.js b/lib/services/automationManagement/lib/lib/models/moduleUpdateParameters.js new file mode 100644 index 0000000000..c000345d7b --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/moduleUpdateParameters.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 parameters supplied to the update module operation. + * + */ +class ModuleUpdateParameters { + /** + * Create a ModuleUpdateParameters. + * @member {object} [contentLink] Gets or sets the module content link. + * @member {string} [contentLink.uri] Gets or sets the uri of the runbook + * content. + * @member {object} [contentLink.contentHash] Gets or sets the hash. + * @member {string} [contentLink.contentHash.algorithm] Gets or sets the + * content hash algorithm used to hash the content. + * @member {string} [contentLink.contentHash.value] Gets or sets expected + * hash value of the content. + * @member {string} [contentLink.version] Gets or sets the version of the + * content. + * @member {string} [name] Gets or sets name of the resource. + * @member {string} [location] Gets or sets the location of the resource. + * @member {object} [tags] Gets or sets the tags attached to the resource. + */ + constructor() { + } + + /** + * Defines the metadata of ModuleUpdateParameters + * + * @returns {object} metadata of ModuleUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'ModuleUpdateParameters', + type: { + name: 'Composite', + className: 'ModuleUpdateParameters', + modelProperties: { + contentLink: { + required: false, + serializedName: 'properties.contentLink', + type: { + name: 'Composite', + className: 'ContentLink' + } + }, + name: { + required: false, + serializedName: 'name', + 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 = ModuleUpdateParameters; diff --git a/lib/services/automationManagement/lib/lib/models/operation.js b/lib/services/automationManagement/lib/lib/models/operation.js new file mode 100644 index 0000000000..df47dab5dd --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/operation.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'; + +const models = require('./index'); + +/** + * Automation REST API operation + * + */ +class Operation { + /** + * Create a Operation. + * @member {string} [name] Operation name: {provider}/{resource}/{operation} + * @member {object} [display] Provider, Resource and Operation values + * @member {string} [display.provider] Service provider: Microsoft.Automation + * @member {string} [display.resource] Resource on which the operation is + * performed: Runbooks, Jobs etc. + * @member {string} [display.operation] Operation type: Read, write, delete, + * etc. + */ + constructor() { + } + + /** + * Defines the metadata of Operation + * + * @returns {object} metadata of Operation + * + */ + mapper() { + return { + required: false, + serializedName: 'Operation', + type: { + name: 'Composite', + className: 'Operation', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + display: { + required: false, + serializedName: 'display', + type: { + name: 'Composite', + className: 'OperationDisplay' + } + } + } + } + }; + } +} + +module.exports = Operation; diff --git a/lib/services/automationManagement/lib/lib/models/operationDisplay.js b/lib/services/automationManagement/lib/lib/models/operationDisplay.js new file mode 100644 index 0000000000..b8cb508cff --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/operationDisplay.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'; + +/** + * Provider, Resource and Operation values + * + */ +class OperationDisplay { + /** + * Create a OperationDisplay. + * @member {string} [provider] Service provider: Microsoft.Automation + * @member {string} [resource] Resource on which the operation is performed: + * Runbooks, Jobs etc. + * @member {string} [operation] Operation type: Read, write, delete, etc. + */ + constructor() { + } + + /** + * Defines the metadata of OperationDisplay + * + * @returns {object} metadata of OperationDisplay + * + */ + mapper() { + return { + required: false, + serializedName: 'Operation_display', + type: { + name: 'Composite', + className: 'OperationDisplay', + 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' + } + } + } + } + }; + } +} + +module.exports = OperationDisplay; diff --git a/lib/services/automationManagement/lib/lib/models/operationListResult.js b/lib/services/automationManagement/lib/lib/models/operationListResult.js new file mode 100644 index 0000000000..a41ebf4454 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/operationListResult.js @@ -0,0 +1,59 @@ +/* + * 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 response model for the list of Automation operations + */ +class OperationListResult extends Array { + /** + * Create a OperationListResult. + */ + 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: 'OperationElementType', + type: { + name: 'Composite', + className: 'Operation' + } + } + } + } + } + } + }; + } +} + +module.exports = OperationListResult; diff --git a/lib/services/automationManagement/lib/lib/models/proxyResource.js b/lib/services/automationManagement/lib/lib/models/proxyResource.js new file mode 100644 index 0000000000..43e93ec60e --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/proxyResource.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'); + +/** + * The resource model definition for a ARM 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' + } + } + } + } + }; + } +} + +module.exports = ProxyResource; diff --git a/lib/services/automationManagement/lib/lib/models/resource.js b/lib/services/automationManagement/lib/lib/models/resource.js new file mode 100644 index 0000000000..019725b84e --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/resource.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'; + +const models = require('./index'); + +/** + * The core properties of ARM resources + * + * @extends models['BaseResource'] + */ +class Resource extends models['BaseResource'] { + /** + * Create a Resource. + * @member {string} [id] Fully qualified resource Id for the resource + * @member {string} [name] The name of the resource + * @member {string} [type] The type of the resource. + */ + 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' + } + } + } + } + }; + } +} + +module.exports = Resource; diff --git a/lib/services/automationManagement/lib/lib/models/runAsCredentialAssociationProperty.js b/lib/services/automationManagement/lib/lib/models/runAsCredentialAssociationProperty.js new file mode 100644 index 0000000000..f1ffdce024 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/runAsCredentialAssociationProperty.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'; + +/** + * Definition of runas credential to use for hybrid worker. + * + */ +class RunAsCredentialAssociationProperty { + /** + * Create a RunAsCredentialAssociationProperty. + * @member {string} [name] Gets or sets the name of the credential. + */ + constructor() { + } + + /** + * Defines the metadata of RunAsCredentialAssociationProperty + * + * @returns {object} metadata of RunAsCredentialAssociationProperty + * + */ + mapper() { + return { + required: false, + serializedName: 'RunAsCredentialAssociationProperty', + type: { + name: 'Composite', + className: 'RunAsCredentialAssociationProperty', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = RunAsCredentialAssociationProperty; diff --git a/lib/services/automationManagement/lib/lib/models/runbook.js b/lib/services/automationManagement/lib/lib/models/runbook.js new file mode 100644 index 0000000000..234b38d12d --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/runbook.js @@ -0,0 +1,275 @@ +/* + * 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'); + +/** + * Definition of the runbook type. + * + * @extends models['TrackedResource'] + */ +class Runbook extends models['TrackedResource'] { + /** + * Create a Runbook. + * @member {string} [runbookType] Gets or sets the type of the runbook. + * Possible values include: 'Script', 'Graph', 'PowerShellWorkflow', + * 'PowerShell', 'GraphPowerShellWorkflow', 'GraphPowerShell' + * @member {object} [publishContentLink] Gets or sets the published runbook + * content link. + * @member {string} [publishContentLink.uri] Gets or sets the uri of the + * runbook content. + * @member {object} [publishContentLink.contentHash] Gets or sets the hash. + * @member {string} [publishContentLink.contentHash.algorithm] Gets or sets + * the content hash algorithm used to hash the content. + * @member {string} [publishContentLink.contentHash.value] Gets or sets + * expected hash value of the content. + * @member {string} [publishContentLink.version] Gets or sets the version of + * the content. + * @member {string} [state] Gets or sets the state of the runbook. Possible + * values include: 'New', 'Edit', 'Published' + * @member {boolean} [logVerbose] Gets or sets verbose log option. + * @member {boolean} [logProgress] Gets or sets progress log option. + * @member {number} [logActivityTrace] Gets or sets the option to log + * activity trace of the runbook. + * @member {number} [jobCount] Gets or sets the job count of the runbook. + * @member {object} [parameters] Gets or sets the runbook parameters. + * @member {array} [outputTypes] Gets or sets the runbook output types. + * @member {object} [draft] Gets or sets the draft runbook properties. + * @member {boolean} [draft.inEdit] Gets or sets whether runbook is in edit + * mode. + * @member {object} [draft.draftContentLink] Gets or sets the draft runbook + * content link. + * @member {string} [draft.draftContentLink.uri] Gets or sets the uri of the + * runbook content. + * @member {object} [draft.draftContentLink.contentHash] Gets or sets the + * hash. + * @member {string} [draft.draftContentLink.contentHash.algorithm] Gets or + * sets the content hash algorithm used to hash the content. + * @member {string} [draft.draftContentLink.contentHash.value] Gets or sets + * expected hash value of the content. + * @member {string} [draft.draftContentLink.version] Gets or sets the version + * of the content. + * @member {date} [draft.creationTime] Gets or sets the creation time of the + * runbook draft. + * @member {date} [draft.lastModifiedTime] Gets or sets the last modified + * time of the runbook draft. + * @member {object} [draft.parameters] Gets or sets the runbook draft + * parameters. + * @member {array} [draft.outputTypes] Gets or sets the runbook output types. + * @member {string} [provisioningState] Gets or sets the provisioning state + * of the runbook. Possible values include: 'Succeeded' + * @member {string} [lastModifiedBy] Gets or sets the last modified by. + * @member {date} [creationTime] Gets or sets the creation time. + * @member {date} [lastModifiedTime] Gets or sets the last modified time. + * @member {string} [description] Gets or sets the description. + * @member {string} [etag] Gets or sets the etag of the resource. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Runbook + * + * @returns {object} metadata of Runbook + * + */ + mapper() { + return { + required: false, + serializedName: 'Runbook', + type: { + name: 'Composite', + className: 'Runbook', + 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' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + runbookType: { + required: false, + serializedName: 'properties.runbookType', + type: { + name: 'String' + } + }, + publishContentLink: { + required: false, + serializedName: 'properties.publishContentLink', + type: { + name: 'Composite', + className: 'ContentLink' + } + }, + state: { + required: false, + serializedName: 'properties.state', + type: { + name: 'String' + } + }, + logVerbose: { + required: false, + serializedName: 'properties.logVerbose', + type: { + name: 'Boolean' + } + }, + logProgress: { + required: false, + serializedName: 'properties.logProgress', + type: { + name: 'Boolean' + } + }, + logActivityTrace: { + required: false, + serializedName: 'properties.logActivityTrace', + type: { + name: 'Number' + } + }, + jobCount: { + required: false, + serializedName: 'properties.jobCount', + type: { + name: 'Number' + } + }, + parameters: { + required: false, + serializedName: 'properties.parameters', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'RunbookParameterElementType', + type: { + name: 'Composite', + className: 'RunbookParameter' + } + } + } + }, + outputTypes: { + required: false, + serializedName: 'properties.outputTypes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + draft: { + required: false, + serializedName: 'properties.draft', + type: { + name: 'Composite', + className: 'RunbookDraft' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'Enum', + allowedValues: [ 'Succeeded' ] + } + }, + lastModifiedBy: { + required: false, + serializedName: 'properties.lastModifiedBy', + type: { + name: 'String' + } + }, + creationTime: { + required: false, + serializedName: 'properties.creationTime', + type: { + name: 'DateTime' + } + }, + lastModifiedTime: { + required: false, + serializedName: 'properties.lastModifiedTime', + type: { + name: 'DateTime' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Runbook; diff --git a/lib/services/automationManagement/lib/lib/models/runbookAssociationProperty.js b/lib/services/automationManagement/lib/lib/models/runbookAssociationProperty.js new file mode 100644 index 0000000000..dbfdade41b --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/runbookAssociationProperty.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 runbook property associated with the entity. + * + */ +class RunbookAssociationProperty { + /** + * Create a RunbookAssociationProperty. + * @member {string} [name] Gets or sets the name of the runbook. + */ + constructor() { + } + + /** + * Defines the metadata of RunbookAssociationProperty + * + * @returns {object} metadata of RunbookAssociationProperty + * + */ + mapper() { + return { + required: false, + serializedName: 'RunbookAssociationProperty', + type: { + name: 'Composite', + className: 'RunbookAssociationProperty', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = RunbookAssociationProperty; diff --git a/lib/services/automationManagement/lib/lib/models/runbookCreateOrUpdateDraftParameters.js b/lib/services/automationManagement/lib/lib/models/runbookCreateOrUpdateDraftParameters.js new file mode 100644 index 0000000000..be40526616 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/runbookCreateOrUpdateDraftParameters.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 parameters supplied to the create or update runbook operation. + * + */ +class RunbookCreateOrUpdateDraftParameters { + /** + * Create a RunbookCreateOrUpdateDraftParameters. + * @member {string} runbookContent Content of the Runbook. + */ + constructor() { + } + + /** + * Defines the metadata of RunbookCreateOrUpdateDraftParameters + * + * @returns {object} metadata of RunbookCreateOrUpdateDraftParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'RunbookCreateOrUpdateDraftParameters', + type: { + name: 'Composite', + className: 'RunbookCreateOrUpdateDraftParameters', + modelProperties: { + runbookContent: { + required: true, + serializedName: 'runbookContent', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = RunbookCreateOrUpdateDraftParameters; diff --git a/lib/services/automationManagement/lib/lib/models/runbookCreateOrUpdateDraftProperties.js b/lib/services/automationManagement/lib/lib/models/runbookCreateOrUpdateDraftProperties.js new file mode 100644 index 0000000000..3b1704a807 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/runbookCreateOrUpdateDraftProperties.js @@ -0,0 +1,120 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The parameters supplied to the create or update dratft runbook properties. + * + */ +class RunbookCreateOrUpdateDraftProperties { + /** + * Create a RunbookCreateOrUpdateDraftProperties. + * @member {boolean} [logVerbose] Gets or sets verbose log option. + * @member {boolean} [logProgress] Gets or sets progress log option. + * @member {string} runbookType Gets or sets the type of the runbook. + * Possible values include: 'Script', 'Graph', 'PowerShellWorkflow', + * 'PowerShell', 'GraphPowerShellWorkflow', 'GraphPowerShell' + * @member {object} draft Gets or sets the draft runbook properties. + * @member {boolean} [draft.inEdit] Gets or sets whether runbook is in edit + * mode. + * @member {object} [draft.draftContentLink] Gets or sets the draft runbook + * content link. + * @member {string} [draft.draftContentLink.uri] Gets or sets the uri of the + * runbook content. + * @member {object} [draft.draftContentLink.contentHash] Gets or sets the + * hash. + * @member {string} [draft.draftContentLink.contentHash.algorithm] Gets or + * sets the content hash algorithm used to hash the content. + * @member {string} [draft.draftContentLink.contentHash.value] Gets or sets + * expected hash value of the content. + * @member {string} [draft.draftContentLink.version] Gets or sets the version + * of the content. + * @member {date} [draft.creationTime] Gets or sets the creation time of the + * runbook draft. + * @member {date} [draft.lastModifiedTime] Gets or sets the last modified + * time of the runbook draft. + * @member {object} [draft.parameters] Gets or sets the runbook draft + * parameters. + * @member {array} [draft.outputTypes] Gets or sets the runbook output types. + * @member {string} [description] Gets or sets the description of the + * runbook. + * @member {number} [logActivityTrace] Gets or sets the activity-level + * tracing options of the runbook. + */ + constructor() { + } + + /** + * Defines the metadata of RunbookCreateOrUpdateDraftProperties + * + * @returns {object} metadata of RunbookCreateOrUpdateDraftProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'RunbookCreateOrUpdateDraftProperties', + type: { + name: 'Composite', + className: 'RunbookCreateOrUpdateDraftProperties', + modelProperties: { + logVerbose: { + required: false, + serializedName: 'logVerbose', + type: { + name: 'Boolean' + } + }, + logProgress: { + required: false, + serializedName: 'logProgress', + type: { + name: 'Boolean' + } + }, + runbookType: { + required: true, + serializedName: 'runbookType', + type: { + name: 'String' + } + }, + draft: { + required: true, + serializedName: 'draft', + type: { + name: 'Composite', + className: 'RunbookDraft' + } + }, + description: { + required: false, + serializedName: 'description', + type: { + name: 'String' + } + }, + logActivityTrace: { + required: false, + serializedName: 'logActivityTrace', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = RunbookCreateOrUpdateDraftProperties; diff --git a/lib/services/automationManagement/lib/lib/models/runbookCreateOrUpdateParameters.js b/lib/services/automationManagement/lib/lib/models/runbookCreateOrUpdateParameters.js new file mode 100644 index 0000000000..ee3850caf1 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/runbookCreateOrUpdateParameters.js @@ -0,0 +1,170 @@ +/* + * 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 parameters supplied to the create or update runbook operation. + * + */ +class RunbookCreateOrUpdateParameters { + /** + * Create a RunbookCreateOrUpdateParameters. + * @member {boolean} [logVerbose] Gets or sets verbose log option. + * @member {boolean} [logProgress] Gets or sets progress log option. + * @member {string} runbookType Gets or sets the type of the runbook. + * Possible values include: 'Script', 'Graph', 'PowerShellWorkflow', + * 'PowerShell', 'GraphPowerShellWorkflow', 'GraphPowerShell' + * @member {object} [draft] Gets or sets the draft runbook properties. + * @member {boolean} [draft.inEdit] Gets or sets whether runbook is in edit + * mode. + * @member {object} [draft.draftContentLink] Gets or sets the draft runbook + * content link. + * @member {string} [draft.draftContentLink.uri] Gets or sets the uri of the + * runbook content. + * @member {object} [draft.draftContentLink.contentHash] Gets or sets the + * hash. + * @member {string} [draft.draftContentLink.contentHash.algorithm] Gets or + * sets the content hash algorithm used to hash the content. + * @member {string} [draft.draftContentLink.contentHash.value] Gets or sets + * expected hash value of the content. + * @member {string} [draft.draftContentLink.version] Gets or sets the version + * of the content. + * @member {date} [draft.creationTime] Gets or sets the creation time of the + * runbook draft. + * @member {date} [draft.lastModifiedTime] Gets or sets the last modified + * time of the runbook draft. + * @member {object} [draft.parameters] Gets or sets the runbook draft + * parameters. + * @member {array} [draft.outputTypes] Gets or sets the runbook output types. + * @member {object} [publishContentLink] Gets or sets the published runbook + * content link. + * @member {string} [publishContentLink.uri] Gets or sets the uri of the + * runbook content. + * @member {object} [publishContentLink.contentHash] Gets or sets the hash. + * @member {string} [publishContentLink.contentHash.algorithm] Gets or sets + * the content hash algorithm used to hash the content. + * @member {string} [publishContentLink.contentHash.value] Gets or sets + * expected hash value of the content. + * @member {string} [publishContentLink.version] Gets or sets the version of + * the content. + * @member {string} [description] Gets or sets the description of the + * runbook. + * @member {number} [logActivityTrace] Gets or sets the activity-level + * tracing options of the runbook. + * @member {string} [name] Gets or sets the name of the resource. + * @member {string} [location] Gets or sets the location of the resource. + * @member {object} [tags] Gets or sets the tags attached to the resource. + */ + constructor() { + } + + /** + * Defines the metadata of RunbookCreateOrUpdateParameters + * + * @returns {object} metadata of RunbookCreateOrUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'RunbookCreateOrUpdateParameters', + type: { + name: 'Composite', + className: 'RunbookCreateOrUpdateParameters', + modelProperties: { + logVerbose: { + required: false, + serializedName: 'properties.logVerbose', + type: { + name: 'Boolean' + } + }, + logProgress: { + required: false, + serializedName: 'properties.logProgress', + type: { + name: 'Boolean' + } + }, + runbookType: { + required: true, + serializedName: 'properties.runbookType', + type: { + name: 'String' + } + }, + draft: { + required: false, + serializedName: 'properties.draft', + type: { + name: 'Composite', + className: 'RunbookDraft' + } + }, + publishContentLink: { + required: false, + serializedName: 'properties.publishContentLink', + type: { + name: 'Composite', + className: 'ContentLink' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + logActivityTrace: { + required: false, + serializedName: 'properties.logActivityTrace', + type: { + name: 'Number' + } + }, + name: { + required: false, + serializedName: 'name', + 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 = RunbookCreateOrUpdateParameters; diff --git a/lib/services/automationManagement/lib/lib/models/runbookDraft.js b/lib/services/automationManagement/lib/lib/models/runbookDraft.js new file mode 100644 index 0000000000..06c864d39d --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/runbookDraft.js @@ -0,0 +1,122 @@ +/* + * 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'); + +/** + * Definition of the runbook type. + * + */ +class RunbookDraft { + /** + * Create a RunbookDraft. + * @member {boolean} [inEdit] Gets or sets whether runbook is in edit mode. + * @member {object} [draftContentLink] Gets or sets the draft runbook content + * link. + * @member {string} [draftContentLink.uri] Gets or sets the uri of the + * runbook content. + * @member {object} [draftContentLink.contentHash] Gets or sets the hash. + * @member {string} [draftContentLink.contentHash.algorithm] Gets or sets the + * content hash algorithm used to hash the content. + * @member {string} [draftContentLink.contentHash.value] Gets or sets + * expected hash value of the content. + * @member {string} [draftContentLink.version] Gets or sets the version of + * the content. + * @member {date} [creationTime] Gets or sets the creation time of the + * runbook draft. + * @member {date} [lastModifiedTime] Gets or sets the last modified time of + * the runbook draft. + * @member {object} [parameters] Gets or sets the runbook draft parameters. + * @member {array} [outputTypes] Gets or sets the runbook output types. + */ + constructor() { + } + + /** + * Defines the metadata of RunbookDraft + * + * @returns {object} metadata of RunbookDraft + * + */ + mapper() { + return { + required: false, + serializedName: 'RunbookDraft', + type: { + name: 'Composite', + className: 'RunbookDraft', + modelProperties: { + inEdit: { + required: false, + serializedName: 'inEdit', + type: { + name: 'Boolean' + } + }, + draftContentLink: { + required: false, + serializedName: 'draftContentLink', + type: { + name: 'Composite', + className: 'ContentLink' + } + }, + creationTime: { + required: false, + serializedName: 'creationTime', + type: { + name: 'DateTime' + } + }, + lastModifiedTime: { + required: false, + serializedName: 'lastModifiedTime', + type: { + name: 'DateTime' + } + }, + parameters: { + required: false, + serializedName: 'parameters', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'RunbookParameterElementType', + type: { + name: 'Composite', + className: 'RunbookParameter' + } + } + } + }, + outputTypes: { + required: false, + serializedName: 'outputTypes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = RunbookDraft; diff --git a/lib/services/automationManagement/lib/lib/models/runbookDraftUndoEditResult.js b/lib/services/automationManagement/lib/lib/models/runbookDraftUndoEditResult.js new file mode 100644 index 0000000000..cbe9a71fb3 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/runbookDraftUndoEditResult.js @@ -0,0 +1,74 @@ +/* + * 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 response model for the undoedit runbook operation. + * + */ +class RunbookDraftUndoEditResult { + /** + * Create a RunbookDraftUndoEditResult. + * @member {string} [statusCode] Possible values include: 'Continue', + * 'SwitchingProtocols', 'OK', 'Created', 'Accepted', + * 'NonAuthoritativeInformation', 'NoContent', 'ResetContent', + * 'PartialContent', 'MultipleChoices', 'Ambiguous', 'MovedPermanently', + * 'Moved', 'Found', 'Redirect', 'SeeOther', 'RedirectMethod', 'NotModified', + * 'UseProxy', 'Unused', 'TemporaryRedirect', 'RedirectKeepVerb', + * 'BadRequest', 'Unauthorized', 'PaymentRequired', 'Forbidden', 'NotFound', + * 'MethodNotAllowed', 'NotAcceptable', 'ProxyAuthenticationRequired', + * 'RequestTimeout', 'Conflict', 'Gone', 'LengthRequired', + * 'PreconditionFailed', 'RequestEntityTooLarge', 'RequestUriTooLong', + * 'UnsupportedMediaType', 'RequestedRangeNotSatisfiable', + * 'ExpectationFailed', 'UpgradeRequired', 'InternalServerError', + * 'NotImplemented', 'BadGateway', 'ServiceUnavailable', 'GatewayTimeout', + * 'HttpVersionNotSupported' + * @member {string} [requestId] + */ + constructor() { + } + + /** + * Defines the metadata of RunbookDraftUndoEditResult + * + * @returns {object} metadata of RunbookDraftUndoEditResult + * + */ + mapper() { + return { + required: false, + serializedName: 'RunbookDraftUndoEditResult', + type: { + name: 'Composite', + className: 'RunbookDraftUndoEditResult', + modelProperties: { + statusCode: { + required: false, + serializedName: 'statusCode', + type: { + name: 'Enum', + allowedValues: [ 'Continue', 'SwitchingProtocols', 'OK', 'Created', 'Accepted', 'NonAuthoritativeInformation', 'NoContent', 'ResetContent', 'PartialContent', 'MultipleChoices', 'Ambiguous', 'MovedPermanently', 'Moved', 'Found', 'Redirect', 'SeeOther', 'RedirectMethod', 'NotModified', 'UseProxy', 'Unused', 'TemporaryRedirect', 'RedirectKeepVerb', 'BadRequest', 'Unauthorized', 'PaymentRequired', 'Forbidden', 'NotFound', 'MethodNotAllowed', 'NotAcceptable', 'ProxyAuthenticationRequired', 'RequestTimeout', 'Conflict', 'Gone', 'LengthRequired', 'PreconditionFailed', 'RequestEntityTooLarge', 'RequestUriTooLong', 'UnsupportedMediaType', 'RequestedRangeNotSatisfiable', 'ExpectationFailed', 'UpgradeRequired', 'InternalServerError', 'NotImplemented', 'BadGateway', 'ServiceUnavailable', 'GatewayTimeout', 'HttpVersionNotSupported' ] + } + }, + requestId: { + required: false, + serializedName: 'requestId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = RunbookDraftUndoEditResult; diff --git a/lib/services/automationManagement/lib/lib/models/runbookListResult.js b/lib/services/automationManagement/lib/lib/models/runbookListResult.js new file mode 100644 index 0000000000..e207b90ef5 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/runbookListResult.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'; + +/** + * The response model for the list runbook operation. + */ +class RunbookListResult extends Array { + /** + * Create a RunbookListResult. + * @member {string} [nextLink] Gets or sets the next link. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of RunbookListResult + * + * @returns {object} metadata of RunbookListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'RunbookListResult', + type: { + name: 'Composite', + className: 'RunbookListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'RunbookElementType', + type: { + name: 'Composite', + className: 'Runbook' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = RunbookListResult; diff --git a/lib/services/automationManagement/lib/lib/models/runbookParameter.js b/lib/services/automationManagement/lib/lib/models/runbookParameter.js new file mode 100644 index 0000000000..8ff078647b --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/runbookParameter.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'; + +/** + * Definition of the runbook parameter type. + * + */ +class RunbookParameter { + /** + * Create a RunbookParameter. + * @member {string} [type] Gets or sets the type of the parameter. + * @member {boolean} [isMandatory] Gets or sets a Boolean value to indicate + * whether the parameter is madatory or not. + * @member {number} [position] Get or sets the position of the parameter. + * @member {string} [defaultValue] Gets or sets the default value of + * parameter. + */ + constructor() { + } + + /** + * Defines the metadata of RunbookParameter + * + * @returns {object} metadata of RunbookParameter + * + */ + mapper() { + return { + required: false, + serializedName: 'RunbookParameter', + type: { + name: 'Composite', + className: 'RunbookParameter', + modelProperties: { + type: { + required: false, + serializedName: 'type', + type: { + name: 'String' + } + }, + isMandatory: { + required: false, + serializedName: 'isMandatory', + type: { + name: 'Boolean' + } + }, + position: { + required: false, + serializedName: 'position', + type: { + name: 'Number' + } + }, + defaultValue: { + required: false, + serializedName: 'defaultValue', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = RunbookParameter; diff --git a/lib/services/automationManagement/lib/lib/models/runbookUpdateParameters.js b/lib/services/automationManagement/lib/lib/models/runbookUpdateParameters.js new file mode 100644 index 0000000000..e64d986616 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/runbookUpdateParameters.js @@ -0,0 +1,109 @@ +/* + * 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 parameters supplied to the update runbook operation. + * + */ +class RunbookUpdateParameters { + /** + * Create a RunbookUpdateParameters. + * @member {string} [description] Gets or sets the description of the + * runbook. + * @member {boolean} [logVerbose] Gets or sets verbose log option. + * @member {boolean} [logProgress] Gets or sets progress log option. + * @member {number} [logActivityTrace] Gets or sets the activity-level + * tracing options of the runbook. + * @member {string} [name] Gets or sets the name of the resource. + * @member {string} [location] Gets or sets the location of the resource. + * @member {object} [tags] Gets or sets the tags attached to the resource. + */ + constructor() { + } + + /** + * Defines the metadata of RunbookUpdateParameters + * + * @returns {object} metadata of RunbookUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'RunbookUpdateParameters', + type: { + name: 'Composite', + className: 'RunbookUpdateParameters', + modelProperties: { + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + logVerbose: { + required: false, + serializedName: 'properties.logVerbose', + type: { + name: 'Boolean' + } + }, + logProgress: { + required: false, + serializedName: 'properties.logProgress', + type: { + name: 'Boolean' + } + }, + logActivityTrace: { + required: false, + serializedName: 'properties.logActivityTrace', + type: { + name: 'Number' + } + }, + name: { + required: false, + serializedName: 'name', + 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 = RunbookUpdateParameters; diff --git a/lib/services/automationManagement/lib/lib/models/schedule.js b/lib/services/automationManagement/lib/lib/models/schedule.js new file mode 100644 index 0000000000..37dbafbc93 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/schedule.js @@ -0,0 +1,199 @@ +/* + * 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'); + +/** + * Definition of the schedule. + * + */ +class Schedule { + /** + * Create a Schedule. + * @member {string} [id] Gets the id of the resource. + * @member {string} [name] Gets name of the schedule. + * @member {string} [type] Resource type + * @member {date} [startTime] Gets or sets the start time of the schedule. + * @member {number} [startTimeOffsetMinutes] Gets the start time's offset in + * minutes. + * @member {date} [expiryTime] Gets or sets the end time of the schedule. + * @member {number} [expiryTimeOffsetMinutes] Gets or sets the expiry time's + * offset in minutes. + * @member {boolean} [isEnabled] Gets or sets a value indicating whether this + * schedule is enabled. Default value: false . + * @member {date} [nextRun] Gets or sets the next run time of the schedule. + * @member {number} [nextRunOffsetMinutes] Gets or sets the next run time's + * offset in minutes. + * @member {number} [interval] Gets or sets the interval of the schedule. + * @member {string} [frequency] Gets or sets the frequency of the schedule. + * Possible values include: 'OneTime', 'Day', 'Hour', 'Week', 'Month' + * @member {string} [timeZone] Gets or sets the time zone of the schedule. + * @member {object} [advancedSchedule] Gets or sets the advanced schedule. + * @member {array} [advancedSchedule.weekDays] Days of the week that the job + * should execute on. + * @member {array} [advancedSchedule.monthDays] Days of the month that the + * job should execute on. Must be between 1 and 31. + * @member {array} [advancedSchedule.monthlyOccurrences] Occurrences of days + * within a month. + * @member {date} [creationTime] Gets or sets the creation time. + * @member {date} [lastModifiedTime] Gets or sets the last modified time. + * @member {string} [description] Gets or sets the description. + */ + constructor() { + } + + /** + * Defines the metadata of Schedule + * + * @returns {object} metadata of Schedule + * + */ + mapper() { + return { + required: false, + serializedName: 'Schedule', + type: { + name: 'Composite', + className: 'Schedule', + 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' + } + }, + startTime: { + required: false, + serializedName: 'properties.startTime', + type: { + name: 'DateTime' + } + }, + startTimeOffsetMinutes: { + required: false, + readOnly: true, + serializedName: 'properties.startTimeOffsetMinutes', + type: { + name: 'Number' + } + }, + expiryTime: { + required: false, + serializedName: 'properties.expiryTime', + type: { + name: 'DateTime' + } + }, + expiryTimeOffsetMinutes: { + required: false, + serializedName: 'properties.expiryTimeOffsetMinutes', + type: { + name: 'Number' + } + }, + isEnabled: { + required: false, + serializedName: 'properties.isEnabled', + defaultValue: false, + type: { + name: 'Boolean' + } + }, + nextRun: { + required: false, + serializedName: 'properties.nextRun', + type: { + name: 'DateTime' + } + }, + nextRunOffsetMinutes: { + required: false, + serializedName: 'properties.nextRunOffsetMinutes', + type: { + name: 'Number' + } + }, + interval: { + required: false, + serializedName: 'properties.interval', + type: { + name: 'Number' + } + }, + frequency: { + required: false, + serializedName: 'properties.frequency', + type: { + name: 'String' + } + }, + timeZone: { + required: false, + serializedName: 'properties.timeZone', + type: { + name: 'String' + } + }, + advancedSchedule: { + required: false, + serializedName: 'properties.advancedSchedule', + type: { + name: 'Composite', + className: 'AdvancedSchedule' + } + }, + creationTime: { + required: false, + serializedName: 'properties.creationTime', + type: { + name: 'DateTime' + } + }, + lastModifiedTime: { + required: false, + serializedName: 'properties.lastModifiedTime', + type: { + name: 'DateTime' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Schedule; diff --git a/lib/services/automationManagement/lib/lib/models/scheduleAssociationProperty.js b/lib/services/automationManagement/lib/lib/models/scheduleAssociationProperty.js new file mode 100644 index 0000000000..a21c31f50d --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/scheduleAssociationProperty.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 schedule property associated with the entity. + * + */ +class ScheduleAssociationProperty { + /** + * Create a ScheduleAssociationProperty. + * @member {string} [name] Gets or sets the name of the schedule. + */ + constructor() { + } + + /** + * Defines the metadata of ScheduleAssociationProperty + * + * @returns {object} metadata of ScheduleAssociationProperty + * + */ + mapper() { + return { + required: false, + serializedName: 'ScheduleAssociationProperty', + type: { + name: 'Composite', + className: 'ScheduleAssociationProperty', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ScheduleAssociationProperty; diff --git a/lib/services/automationManagement/lib/lib/models/scheduleCreateOrUpdateParameters.js b/lib/services/automationManagement/lib/lib/models/scheduleCreateOrUpdateParameters.js new file mode 100644 index 0000000000..fd14a76bd3 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/scheduleCreateOrUpdateParameters.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'); + +/** + * The parameters supplied to the create or update schedule operation. + * + */ +class ScheduleCreateOrUpdateParameters { + /** + * Create a ScheduleCreateOrUpdateParameters. + * @member {string} name Gets or sets the name of the schedule. + * @member {string} [description] Gets or sets the description of the + * schedule. + * @member {date} startTime Gets or sets the start time of the schedule. + * @member {date} [expiryTime] Gets or sets the end time of the schedule. + * @member {object} [interval] Gets or sets the interval of the schedule. + * @member {string} frequency Possible values include: 'OneTime', 'Day', + * 'Hour', 'Week', 'Month' + * @member {string} [timeZone] Gets or sets the time zone of the schedule. + * @member {object} [advancedSchedule] Gets or sets the AdvancedSchedule. + * @member {array} [advancedSchedule.weekDays] Days of the week that the job + * should execute on. + * @member {array} [advancedSchedule.monthDays] Days of the month that the + * job should execute on. Must be between 1 and 31. + * @member {array} [advancedSchedule.monthlyOccurrences] Occurrences of days + * within a month. + */ + constructor() { + } + + /** + * Defines the metadata of ScheduleCreateOrUpdateParameters + * + * @returns {object} metadata of ScheduleCreateOrUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'ScheduleCreateOrUpdateParameters', + type: { + name: 'Composite', + className: 'ScheduleCreateOrUpdateParameters', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + startTime: { + required: true, + serializedName: 'properties.startTime', + type: { + name: 'DateTime' + } + }, + expiryTime: { + required: false, + serializedName: 'properties.expiryTime', + type: { + name: 'DateTime' + } + }, + interval: { + required: false, + serializedName: 'properties.interval', + type: { + name: 'Object' + } + }, + frequency: { + required: true, + serializedName: 'properties.frequency', + type: { + name: 'String' + } + }, + timeZone: { + required: false, + serializedName: 'properties.timeZone', + type: { + name: 'String' + } + }, + advancedSchedule: { + required: false, + serializedName: 'properties.advancedSchedule', + type: { + name: 'Composite', + className: 'AdvancedSchedule' + } + } + } + } + }; + } +} + +module.exports = ScheduleCreateOrUpdateParameters; diff --git a/lib/services/automationManagement/lib/lib/models/scheduleListResult.js b/lib/services/automationManagement/lib/lib/models/scheduleListResult.js new file mode 100644 index 0000000000..771ec27960 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/scheduleListResult.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'; + +/** + * The response model for the list schedule operation. + */ +class ScheduleListResult extends Array { + /** + * Create a ScheduleListResult. + * @member {string} [nextLink] Gets or sets the next link. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ScheduleListResult + * + * @returns {object} metadata of ScheduleListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ScheduleListResult', + type: { + name: 'Composite', + className: 'ScheduleListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ScheduleElementType', + type: { + name: 'Composite', + className: 'Schedule' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ScheduleListResult; diff --git a/lib/services/automationManagement/lib/lib/models/scheduleProperties.js b/lib/services/automationManagement/lib/lib/models/scheduleProperties.js new file mode 100644 index 0000000000..8a0efe82d1 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/scheduleProperties.js @@ -0,0 +1,172 @@ +/* + * 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'); + +/** + * Definition of schedule parameters. + * + */ +class ScheduleProperties { + /** + * Create a ScheduleProperties. + * @member {date} [startTime] Gets or sets the start time of the schedule. + * @member {number} [startTimeOffsetMinutes] Gets the start time's offset in + * minutes. + * @member {date} [expiryTime] Gets or sets the end time of the schedule. + * @member {number} [expiryTimeOffsetMinutes] Gets or sets the expiry time's + * offset in minutes. + * @member {boolean} [isEnabled] Gets or sets a value indicating whether this + * schedule is enabled. Default value: false . + * @member {date} [nextRun] Gets or sets the next run time of the schedule. + * @member {number} [nextRunOffsetMinutes] Gets or sets the next run time's + * offset in minutes. + * @member {number} [interval] Gets or sets the interval of the schedule. + * @member {string} [frequency] Gets or sets the frequency of the schedule. + * Possible values include: 'OneTime', 'Day', 'Hour', 'Week', 'Month' + * @member {string} [timeZone] Gets or sets the time zone of the schedule. + * @member {object} [advancedSchedule] Gets or sets the advanced schedule. + * @member {array} [advancedSchedule.weekDays] Days of the week that the job + * should execute on. + * @member {array} [advancedSchedule.monthDays] Days of the month that the + * job should execute on. Must be between 1 and 31. + * @member {array} [advancedSchedule.monthlyOccurrences] Occurrences of days + * within a month. + * @member {date} [creationTime] Gets or sets the creation time. + * @member {date} [lastModifiedTime] Gets or sets the last modified time. + * @member {string} [description] Gets or sets the description. + */ + constructor() { + } + + /** + * Defines the metadata of ScheduleProperties + * + * @returns {object} metadata of ScheduleProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'ScheduleProperties', + type: { + name: 'Composite', + className: 'ScheduleProperties', + modelProperties: { + startTime: { + required: false, + serializedName: 'startTime', + type: { + name: 'DateTime' + } + }, + startTimeOffsetMinutes: { + required: false, + readOnly: true, + serializedName: 'startTimeOffsetMinutes', + type: { + name: 'Number' + } + }, + expiryTime: { + required: false, + serializedName: 'expiryTime', + type: { + name: 'DateTime' + } + }, + expiryTimeOffsetMinutes: { + required: false, + serializedName: 'expiryTimeOffsetMinutes', + type: { + name: 'Number' + } + }, + isEnabled: { + required: false, + serializedName: 'isEnabled', + defaultValue: false, + type: { + name: 'Boolean' + } + }, + nextRun: { + required: false, + serializedName: 'nextRun', + type: { + name: 'DateTime' + } + }, + nextRunOffsetMinutes: { + required: false, + serializedName: 'nextRunOffsetMinutes', + type: { + name: 'Number' + } + }, + interval: { + required: false, + serializedName: 'interval', + type: { + name: 'Number' + } + }, + frequency: { + required: false, + serializedName: 'frequency', + type: { + name: 'String' + } + }, + timeZone: { + required: false, + serializedName: 'timeZone', + type: { + name: 'String' + } + }, + advancedSchedule: { + required: false, + serializedName: 'advancedSchedule', + type: { + name: 'Composite', + className: 'AdvancedSchedule' + } + }, + creationTime: { + required: false, + serializedName: 'creationTime', + type: { + name: 'DateTime' + } + }, + lastModifiedTime: { + required: false, + serializedName: 'lastModifiedTime', + type: { + name: 'DateTime' + } + }, + description: { + required: false, + serializedName: 'description', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ScheduleProperties; diff --git a/lib/services/automationManagement/lib/lib/models/scheduleUpdateParameters.js b/lib/services/automationManagement/lib/lib/models/scheduleUpdateParameters.js new file mode 100644 index 0000000000..26bd642bec --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/scheduleUpdateParameters.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'; + +/** + * The parameters supplied to the update schedule operation. + * + */ +class ScheduleUpdateParameters { + /** + * Create a ScheduleUpdateParameters. + * @member {string} [name] Gets or sets the name of the schedule. + * @member {string} [description] Gets or sets the description of the + * schedule. + * @member {boolean} [isEnabled] Gets or sets a value indicating whether this + * schedule is enabled. + */ + constructor() { + } + + /** + * Defines the metadata of ScheduleUpdateParameters + * + * @returns {object} metadata of ScheduleUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'ScheduleUpdateParameters', + type: { + name: 'Composite', + className: 'ScheduleUpdateParameters', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + isEnabled: { + required: false, + serializedName: 'properties.isEnabled', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = ScheduleUpdateParameters; diff --git a/lib/services/automationManagement/lib/lib/models/sku.js b/lib/services/automationManagement/lib/lib/models/sku.js new file mode 100644 index 0000000000..4463c09975 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/sku.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'; + +/** + * The account SKU. + * + */ +class Sku { + /** + * Create a Sku. + * @member {string} name Gets or sets the SKU name of the account. Possible + * values include: 'Free', 'Basic' + * @member {string} [family] Gets or sets the SKU family. + * @member {number} [capacity] Gets or sets the SKU capacity. + */ + constructor() { + } + + /** + * Defines the metadata of Sku + * + * @returns {object} metadata of Sku + * + */ + mapper() { + return { + required: false, + serializedName: 'Sku', + type: { + name: 'Composite', + className: 'Sku', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + family: { + required: false, + serializedName: 'family', + type: { + name: 'String' + } + }, + capacity: { + required: false, + serializedName: 'capacity', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = Sku; diff --git a/lib/services/automationManagement/lib/lib/models/softwareUpdateConfiguration.js b/lib/services/automationManagement/lib/lib/models/softwareUpdateConfiguration.js new file mode 100644 index 0000000000..a93fc66152 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/softwareUpdateConfiguration.js @@ -0,0 +1,218 @@ +/* + * 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'); + +/** + * Software update configuration properties. + * + * @extends models['BaseResource'] + */ +class SoftwareUpdateConfiguration extends models['BaseResource'] { + /** + * Create a SoftwareUpdateConfiguration. + * @member {string} [name] Resource name. + * @member {string} [id] Resource Id. + * @member {string} [type] Resource type + * @member {object} updateConfiguration update specific properties for the + * Software update configuration + * @member {string} [updateConfiguration.operatingSystem] operating system of + * target machines. Possible values include: 'Windows', 'Linux' + * @member {object} [updateConfiguration.windows] Windows specific update + * configuration. + * @member {string} + * [updateConfiguration.windows.includedUpdateClassifications] Update + * classification included in the software update configuration. A comma + * separated string with required values. Possible values include: + * 'Unclassified', 'Critical', 'Security', 'UpdateRollup', 'FeaturePack', + * 'ServicePack', 'Definition', 'Tools', 'Updates' + * @member {array} [updateConfiguration.windows.excludedKbNumbers] KB numbers + * excluded from the software update configuration. + * @member {object} [updateConfiguration.linux] Linux specific update + * configuration. + * @member {string} + * [updateConfiguration.linux.includedPackageClassifications] Update + * classifications included in the software update configuration. Possible + * values include: 'Unclassified', 'Critical', 'Security', 'Other' + * @member {array} [updateConfiguration.linux.excludedPackageNameMasks] + * packages excluded from the software update configuration. + * @member {moment.duration} [updateConfiguration.duration] Maximum time + * allowed for the software update configuration run. Duration needs to be + * specified using the format PT[n]H[n]M[n]S as per ISO8601 + * @member {array} [updateConfiguration.azureVirtualMachines] List of azure + * resource Ids for azure virtual machines targeted by the software update + * configuration. + * @member {array} [updateConfiguration.nonAzureComputerNames] List of names + * of non-azure machines targeted by the software update configuration. + * @member {object} scheduleInfo Schedule information for the Software update + * configuration + * @member {date} [scheduleInfo.startTime] Gets or sets the start time of the + * schedule. + * @member {number} [scheduleInfo.startTimeOffsetMinutes] Gets the start + * time's offset in minutes. + * @member {date} [scheduleInfo.expiryTime] Gets or sets the end time of the + * schedule. + * @member {number} [scheduleInfo.expiryTimeOffsetMinutes] Gets or sets the + * expiry time's offset in minutes. + * @member {boolean} [scheduleInfo.isEnabled] Gets or sets a value indicating + * whether this schedule is enabled. + * @member {date} [scheduleInfo.nextRun] Gets or sets the next run time of + * the schedule. + * @member {number} [scheduleInfo.nextRunOffsetMinutes] Gets or sets the next + * run time's offset in minutes. + * @member {number} [scheduleInfo.interval] Gets or sets the interval of the + * schedule. + * @member {string} [scheduleInfo.frequency] Gets or sets the frequency of + * the schedule. Possible values include: 'OneTime', 'Day', 'Hour', 'Week', + * 'Month' + * @member {string} [scheduleInfo.timeZone] Gets or sets the time zone of the + * schedule. + * @member {object} [scheduleInfo.advancedSchedule] Gets or sets the advanced + * schedule. + * @member {array} [scheduleInfo.advancedSchedule.weekDays] Days of the week + * that the job should execute on. + * @member {array} [scheduleInfo.advancedSchedule.monthDays] Days of the + * month that the job should execute on. Must be between 1 and 31. + * @member {array} [scheduleInfo.advancedSchedule.monthlyOccurrences] + * Occurrences of days within a month. + * @member {date} [scheduleInfo.creationTime] Gets or sets the creation time. + * @member {date} [scheduleInfo.lastModifiedTime] Gets or sets the last + * modified time. + * @member {string} [scheduleInfo.description] Gets or sets the description. + * @member {string} [provisioningState] Provisioning state for the software + * update configuration, which only appears in the response. + * @member {object} [error] detailes of provisioning error + * @member {string} [error.code] Error code + * @member {string} [error.message] Error message indicating why the + * operation failed. + * @member {date} [creationTime] Creation time of theresource, which only + * appears in the response. + * @member {string} [createdBy] createdBy property, which only appears in the + * response. + * @member {date} [lastModifiedTime] Last time resource was modified, which + * only appears in the response. + * @member {string} [lastModifiedBy] lastModifiedBy property, which only + * appears in the response. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of SoftwareUpdateConfiguration + * + * @returns {object} metadata of SoftwareUpdateConfiguration + * + */ + mapper() { + return { + required: false, + serializedName: 'softwareUpdateConfiguration', + type: { + name: 'Composite', + className: 'SoftwareUpdateConfiguration', + modelProperties: { + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + updateConfiguration: { + required: true, + serializedName: 'properties.updateConfiguration', + type: { + name: 'Composite', + className: 'UpdateConfiguration' + } + }, + scheduleInfo: { + required: true, + serializedName: 'properties.scheduleInfo', + type: { + name: 'Composite', + className: 'ScheduleProperties' + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + error: { + required: false, + serializedName: 'properties.error', + type: { + name: 'Composite', + className: 'ErrorResponse' + } + }, + creationTime: { + required: false, + readOnly: true, + serializedName: 'properties.creationTime', + type: { + name: 'DateTime' + } + }, + createdBy: { + required: false, + readOnly: true, + serializedName: 'properties.createdBy', + type: { + name: 'String' + } + }, + lastModifiedTime: { + required: false, + readOnly: true, + serializedName: 'properties.lastModifiedTime', + type: { + name: 'DateTime' + } + }, + lastModifiedBy: { + required: false, + readOnly: true, + serializedName: 'properties.lastModifiedBy', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SoftwareUpdateConfiguration; diff --git a/lib/services/automationManagement/lib/lib/models/softwareUpdateConfigurationCollectionItem.js b/lib/services/automationManagement/lib/lib/models/softwareUpdateConfigurationCollectionItem.js new file mode 100644 index 0000000000..3feed65506 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/softwareUpdateConfigurationCollectionItem.js @@ -0,0 +1,136 @@ +/* + * 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'); + +/** + * Software update configuration collection item properties. + * + */ +class SoftwareUpdateConfigurationCollectionItem { + /** + * Create a SoftwareUpdateConfigurationCollectionItem. + * @member {string} [name] Name of the software update configuration. + * @member {string} [id] Resource Id of the software update configuration + * @member {object} [updateConfiguration] Update specific properties of the + * software update configuration. + * @member {array} [updateConfiguration.azureVirtualMachines] List of azure + * resource Ids for azure virtual machines targeted by the software update + * configuration. + * @member {moment.duration} [updateConfiguration.duration] Maximum time + * allowed for the software update configuration run. Duration needs to be + * specified using the format PT[n]H[n]M[n]S as per ISO8601 + * @member {string} [frequency] execution frequency of the schedule + * associated with the software update configuration. Possible values + * include: 'OneTime', 'Day', 'Hour', 'Week', 'Month' + * @member {date} [startTime] the start time of the update. + * @member {date} [creationTime] Creation time of the software update + * configuration, which only appears in the response. + * @member {date} [lastModifiedTime] Last time software update configuration + * was modified, which only appears in the response. + * @member {string} [provisioningState] Provisioning state for the software + * update configuration, which only appears in the response. + * @member {date} [nextRun] ext run time of the update. + */ + constructor() { + } + + /** + * Defines the metadata of SoftwareUpdateConfigurationCollectionItem + * + * @returns {object} metadata of SoftwareUpdateConfigurationCollectionItem + * + */ + mapper() { + return { + required: false, + serializedName: 'softwareUpdateConfigurationCollectionItem', + type: { + name: 'Composite', + className: 'SoftwareUpdateConfigurationCollectionItem', + modelProperties: { + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + updateConfiguration: { + required: false, + serializedName: 'properties.updateConfiguration', + type: { + name: 'Composite', + className: 'CollectionItemUpdateConfiguration' + } + }, + frequency: { + required: false, + serializedName: 'properties.frequency', + type: { + name: 'String' + } + }, + startTime: { + required: false, + serializedName: 'properties.startTime', + type: { + name: 'DateTime' + } + }, + creationTime: { + required: false, + readOnly: true, + serializedName: 'properties.creationTime', + type: { + name: 'DateTime' + } + }, + lastModifiedTime: { + required: false, + readOnly: true, + serializedName: 'properties.lastModifiedTime', + type: { + name: 'DateTime' + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + nextRun: { + required: false, + serializedName: 'properties.nextRun', + type: { + name: 'DateTime' + } + } + } + } + }; + } +} + +module.exports = SoftwareUpdateConfigurationCollectionItem; diff --git a/lib/services/automationManagement/lib/lib/models/softwareUpdateConfigurationListResult.js b/lib/services/automationManagement/lib/lib/models/softwareUpdateConfigurationListResult.js new file mode 100644 index 0000000000..74f8890db3 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/softwareUpdateConfigurationListResult.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'; + +const models = require('./index'); + +/** + * result of listing all software update configuration + * + */ +class SoftwareUpdateConfigurationListResult { + /** + * Create a SoftwareUpdateConfigurationListResult. + * @member {array} [value] outer object returned when listing all software + * update configurations + */ + constructor() { + } + + /** + * Defines the metadata of SoftwareUpdateConfigurationListResult + * + * @returns {object} metadata of SoftwareUpdateConfigurationListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'softwareUpdateConfigurationListResult', + type: { + name: 'Composite', + className: 'SoftwareUpdateConfigurationListResult', + modelProperties: { + value: { + required: false, + serializedName: 'value', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SoftwareUpdateConfigurationCollectionItemElementType', + type: { + name: 'Composite', + className: 'SoftwareUpdateConfigurationCollectionItem' + } + } + } + } + } + } + }; + } +} + +module.exports = SoftwareUpdateConfigurationListResult; diff --git a/lib/services/automationManagement/lib/lib/models/softwareUpdateConfigurationMachineRun.js b/lib/services/automationManagement/lib/lib/models/softwareUpdateConfigurationMachineRun.js new file mode 100644 index 0000000000..0220b60692 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/softwareUpdateConfigurationMachineRun.js @@ -0,0 +1,218 @@ +/* + * 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'); + +/** + * Software update configuration machine run model. + * + */ +class SoftwareUpdateConfigurationMachineRun { + /** + * Create a SoftwareUpdateConfigurationMachineRun. + * @member {string} [name] Name of the software update configuration machine + * run + * @member {string} [id] Resource Id of the software update configuration + * machine run + * @member {string} [targetComputer] name of the updated computer + * @member {string} [targetComputerType] type of the updated computer. + * @member {object} [softwareUpdateConfiguration] software update + * configuration triggered this run + * @member {string} [softwareUpdateConfiguration.name] Name of the software + * update configuration triggered the software update configuration run + * @member {string} [status] Status of the software update configuration + * machine run. + * @member {string} [osType] Operating system target of the software update + * configuration triggered this run + * @member {uuid} [correlationId] correlation id of the software update + * configuration machine run + * @member {uuid} [sourceComputerId] source computer id of the software + * update configuration machine run + * @member {date} [startTime] Start time of the software update configuration + * machine run. + * @member {date} [endTime] End time of the software update configuration + * machine run. + * @member {string} [configuredDuration] configured duration for the software + * update configuration run. + * @member {object} [job] Job associated with the software update + * configuration machine run + * @member {string} [job.id] Id of the job associated with the software + * update configuration run + * @member {date} [creationTime] Creation time of theresource, which only + * appears in the response. + * @member {string} [createdBy] createdBy property, which only appears in the + * response. + * @member {date} [lastModifiedTime] Last time resource was modified, which + * only appears in the response. + * @member {string} [lastModifiedBy] lastModifiedBy property, which only + * appears in the response. + */ + constructor() { + } + + /** + * Defines the metadata of SoftwareUpdateConfigurationMachineRun + * + * @returns {object} metadata of SoftwareUpdateConfigurationMachineRun + * + */ + mapper() { + return { + required: false, + serializedName: 'softwareUpdateConfigurationMachineRun', + type: { + name: 'Composite', + className: 'SoftwareUpdateConfigurationMachineRun', + modelProperties: { + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + targetComputer: { + required: false, + readOnly: true, + serializedName: 'properties.targetComputer', + type: { + name: 'String' + } + }, + targetComputerType: { + required: false, + readOnly: true, + serializedName: 'properties.targetComputerType', + type: { + name: 'String' + } + }, + softwareUpdateConfiguration: { + required: false, + serializedName: 'properties.softwareUpdateConfiguration', + type: { + name: 'Composite', + className: 'UpdateConfigurationNavigation' + } + }, + status: { + required: false, + readOnly: true, + serializedName: 'properties.status', + type: { + name: 'String' + } + }, + osType: { + required: false, + readOnly: true, + serializedName: 'properties.osType', + type: { + name: 'String' + } + }, + correlationId: { + required: false, + readOnly: true, + serializedName: 'properties.correlationId', + type: { + name: 'String' + } + }, + sourceComputerId: { + required: false, + readOnly: true, + serializedName: 'properties.sourceComputerId', + type: { + name: 'String' + } + }, + startTime: { + required: false, + readOnly: true, + serializedName: 'properties.startTime', + type: { + name: 'DateTime' + } + }, + endTime: { + required: false, + readOnly: true, + serializedName: 'properties.endTime', + type: { + name: 'DateTime' + } + }, + configuredDuration: { + required: false, + readOnly: true, + serializedName: 'properties.configuredDuration', + type: { + name: 'String' + } + }, + job: { + required: false, + serializedName: 'properties.job', + type: { + name: 'Composite', + className: 'JobNavigation' + } + }, + creationTime: { + required: false, + readOnly: true, + serializedName: 'properties.creationTime', + type: { + name: 'DateTime' + } + }, + createdBy: { + required: false, + readOnly: true, + serializedName: 'properties.createdBy', + type: { + name: 'String' + } + }, + lastModifiedTime: { + required: false, + readOnly: true, + serializedName: 'properties.lastModifiedTime', + type: { + name: 'DateTime' + } + }, + lastModifiedBy: { + required: false, + readOnly: true, + serializedName: 'properties.lastModifiedBy', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SoftwareUpdateConfigurationMachineRun; diff --git a/lib/services/automationManagement/lib/lib/models/softwareUpdateConfigurationMachineRunListResult.js b/lib/services/automationManagement/lib/lib/models/softwareUpdateConfigurationMachineRunListResult.js new file mode 100644 index 0000000000..e6411a5fec --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/softwareUpdateConfigurationMachineRunListResult.js @@ -0,0 +1,71 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * result of listing all software update configuration machine runs + * + */ +class SoftwareUpdateConfigurationMachineRunListResult { + /** + * Create a SoftwareUpdateConfigurationMachineRunListResult. + * @member {array} [value] outer object returned when listing all software + * update configuration machine runs + * @member {string} [nextLink] link to next page of results. + */ + constructor() { + } + + /** + * Defines the metadata of SoftwareUpdateConfigurationMachineRunListResult + * + * @returns {object} metadata of SoftwareUpdateConfigurationMachineRunListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'softwareUpdateConfigurationMachineRunListResult', + type: { + name: 'Composite', + className: 'SoftwareUpdateConfigurationMachineRunListResult', + modelProperties: { + value: { + required: false, + serializedName: 'value', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SoftwareUpdateConfigurationMachineRunElementType', + type: { + name: 'Composite', + className: 'SoftwareUpdateConfigurationMachineRun' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SoftwareUpdateConfigurationMachineRunListResult; diff --git a/lib/services/automationManagement/lib/lib/models/softwareUpdateConfigurationRun.js b/lib/services/automationManagement/lib/lib/models/softwareUpdateConfigurationRun.js new file mode 100644 index 0000000000..d7c603ce40 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/softwareUpdateConfigurationRun.js @@ -0,0 +1,184 @@ +/* + * 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'); + +/** + * Software update configuration Run properties. + * + */ +class SoftwareUpdateConfigurationRun { + /** + * Create a SoftwareUpdateConfigurationRun. + * @member {string} [name] Name of the software update configuration run. + * @member {string} [id] Resource Id of the software update configuration run + * @member {object} [softwareUpdateConfiguration] software update + * configuration triggered this run + * @member {string} [softwareUpdateConfiguration.name] Name of the software + * update configuration triggered the software update configuration run + * @member {string} [status] Status of the software update configuration run. + * @member {string} [configuredDuration] configured duration for the software + * update configuration run. + * @member {string} [osType] Operating system target of the software update + * configuration triggered this run + * @member {date} [startTime] Etart time of the software update configuration + * run. + * @member {date} [endTime] End time of the software update configuration + * run. + * @member {number} [computerCount] Number of computers in the software + * update configuration run. + * @member {number} [failedCount] Number of computers with failed status. + * @member {date} [creationTime] Creation time of theresource, which only + * appears in the response. + * @member {string} [createdBy] createdBy property, which only appears in the + * response. + * @member {date} [lastModifiedTime] Last time resource was modified, which + * only appears in the response. + * @member {string} [lastModifiedBy] lastModifiedBy property, which only + * appears in the response. + */ + constructor() { + } + + /** + * Defines the metadata of SoftwareUpdateConfigurationRun + * + * @returns {object} metadata of SoftwareUpdateConfigurationRun + * + */ + mapper() { + return { + required: false, + serializedName: 'softwareUpdateConfigurationRun', + type: { + name: 'Composite', + className: 'SoftwareUpdateConfigurationRun', + modelProperties: { + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + softwareUpdateConfiguration: { + required: false, + serializedName: 'properties.softwareUpdateConfiguration', + type: { + name: 'Composite', + className: 'UpdateConfigurationNavigation' + } + }, + status: { + required: false, + readOnly: true, + serializedName: 'properties.status', + type: { + name: 'String' + } + }, + configuredDuration: { + required: false, + readOnly: true, + serializedName: 'properties.configuredDuration', + type: { + name: 'String' + } + }, + osType: { + required: false, + readOnly: true, + serializedName: 'properties.osType', + type: { + name: 'String' + } + }, + startTime: { + required: false, + readOnly: true, + serializedName: 'properties.startTime', + type: { + name: 'DateTime' + } + }, + endTime: { + required: false, + readOnly: true, + serializedName: 'properties.endTime', + type: { + name: 'DateTime' + } + }, + computerCount: { + required: false, + readOnly: true, + serializedName: 'properties.computerCount', + type: { + name: 'Number' + } + }, + failedCount: { + required: false, + readOnly: true, + serializedName: 'properties.failedCount', + type: { + name: 'Number' + } + }, + creationTime: { + required: false, + readOnly: true, + serializedName: 'properties.creationTime', + type: { + name: 'DateTime' + } + }, + createdBy: { + required: false, + readOnly: true, + serializedName: 'properties.createdBy', + type: { + name: 'String' + } + }, + lastModifiedTime: { + required: false, + readOnly: true, + serializedName: 'properties.lastModifiedTime', + type: { + name: 'DateTime' + } + }, + lastModifiedBy: { + required: false, + readOnly: true, + serializedName: 'properties.lastModifiedBy', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SoftwareUpdateConfigurationRun; diff --git a/lib/services/automationManagement/lib/lib/models/softwareUpdateConfigurationRunListResult.js b/lib/services/automationManagement/lib/lib/models/softwareUpdateConfigurationRunListResult.js new file mode 100644 index 0000000000..24ccdc2172 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/softwareUpdateConfigurationRunListResult.js @@ -0,0 +1,71 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * result of listing all software update configuration runs + * + */ +class SoftwareUpdateConfigurationRunListResult { + /** + * Create a SoftwareUpdateConfigurationRunListResult. + * @member {array} [value] outer object returned when listing all software + * update configuration runs + * @member {string} [nextLink] link to next page of results. + */ + constructor() { + } + + /** + * Defines the metadata of SoftwareUpdateConfigurationRunListResult + * + * @returns {object} metadata of SoftwareUpdateConfigurationRunListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'softwareUpdateConfigurationRunListResult', + type: { + name: 'Composite', + className: 'SoftwareUpdateConfigurationRunListResult', + modelProperties: { + value: { + required: false, + serializedName: 'value', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SoftwareUpdateConfigurationRunElementType', + type: { + name: 'Composite', + className: 'SoftwareUpdateConfigurationRun' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SoftwareUpdateConfigurationRunListResult; diff --git a/lib/services/automationManagement/lib/lib/models/sourceControl.js b/lib/services/automationManagement/lib/lib/models/sourceControl.js new file mode 100644 index 0000000000..b926558d2e --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/sourceControl.js @@ -0,0 +1,153 @@ +/* + * 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'); + +/** + * Definition of the source control. + * + * @extends models['BaseResource'] + */ +class SourceControl extends models['BaseResource'] { + /** + * Create a SourceControl. + * @member {string} [name] Resource name. + * @member {string} [id] Resource Id. + * @member {string} [type] Resource type. + * @member {string} [repoUrl] Gets or sets the repo url of the source + * control. + * @member {string} [branch] Gets or sets the repo branch of the source + * control. Include branch as empty string for VsoTfvc. + * @member {string} [folderPath] Gets or sets the folder path of the source + * control. + * @member {boolean} [autoSync] Gets or sets auto async of the source + * control. Default is false. + * @member {boolean} [publishRunbook] Gets or sets the auto publish of the + * source control. Default is true. + * @member {string} [sourceType] The source type. Must be one of VsoGit, + * VsoTfvc, GitHub. Possible values include: 'VsoGit', 'VsoTfvc', 'GitHub' + * @member {string} [description] Gets or sets the description. + * @member {date} [creationTime] Gets or sets the creation time. + * @member {date} [lastModifiedTime] Gets or sets the last modified time. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of SourceControl + * + * @returns {object} metadata of SourceControl + * + */ + mapper() { + return { + required: false, + serializedName: 'SourceControl', + type: { + name: 'Composite', + className: 'SourceControl', + modelProperties: { + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + repoUrl: { + required: false, + serializedName: 'properties.repoUrl', + type: { + name: 'String' + } + }, + branch: { + required: false, + serializedName: 'properties.branch', + type: { + name: 'String' + } + }, + folderPath: { + required: false, + serializedName: 'properties.folderPath', + type: { + name: 'String' + } + }, + autoSync: { + required: false, + serializedName: 'properties.autoSync', + type: { + name: 'Boolean' + } + }, + publishRunbook: { + required: false, + serializedName: 'properties.publishRunbook', + type: { + name: 'Boolean' + } + }, + sourceType: { + required: false, + serializedName: 'properties.sourceType', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + creationTime: { + required: false, + serializedName: 'properties.creationTime', + type: { + name: 'DateTime' + } + }, + lastModifiedTime: { + required: false, + serializedName: 'properties.lastModifiedTime', + type: { + name: 'DateTime' + } + } + } + } + }; + } +} + +module.exports = SourceControl; diff --git a/lib/services/automationManagement/lib/lib/models/sourceControlCreateOrUpdateParameters.js b/lib/services/automationManagement/lib/lib/models/sourceControlCreateOrUpdateParameters.js new file mode 100644 index 0000000000..ebed49622d --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/sourceControlCreateOrUpdateParameters.js @@ -0,0 +1,132 @@ +/* + * 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 parameters supplied to the create or update source control operation. + * + */ +class SourceControlCreateOrUpdateParameters { + /** + * Create a SourceControlCreateOrUpdateParameters. + * @member {string} [repoUrl] Gets or sets the repo url of the source + * control. + * @member {string} [branch] Gets or sets the repo branch of the source + * control. Include branch as empty string for VsoTfvc. + * @member {string} [folderPath] Gets or sets the folder path of the source + * control. Path must be relative. + * @member {boolean} [autoSync] Gets or sets auto async of the source + * control. Default is false. + * @member {boolean} [publishRunbook] Gets or sets the auto publish of the + * source control. Default is true. + * @member {string} [sourceType] The source type. Must be one of VsoGit, + * VsoTfvc, GitHub, case sensitive. Possible values include: 'VsoGit', + * 'VsoTfvc', 'GitHub' + * @member {string} [securityToken] Gets or sets the authorization token for + * the repo of the source control. + * @member {string} [description] Gets or sets the user description of the + * source control. + */ + constructor() { + } + + /** + * Defines the metadata of SourceControlCreateOrUpdateParameters + * + * @returns {object} metadata of SourceControlCreateOrUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'SourceControlCreateOrUpdateParameters', + type: { + name: 'Composite', + className: 'SourceControlCreateOrUpdateParameters', + modelProperties: { + repoUrl: { + required: false, + serializedName: 'properties.repoUrl', + constraints: { + MaxLength: 2000 + }, + type: { + name: 'String' + } + }, + branch: { + required: false, + serializedName: 'properties.branch', + constraints: { + MaxLength: 255 + }, + type: { + name: 'String' + } + }, + folderPath: { + required: false, + serializedName: 'properties.folderPath', + constraints: { + MaxLength: 255 + }, + type: { + name: 'String' + } + }, + autoSync: { + required: false, + serializedName: 'properties.autoSync', + type: { + name: 'Boolean' + } + }, + publishRunbook: { + required: false, + serializedName: 'properties.publishRunbook', + type: { + name: 'Boolean' + } + }, + sourceType: { + required: false, + serializedName: 'properties.sourceType', + type: { + name: 'String' + } + }, + securityToken: { + required: false, + serializedName: 'properties.securityToken', + constraints: { + MaxLength: 1024 + }, + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'properties.description', + constraints: { + MaxLength: 512 + }, + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SourceControlCreateOrUpdateParameters; diff --git a/lib/services/automationManagement/lib/lib/models/sourceControlListResult.js b/lib/services/automationManagement/lib/lib/models/sourceControlListResult.js new file mode 100644 index 0000000000..18028ab656 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/sourceControlListResult.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'; + +/** + * The response model for the list source controls operation. + */ +class SourceControlListResult extends Array { + /** + * Create a SourceControlListResult. + * @member {string} [nextLink] Gets or sets the next link. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of SourceControlListResult + * + * @returns {object} metadata of SourceControlListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'SourceControlListResult', + type: { + name: 'Composite', + className: 'SourceControlListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SourceControlElementType', + type: { + name: 'Composite', + className: 'SourceControl' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SourceControlListResult; diff --git a/lib/services/automationManagement/lib/lib/models/sourceControlSyncJob.js b/lib/services/automationManagement/lib/lib/models/sourceControlSyncJob.js new file mode 100644 index 0000000000..77494ea6a2 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/sourceControlSyncJob.js @@ -0,0 +1,124 @@ +/* + * 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'; + +/** + * Definition of the source control sync job. + * + */ +class SourceControlSyncJob { + /** + * Create a SourceControlSyncJob. + * @member {string} [name] Resource name. + * @member {string} [type] Resource type. + * @member {string} [id] Resource id. + * @member {string} [sourceControlSyncJobId] Gets the source control sync job + * id. + * @member {date} [creationTime] Gets the creation time of the job. + * @member {string} [provisioningState] Gets the provisioning state of the + * job. Possible values include: 'Completed', 'Failed', 'Running' + * @member {date} [startTime] Gets the start time of the job. + * @member {date} [endTime] Gets the end time of the job. + * @member {string} [startedBy] Gets the user who started the sync job. + */ + constructor() { + } + + /** + * Defines the metadata of SourceControlSyncJob + * + * @returns {object} metadata of SourceControlSyncJob + * + */ + mapper() { + return { + required: false, + serializedName: 'SourceControlSyncJob', + type: { + name: 'Composite', + className: 'SourceControlSyncJob', + modelProperties: { + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + sourceControlSyncJobId: { + required: false, + serializedName: 'properties.sourceControlSyncJobId', + type: { + name: 'String' + } + }, + creationTime: { + required: false, + readOnly: true, + serializedName: 'properties.creationTime', + type: { + name: 'DateTime' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + startTime: { + required: false, + readOnly: true, + serializedName: 'properties.startTime', + type: { + name: 'DateTime' + } + }, + endTime: { + required: false, + readOnly: true, + serializedName: 'properties.endTime', + type: { + name: 'DateTime' + } + }, + startedBy: { + required: false, + serializedName: 'properties.startedBy', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SourceControlSyncJob; diff --git a/lib/services/automationManagement/lib/lib/models/sourceControlSyncJobById.js b/lib/services/automationManagement/lib/lib/models/sourceControlSyncJobById.js new file mode 100644 index 0000000000..5936289484 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/sourceControlSyncJobById.js @@ -0,0 +1,118 @@ +/* + * 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'); + +/** + * Definition of the source control sync job. + * + */ +class SourceControlSyncJobById { + /** + * Create a SourceControlSyncJobById. + * @member {string} [id] Gets the id of the job. + * @member {string} [sourceControlSyncJobId] Gets the source control sync job + * id. + * @member {date} [creationTime] Gets the creation time of the job. + * @member {string} [provisioningState] Gets the provisioning state of the + * job. Possible values include: 'Completed', 'Failed', 'Running' + * @member {date} [startTime] Gets the start time of the job. + * @member {date} [endTime] Gets the end time of the job. + * @member {string} [startedBy] Gets the user who started the sync job. + * @member {object} [errors] Error details of the source control sync job. + * @member {string} [errors.code] Gets the error code for the job. + * @member {string} [errors.message] Gets the error message for the job. + */ + constructor() { + } + + /** + * Defines the metadata of SourceControlSyncJobById + * + * @returns {object} metadata of SourceControlSyncJobById + * + */ + mapper() { + return { + required: false, + serializedName: 'SourceControlSyncJobById', + type: { + name: 'Composite', + className: 'SourceControlSyncJobById', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + sourceControlSyncJobId: { + required: false, + serializedName: 'properties.sourceControlSyncJobId', + type: { + name: 'String' + } + }, + creationTime: { + required: false, + readOnly: true, + serializedName: 'properties.creationTime', + type: { + name: 'DateTime' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + startTime: { + required: false, + readOnly: true, + serializedName: 'properties.startTime', + type: { + name: 'DateTime' + } + }, + endTime: { + required: false, + readOnly: true, + serializedName: 'properties.endTime', + type: { + name: 'DateTime' + } + }, + startedBy: { + required: false, + serializedName: 'properties.startedBy', + type: { + name: 'String' + } + }, + errors: { + required: false, + serializedName: 'properties.errors', + type: { + name: 'Composite', + className: 'SourceControlSyncJobByIdErrors' + } + } + } + } + }; + } +} + +module.exports = SourceControlSyncJobById; diff --git a/lib/services/automationManagement/lib/lib/models/sourceControlSyncJobByIdErrors.js b/lib/services/automationManagement/lib/lib/models/sourceControlSyncJobByIdErrors.js new file mode 100644 index 0000000000..94a8ee52d0 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/sourceControlSyncJobByIdErrors.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'; + +/** + * Error details of the source control sync job. + * + */ +class SourceControlSyncJobByIdErrors { + /** + * Create a SourceControlSyncJobByIdErrors. + * @member {string} [code] Gets the error code for the job. + * @member {string} [message] Gets the error message for the job. + */ + constructor() { + } + + /** + * Defines the metadata of SourceControlSyncJobByIdErrors + * + * @returns {object} metadata of SourceControlSyncJobByIdErrors + * + */ + mapper() { + return { + required: false, + serializedName: 'SourceControlSyncJobByIdErrors', + type: { + name: 'Composite', + className: 'SourceControlSyncJobByIdErrors', + modelProperties: { + code: { + required: false, + serializedName: 'code', + type: { + name: 'String' + } + }, + message: { + required: false, + serializedName: 'message', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SourceControlSyncJobByIdErrors; diff --git a/lib/services/automationManagement/lib/lib/models/sourceControlSyncJobListResult.js b/lib/services/automationManagement/lib/lib/models/sourceControlSyncJobListResult.js new file mode 100644 index 0000000000..328361f520 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/sourceControlSyncJobListResult.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'; + +/** + * The response model for the list source control sync jobs operation. + */ +class SourceControlSyncJobListResult extends Array { + /** + * Create a SourceControlSyncJobListResult. + * @member {string} [nextLink] Gets or sets the next link. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of SourceControlSyncJobListResult + * + * @returns {object} metadata of SourceControlSyncJobListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'SourceControlSyncJobListResult', + type: { + name: 'Composite', + className: 'SourceControlSyncJobListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SourceControlSyncJobElementType', + type: { + name: 'Composite', + className: 'SourceControlSyncJob' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SourceControlSyncJobListResult; diff --git a/lib/services/automationManagement/lib/lib/models/sourceControlUpdateParameters.js b/lib/services/automationManagement/lib/lib/models/sourceControlUpdateParameters.js new file mode 100644 index 0000000000..bd0062ebd6 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/sourceControlUpdateParameters.js @@ -0,0 +1,98 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The parameters supplied to the update source control operation. + * + */ +class SourceControlUpdateParameters { + /** + * Create a SourceControlUpdateParameters. + * @member {string} [branch] Gets or sets the repo branch of the source + * control. + * @member {string} [folderPath] Gets or sets the folder path of the source + * control. Path must be relative. + * @member {boolean} [autoSync] Gets or sets auto async of the source + * control. Default is false. + * @member {boolean} [publishRunbook] Gets or sets the auto publish of the + * source control. Default is true. + * @member {string} [securityToken] Gets or sets the authorization token for + * the repo of the source control. + * @member {string} [description] Gets or sets the user description of the + * source control. + */ + constructor() { + } + + /** + * Defines the metadata of SourceControlUpdateParameters + * + * @returns {object} metadata of SourceControlUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'SourceControlUpdateParameters', + type: { + name: 'Composite', + className: 'SourceControlUpdateParameters', + modelProperties: { + branch: { + required: false, + serializedName: 'properties.branch', + type: { + name: 'String' + } + }, + folderPath: { + required: false, + serializedName: 'properties.folderPath', + type: { + name: 'String' + } + }, + autoSync: { + required: false, + serializedName: 'properties.autoSync', + type: { + name: 'Boolean' + } + }, + publishRunbook: { + required: false, + serializedName: 'properties.publishRunbook', + type: { + name: 'Boolean' + } + }, + securityToken: { + required: false, + serializedName: 'properties.securityToken', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SourceControlUpdateParameters; diff --git a/lib/services/automationManagement/lib/lib/models/statistics.js b/lib/services/automationManagement/lib/lib/models/statistics.js new file mode 100644 index 0000000000..dd6db0ec7e --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/statistics.js @@ -0,0 +1,90 @@ +/* + * 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'; + +/** + * Definition of the statistic. + * + */ +class Statistics { + /** + * Create a Statistics. + * @member {string} [counterProperty] Gets the property value of the + * statistic. + * @member {number} [counterValue] Gets the value of the statistic. + * @member {date} [startTime] Gets the startTime of the statistic. + * @member {date} [endTime] Gets the endTime of the statistic. + * @member {string} [id] Gets the id. + */ + constructor() { + } + + /** + * Defines the metadata of Statistics + * + * @returns {object} metadata of Statistics + * + */ + mapper() { + return { + required: false, + serializedName: 'Statistics', + type: { + name: 'Composite', + className: 'Statistics', + modelProperties: { + counterProperty: { + required: false, + readOnly: true, + serializedName: 'counterProperty', + type: { + name: 'String' + } + }, + counterValue: { + required: false, + readOnly: true, + serializedName: 'counterValue', + type: { + name: 'Number' + } + }, + startTime: { + required: false, + readOnly: true, + serializedName: 'startTime', + type: { + name: 'DateTime' + } + }, + endTime: { + required: false, + readOnly: true, + serializedName: 'endTime', + type: { + name: 'DateTime' + } + }, + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Statistics; diff --git a/lib/services/automationManagement/lib/lib/models/statisticsListResult.js b/lib/services/automationManagement/lib/lib/models/statisticsListResult.js new file mode 100644 index 0000000000..d5032daff7 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/statisticsListResult.js @@ -0,0 +1,59 @@ +/* + * 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 response model for the list statistics operation. + */ +class StatisticsListResult extends Array { + /** + * Create a StatisticsListResult. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of StatisticsListResult + * + * @returns {object} metadata of StatisticsListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'StatisticsListResult', + type: { + name: 'Composite', + className: 'StatisticsListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StatisticsElementType', + type: { + name: 'Composite', + className: 'Statistics' + } + } + } + } + } + } + }; + } +} + +module.exports = StatisticsListResult; diff --git a/lib/services/automationManagement/lib/lib/models/subResource.js b/lib/services/automationManagement/lib/lib/models/subResource.js new file mode 100644 index 0000000000..9e807ade9c --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/subResource.js @@ -0,0 +1,56 @@ +/* + * 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 Sub Resource definition. + * + * @extends models['BaseResource'] + */ +class SubResource extends models['BaseResource'] { + /** + * Create a SubResource. + * @member {string} [id] Resource Id + */ + constructor() { + super(); + } + + /** + * Defines the metadata of SubResource + * + * @returns {object} metadata of SubResource + * + */ + mapper() { + return { + required: false, + serializedName: 'SubResource', + type: { + name: 'Composite', + className: 'SubResource', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SubResource; diff --git a/lib/services/automationManagement/lib/lib/models/testJob.js b/lib/services/automationManagement/lib/lib/models/testJob.js new file mode 100644 index 0000000000..5dfc6c310a --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/testJob.js @@ -0,0 +1,145 @@ +/* + * 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'; + +/** + * Definition of the test job. + * + */ +class TestJob { + /** + * Create a TestJob. + * @member {date} [creationTime] Gets or sets the creation time of the test + * job. + * @member {string} [status] Gets or sets the status of the test job. + * @member {string} [statusDetails] Gets or sets the status details of the + * test job. + * @member {string} [runOn] Gets or sets the runOn which specifies the group + * name where the job is to be executed. + * @member {date} [startTime] Gets or sets the start time of the test job. + * @member {date} [endTime] Gets or sets the end time of the test job. + * @member {string} [exception] Gets or sets the exception of the test job. + * @member {date} [lastModifiedTime] Gets or sets the last modified time of + * the test job. + * @member {date} [lastStatusModifiedTime] Gets or sets the last status + * modified time of the test job. + * @member {object} [parameters] Gets or sets the parameters of the test job. + * @member {number} [logActivityTrace] The activity-level tracing options of + * the runbook. + */ + constructor() { + } + + /** + * Defines the metadata of TestJob + * + * @returns {object} metadata of TestJob + * + */ + mapper() { + return { + required: false, + serializedName: 'TestJob', + type: { + name: 'Composite', + className: 'TestJob', + modelProperties: { + creationTime: { + required: false, + serializedName: 'creationTime', + type: { + name: 'DateTime' + } + }, + status: { + required: false, + serializedName: 'status', + type: { + name: 'String' + } + }, + statusDetails: { + required: false, + serializedName: 'statusDetails', + type: { + name: 'String' + } + }, + runOn: { + required: false, + serializedName: 'runOn', + type: { + name: 'String' + } + }, + startTime: { + required: false, + serializedName: 'startTime', + type: { + name: 'DateTime' + } + }, + endTime: { + required: false, + serializedName: 'endTime', + type: { + name: 'DateTime' + } + }, + exception: { + required: false, + serializedName: 'exception', + type: { + name: 'String' + } + }, + lastModifiedTime: { + required: false, + serializedName: 'lastModifiedTime', + type: { + name: 'DateTime' + } + }, + lastStatusModifiedTime: { + required: false, + serializedName: 'lastStatusModifiedTime', + type: { + name: 'DateTime' + } + }, + parameters: { + required: false, + serializedName: 'parameters', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + logActivityTrace: { + required: false, + serializedName: 'logActivityTrace', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = TestJob; diff --git a/lib/services/automationManagement/lib/lib/models/testJobCreateParameters.js b/lib/services/automationManagement/lib/lib/models/testJobCreateParameters.js new file mode 100644 index 0000000000..23468ce8fd --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/testJobCreateParameters.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'; + +/** + * The parameters supplied to the create test job operation. + * + */ +class TestJobCreateParameters { + /** + * Create a TestJobCreateParameters. + * @member {object} [parameters] Gets or sets the parameters of the test job. + * @member {string} [runOn] Gets or sets the runOn which specifies the group + * name where the job is to be executed. + */ + constructor() { + } + + /** + * Defines the metadata of TestJobCreateParameters + * + * @returns {object} metadata of TestJobCreateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'TestJobCreateParameters', + type: { + name: 'Composite', + className: 'TestJobCreateParameters', + modelProperties: { + parameters: { + required: false, + serializedName: 'parameters', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + runOn: { + required: false, + serializedName: 'runOn', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = TestJobCreateParameters; diff --git a/lib/services/automationManagement/lib/lib/models/trackedResource.js b/lib/services/automationManagement/lib/lib/models/trackedResource.js new file mode 100644 index 0000000000..be5d3b94c0 --- /dev/null +++ b/lib/services/automationManagement/lib/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 a ARM tracked top level resource + * + * @extends models['Resource'] + */ +class TrackedResource extends models['Resource'] { + /** + * Create a TrackedResource. + * @member {object} [tags] Resource tags. + * @member {string} [location] The Azure Region where the resource lives + */ + 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' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = TrackedResource; diff --git a/lib/services/automationManagement/lib/lib/models/typeField.js b/lib/services/automationManagement/lib/lib/models/typeField.js new file mode 100644 index 0000000000..17bd8df4cf --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/typeField.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'; + +/** + * Information about a field of a type. + * + */ +class TypeField { + /** + * Create a TypeField. + * @member {string} [name] Gets or sets the name of the field. + * @member {string} [type] Gets or sets the type of the field. + */ + constructor() { + } + + /** + * Defines the metadata of TypeField + * + * @returns {object} metadata of TypeField + * + */ + mapper() { + return { + required: false, + serializedName: 'TypeField', + type: { + name: 'Composite', + className: 'TypeField', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + serializedName: 'type', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = TypeField; diff --git a/lib/services/automationManagement/lib/lib/models/typeFieldListResult.js b/lib/services/automationManagement/lib/lib/models/typeFieldListResult.js new file mode 100644 index 0000000000..6c9d5697d7 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/typeFieldListResult.js @@ -0,0 +1,59 @@ +/* + * 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 response model for the list fields operation. + */ +class TypeFieldListResult extends Array { + /** + * Create a TypeFieldListResult. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of TypeFieldListResult + * + * @returns {object} metadata of TypeFieldListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'TypeFieldListResult', + type: { + name: 'Composite', + className: 'TypeFieldListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'TypeFieldElementType', + type: { + name: 'Composite', + className: 'TypeField' + } + } + } + } + } + } + }; + } +} + +module.exports = TypeFieldListResult; diff --git a/lib/services/automationManagement/lib/lib/models/updateConfiguration.js b/lib/services/automationManagement/lib/lib/models/updateConfiguration.js new file mode 100644 index 0000000000..49842befcc --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/updateConfiguration.js @@ -0,0 +1,128 @@ +/* + * 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'); + +/** + * Update specifc properties of the software update configuration. + * + */ +class UpdateConfiguration { + /** + * Create a UpdateConfiguration. + * @member {string} operatingSystem operating system of target machines. + * Possible values include: 'Windows', 'Linux' + * @member {object} [windows] Windows specific update configuration. + * @member {string} [windows.includedUpdateClassifications] Update + * classification included in the software update configuration. A comma + * separated string with required values. Possible values include: + * 'Unclassified', 'Critical', 'Security', 'UpdateRollup', 'FeaturePack', + * 'ServicePack', 'Definition', 'Tools', 'Updates' + * @member {array} [windows.excludedKbNumbers] KB numbers excluded from the + * software update configuration. + * @member {object} [linux] Linux specific update configuration. + * @member {string} [linux.includedPackageClassifications] Update + * classifications included in the software update configuration. Possible + * values include: 'Unclassified', 'Critical', 'Security', 'Other' + * @member {array} [linux.excludedPackageNameMasks] packages excluded from + * the software update configuration. + * @member {moment.duration} [duration] Maximum time allowed for the software + * update configuration run. Duration needs to be specified using the format + * PT[n]H[n]M[n]S as per ISO8601 + * @member {array} [azureVirtualMachines] List of azure resource Ids for + * azure virtual machines targeted by the software update configuration. + * @member {array} [nonAzureComputerNames] List of names of non-azure + * machines targeted by the software update configuration. + */ + constructor() { + } + + /** + * Defines the metadata of UpdateConfiguration + * + * @returns {object} metadata of UpdateConfiguration + * + */ + mapper() { + return { + required: false, + serializedName: 'updateConfiguration', + type: { + name: 'Composite', + className: 'UpdateConfiguration', + modelProperties: { + operatingSystem: { + required: true, + serializedName: 'operatingSystem', + type: { + name: 'Enum', + allowedValues: [ 'Windows', 'Linux' ] + } + }, + windows: { + required: false, + serializedName: 'windows', + type: { + name: 'Composite', + className: 'WindowsProperties' + } + }, + linux: { + required: false, + serializedName: 'linux', + type: { + name: 'Composite', + className: 'LinuxProperties' + } + }, + duration: { + required: false, + serializedName: 'duration', + type: { + name: 'TimeSpan' + } + }, + azureVirtualMachines: { + required: false, + serializedName: 'azureVirtualMachines', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + nonAzureComputerNames: { + required: false, + serializedName: 'nonAzureComputerNames', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = UpdateConfiguration; diff --git a/lib/services/automationManagement/lib/lib/models/updateConfigurationNavigation.js b/lib/services/automationManagement/lib/lib/models/updateConfigurationNavigation.js new file mode 100644 index 0000000000..0b35837171 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/updateConfigurationNavigation.js @@ -0,0 +1,54 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Software update configuration Run Navigation model. + * + */ +class UpdateConfigurationNavigation { + /** + * Create a UpdateConfigurationNavigation. + * @member {string} [name] Name of the software update configuration + * triggered the software update configuration run + */ + constructor() { + } + + /** + * Defines the metadata of UpdateConfigurationNavigation + * + * @returns {object} metadata of UpdateConfigurationNavigation + * + */ + mapper() { + return { + required: false, + serializedName: 'updateConfigurationNavigation', + type: { + name: 'Composite', + className: 'UpdateConfigurationNavigation', + modelProperties: { + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = UpdateConfigurationNavigation; diff --git a/lib/services/automationManagement/lib/lib/models/usage.js b/lib/services/automationManagement/lib/lib/models/usage.js new file mode 100644 index 0000000000..e3a63db308 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/usage.js @@ -0,0 +1,98 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Definition of Usage. + * + */ +class Usage { + /** + * Create a Usage. + * @member {string} [id] Gets or sets the id of the resource. + * @member {object} [name] Gets or sets the usage counter name. + * @member {string} [name.value] Gets or sets the usage counter name. + * @member {string} [name.localizedValue] Gets or sets the localized usage + * counter name. + * @member {string} [unit] Gets or sets the usage unit name. + * @member {number} [currentValue] Gets or sets the current usage value. + * @member {number} [limit] Gets or sets max limit. -1 for unlimited + * @member {string} [throttleStatus] Gets or sets the throttle status. + */ + constructor() { + } + + /** + * Defines the metadata of Usage + * + * @returns {object} metadata of Usage + * + */ + mapper() { + return { + required: false, + serializedName: 'Usage', + type: { + name: 'Composite', + className: 'Usage', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'Composite', + className: 'UsageCounterName' + } + }, + unit: { + required: false, + serializedName: 'unit', + type: { + name: 'String' + } + }, + currentValue: { + required: false, + serializedName: 'currentValue', + type: { + name: 'Number' + } + }, + limit: { + required: false, + serializedName: 'limit', + type: { + name: 'Number' + } + }, + throttleStatus: { + required: false, + serializedName: 'throttleStatus', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Usage; diff --git a/lib/services/automationManagement/lib/lib/models/usageCounterName.js b/lib/services/automationManagement/lib/lib/models/usageCounterName.js new file mode 100644 index 0000000000..a25fd985fe --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/usageCounterName.js @@ -0,0 +1,61 @@ +/* + * 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'; + +/** + * Definition of usage counter name. + * + */ +class UsageCounterName { + /** + * Create a UsageCounterName. + * @member {string} [value] Gets or sets the usage counter name. + * @member {string} [localizedValue] Gets or sets the localized usage counter + * name. + */ + constructor() { + } + + /** + * Defines the metadata of UsageCounterName + * + * @returns {object} metadata of UsageCounterName + * + */ + mapper() { + return { + required: false, + serializedName: 'UsageCounterName', + type: { + name: 'Composite', + className: 'UsageCounterName', + modelProperties: { + value: { + required: false, + serializedName: 'value', + type: { + name: 'String' + } + }, + localizedValue: { + required: false, + serializedName: 'localizedValue', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = UsageCounterName; diff --git a/lib/services/automationManagement/lib/lib/models/usageListResult.js b/lib/services/automationManagement/lib/lib/models/usageListResult.js new file mode 100644 index 0000000000..e3402f72a7 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/usageListResult.js @@ -0,0 +1,59 @@ +/* + * 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 response model for the get usage operation. + */ +class UsageListResult extends Array { + /** + * Create a UsageListResult. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of UsageListResult + * + * @returns {object} metadata of UsageListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'UsageListResult', + type: { + name: 'Composite', + className: 'UsageListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'UsageElementType', + type: { + name: 'Composite', + className: 'Usage' + } + } + } + } + } + } + }; + } +} + +module.exports = UsageListResult; diff --git a/lib/services/automationManagement/lib/lib/models/variable.js b/lib/services/automationManagement/lib/lib/models/variable.js new file mode 100644 index 0000000000..96a65bf066 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/variable.js @@ -0,0 +1,113 @@ +/* + * 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'); + +/** + * Definition of the varible. + * + * @extends models['ProxyResource'] + */ +class Variable extends models['ProxyResource'] { + /** + * Create a Variable. + * @member {string} [value] Gets or sets the value of the variable. + * @member {boolean} [isEncrypted] Gets or sets the encrypted flag of the + * variable. + * @member {date} [creationTime] Gets or sets the creation time. + * @member {date} [lastModifiedTime] Gets or sets the last modified time. + * @member {string} [description] Gets or sets the description. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Variable + * + * @returns {object} metadata of Variable + * + */ + mapper() { + return { + required: false, + serializedName: 'Variable', + type: { + name: 'Composite', + className: 'Variable', + 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' + } + }, + value: { + required: false, + serializedName: 'properties.value', + type: { + name: 'String' + } + }, + isEncrypted: { + required: false, + serializedName: 'properties.isEncrypted', + type: { + name: 'Boolean' + } + }, + creationTime: { + required: false, + serializedName: 'properties.creationTime', + type: { + name: 'DateTime' + } + }, + lastModifiedTime: { + required: false, + serializedName: 'properties.lastModifiedTime', + type: { + name: 'DateTime' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Variable; diff --git a/lib/services/automationManagement/lib/lib/models/variableCreateOrUpdateParameters.js b/lib/services/automationManagement/lib/lib/models/variableCreateOrUpdateParameters.js new file mode 100644 index 0000000000..bfe89a4928 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/variableCreateOrUpdateParameters.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'; + +/** + * The parameters supplied to the create or update variable operation. + * + */ +class VariableCreateOrUpdateParameters { + /** + * Create a VariableCreateOrUpdateParameters. + * @member {string} name Gets or sets the name of the variable. + * @member {string} [value] Gets or sets the value of the variable. + * @member {string} [description] Gets or sets the description of the + * variable. + * @member {boolean} [isEncrypted] Gets or sets the encrypted flag of the + * variable. + */ + constructor() { + } + + /** + * Defines the metadata of VariableCreateOrUpdateParameters + * + * @returns {object} metadata of VariableCreateOrUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'VariableCreateOrUpdateParameters', + type: { + name: 'Composite', + className: 'VariableCreateOrUpdateParameters', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + value: { + required: false, + serializedName: 'properties.value', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + isEncrypted: { + required: false, + serializedName: 'properties.isEncrypted', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = VariableCreateOrUpdateParameters; diff --git a/lib/services/automationManagement/lib/lib/models/variableListResult.js b/lib/services/automationManagement/lib/lib/models/variableListResult.js new file mode 100644 index 0000000000..4b3e7d5611 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/variableListResult.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'; + +/** + * The response model for the list variables operation. + */ +class VariableListResult extends Array { + /** + * Create a VariableListResult. + * @member {string} [nextLink] Gets or sets the next link. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of VariableListResult + * + * @returns {object} metadata of VariableListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'VariableListResult', + type: { + name: 'Composite', + className: 'VariableListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'VariableElementType', + type: { + name: 'Composite', + className: 'Variable' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VariableListResult; diff --git a/lib/services/automationManagement/lib/lib/models/variableUpdateParameters.js b/lib/services/automationManagement/lib/lib/models/variableUpdateParameters.js new file mode 100644 index 0000000000..d81497a7fe --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/variableUpdateParameters.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'; + +/** + * The parameters supplied to the update variable operation. + * + */ +class VariableUpdateParameters { + /** + * Create a VariableUpdateParameters. + * @member {string} [name] Gets or sets the name of the variable. + * @member {string} [value] Gets or sets the value of the variable. + * @member {string} [description] Gets or sets the description of the + * variable. + */ + constructor() { + } + + /** + * Defines the metadata of VariableUpdateParameters + * + * @returns {object} metadata of VariableUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'VariableUpdateParameters', + type: { + name: 'Composite', + className: 'VariableUpdateParameters', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + value: { + required: false, + serializedName: 'properties.value', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VariableUpdateParameters; diff --git a/lib/services/automationManagement/lib/lib/models/webhook.js b/lib/services/automationManagement/lib/lib/models/webhook.js new file mode 100644 index 0000000000..871b68b080 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/webhook.js @@ -0,0 +1,166 @@ +/* + * 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'); + +/** + * Definition of the webhook type. + * + * @extends models['ProxyResource'] + */ +class Webhook extends models['ProxyResource'] { + /** + * Create a Webhook. + * @member {boolean} [isEnabled] Gets or sets the value of the enabled flag + * of the webhook. Default value: false . + * @member {string} [uri] Gets or sets the webhook uri. + * @member {date} [expiryTime] Gets or sets the expiry time. + * @member {date} [lastInvokedTime] Gets or sets the last invoked time. + * @member {object} [parameters] Gets or sets the parameters of the job that + * is created when the webhook calls the runbook it is associated with. + * @member {object} [runbook] Gets or sets the runbook the webhook is + * associated with. + * @member {string} [runbook.name] Gets or sets the name of the runbook. + * @member {string} [runOn] Gets or sets the name of the hybrid worker group + * the webhook job will run on. + * @member {date} [creationTime] Gets or sets the creation time. + * @member {date} [lastModifiedTime] Gets or sets the last modified time. + * @member {string} [description] Gets or sets the description. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Webhook + * + * @returns {object} metadata of Webhook + * + */ + mapper() { + return { + required: false, + serializedName: 'Webhook', + type: { + name: 'Composite', + className: 'Webhook', + 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' + } + }, + isEnabled: { + required: false, + serializedName: 'properties.isEnabled', + defaultValue: false, + type: { + name: 'Boolean' + } + }, + uri: { + required: false, + serializedName: 'properties.uri', + type: { + name: 'String' + } + }, + expiryTime: { + required: false, + serializedName: 'properties.expiryTime', + type: { + name: 'DateTime' + } + }, + lastInvokedTime: { + required: false, + serializedName: 'properties.lastInvokedTime', + type: { + name: 'DateTime' + } + }, + parameters: { + required: false, + serializedName: 'properties.parameters', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + runbook: { + required: false, + serializedName: 'properties.runbook', + type: { + name: 'Composite', + className: 'RunbookAssociationProperty' + } + }, + runOn: { + required: false, + serializedName: 'properties.runOn', + type: { + name: 'String' + } + }, + creationTime: { + required: false, + serializedName: 'properties.creationTime', + type: { + name: 'DateTime' + } + }, + lastModifiedTime: { + required: false, + serializedName: 'properties.lastModifiedTime', + type: { + name: 'DateTime' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Webhook; diff --git a/lib/services/automationManagement/lib/lib/models/webhookCreateOrUpdateParameters.js b/lib/services/automationManagement/lib/lib/models/webhookCreateOrUpdateParameters.js new file mode 100644 index 0000000000..0025643af8 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/webhookCreateOrUpdateParameters.js @@ -0,0 +1,113 @@ +/* + * 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 parameters supplied to the create or update webhook operation. + * + */ +class WebhookCreateOrUpdateParameters { + /** + * Create a WebhookCreateOrUpdateParameters. + * @member {string} name Gets or sets the name of the webhook. + * @member {boolean} [isEnabled] Gets or sets the value of the enabled flag + * of webhook. + * @member {string} [uri] Gets or sets the uri. + * @member {date} [expiryTime] Gets or sets the expiry time. + * @member {object} [parameters] Gets or sets the parameters of the job. + * @member {object} [runbook] Gets or sets the runbook. + * @member {string} [runbook.name] Gets or sets the name of the runbook. + * @member {string} [runOn] Gets or sets the name of the hybrid worker group + * the webhook job will run on. + */ + constructor() { + } + + /** + * Defines the metadata of WebhookCreateOrUpdateParameters + * + * @returns {object} metadata of WebhookCreateOrUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'WebhookCreateOrUpdateParameters', + type: { + name: 'Composite', + className: 'WebhookCreateOrUpdateParameters', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + isEnabled: { + required: false, + serializedName: 'properties.isEnabled', + type: { + name: 'Boolean' + } + }, + uri: { + required: false, + serializedName: 'properties.uri', + type: { + name: 'String' + } + }, + expiryTime: { + required: false, + serializedName: 'properties.expiryTime', + type: { + name: 'DateTime' + } + }, + parameters: { + required: false, + serializedName: 'properties.parameters', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + runbook: { + required: false, + serializedName: 'properties.runbook', + type: { + name: 'Composite', + className: 'RunbookAssociationProperty' + } + }, + runOn: { + required: false, + serializedName: 'properties.runOn', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = WebhookCreateOrUpdateParameters; diff --git a/lib/services/automationManagement/lib/lib/models/webhookListResult.js b/lib/services/automationManagement/lib/lib/models/webhookListResult.js new file mode 100644 index 0000000000..b47dede5c8 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/webhookListResult.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'; + +/** + * The response model for the list webhook operation. + */ +class WebhookListResult extends Array { + /** + * Create a WebhookListResult. + * @member {string} [nextLink] Gets or sets the next link. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of WebhookListResult + * + * @returns {object} metadata of WebhookListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'WebhookListResult', + type: { + name: 'Composite', + className: 'WebhookListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'WebhookElementType', + type: { + name: 'Composite', + className: 'Webhook' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = WebhookListResult; diff --git a/lib/services/automationManagement/lib/lib/models/webhookUpdateParameters.js b/lib/services/automationManagement/lib/lib/models/webhookUpdateParameters.js new file mode 100644 index 0000000000..99d7772239 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/webhookUpdateParameters.js @@ -0,0 +1,94 @@ +/* + * 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 parameters supplied to the update webhook operation. + * + */ +class WebhookUpdateParameters { + /** + * Create a WebhookUpdateParameters. + * @member {string} [name] Gets or sets the name of the webhook. + * @member {boolean} [isEnabled] Gets or sets the value of the enabled flag + * of webhook. + * @member {string} [runOn] Gets or sets the name of the hybrid worker group + * the webhook job will run on. + * @member {object} [parameters] Gets or sets the parameters of the job. + * @member {string} [description] Gets or sets the description of the + * webhook. + */ + constructor() { + } + + /** + * Defines the metadata of WebhookUpdateParameters + * + * @returns {object} metadata of WebhookUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'WebhookUpdateParameters', + type: { + name: 'Composite', + className: 'WebhookUpdateParameters', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + isEnabled: { + required: false, + serializedName: 'properties.isEnabled', + type: { + name: 'Boolean' + } + }, + runOn: { + required: false, + serializedName: 'properties.runOn', + type: { + name: 'String' + } + }, + parameters: { + required: false, + serializedName: 'properties.parameters', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = WebhookUpdateParameters; diff --git a/lib/services/automationManagement/lib/lib/models/windowsProperties.js b/lib/services/automationManagement/lib/lib/models/windowsProperties.js new file mode 100644 index 0000000000..d58407607d --- /dev/null +++ b/lib/services/automationManagement/lib/lib/models/windowsProperties.js @@ -0,0 +1,72 @@ +/* + * 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'; + +/** + * Windows specific update configuration. + * + */ +class WindowsProperties { + /** + * Create a WindowsProperties. + * @member {string} [includedUpdateClassifications] Update classification + * included in the software update configuration. A comma separated string + * with required values. Possible values include: 'Unclassified', 'Critical', + * 'Security', 'UpdateRollup', 'FeaturePack', 'ServicePack', 'Definition', + * 'Tools', 'Updates' + * @member {array} [excludedKbNumbers] KB numbers excluded from the software + * update configuration. + */ + constructor() { + } + + /** + * Defines the metadata of WindowsProperties + * + * @returns {object} metadata of WindowsProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'WindowsProperties', + type: { + name: 'Composite', + className: 'WindowsProperties', + modelProperties: { + includedUpdateClassifications: { + required: false, + serializedName: 'includedUpdateClassifications', + type: { + name: 'String' + } + }, + excludedKbNumbers: { + required: false, + serializedName: 'excludedKbNumbers', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = WindowsProperties; diff --git a/lib/services/automationManagement/lib/lib/operations/activityOperations.js b/lib/services/automationManagement/lib/lib/operations/activityOperations.js new file mode 100644 index 0000000000..e7697d5ced --- /dev/null +++ b/lib/services/automationManagement/lib/lib/operations/activityOperations.js @@ -0,0 +1,765 @@ +/* + * 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; + +/** + * Retrieve the activity in the module identified by module name and activity + * name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The name of module. + * + * @param {string} activityName The name of activity. + * + * @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 Activity} 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, automationAccountName, moduleName, activityName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (moduleName === null || moduleName === undefined || typeof moduleName.valueOf() !== 'string') { + throw new Error('moduleName cannot be null or undefined and it must be of type string.'); + } + if (activityName === null || activityName === undefined || typeof activityName.valueOf() !== 'string') { + throw new Error('activityName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/activities/{activityName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{moduleName}', encodeURIComponent(moduleName)); + requestUrl = requestUrl.replace('{activityName}', encodeURIComponent(activityName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Activity']().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); + }); +} + +/** + * Retrieve a list of activities in the module identified by module name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The name of module. + * + * @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 ActivityListResult} 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 _listByModule(resourceGroupName, automationAccountName, moduleName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (moduleName === null || moduleName === undefined || typeof moduleName.valueOf() !== 'string') { + throw new Error('moduleName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/activities'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{moduleName}', encodeURIComponent(moduleName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ActivityListResult']().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); + }); +} + +/** + * Retrieve a list of activities in the module identified by module name. + * + * @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 ActivityListResult} 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 _listByModuleNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ActivityListResult']().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 ActivityOperations. */ +class ActivityOperations { + /** + * Create a ActivityOperations. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._listByModule = _listByModule; + this._listByModuleNext = _listByModuleNext; + } + + /** + * Retrieve the activity in the module identified by module name and activity + * name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The name of module. + * + * @param {string} activityName The name of activity. + * + * @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, automationAccountName, moduleName, activityName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, automationAccountName, moduleName, activityName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the activity in the module identified by module name and activity + * name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The name of module. + * + * @param {string} activityName The name of activity. + * + * @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 {Activity} - 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 Activity} 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, automationAccountName, moduleName, activityName, 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, automationAccountName, moduleName, activityName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, automationAccountName, moduleName, activityName, options, optionalCallback); + } + } + + /** + * Retrieve a list of activities in the module identified by module name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The name of module. + * + * @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. + */ + listByModuleWithHttpOperationResponse(resourceGroupName, automationAccountName, moduleName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByModule(resourceGroupName, automationAccountName, moduleName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of activities in the module identified by module name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The name of module. + * + * @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 {ActivityListResult} - 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 ActivityListResult} 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. + */ + listByModule(resourceGroupName, automationAccountName, moduleName, 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._listByModule(resourceGroupName, automationAccountName, moduleName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByModule(resourceGroupName, automationAccountName, moduleName, options, optionalCallback); + } + } + + /** + * Retrieve a list of activities in the module identified by module name. + * + * @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. + */ + listByModuleNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByModuleNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of activities in the module identified by module name. + * + * @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 {ActivityListResult} - 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 ActivityListResult} 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. + */ + listByModuleNext(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._listByModuleNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByModuleNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = ActivityOperations; diff --git a/lib/services/automationManagement/lib/lib/operations/agentRegistrationInformation.js b/lib/services/automationManagement/lib/lib/operations/agentRegistrationInformation.js new file mode 100644 index 0000000000..87214db0dd --- /dev/null +++ b/lib/services/automationManagement/lib/lib/operations/agentRegistrationInformation.js @@ -0,0 +1,578 @@ +/* + * 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; + +/** + * Retrieve the automation agent registration information. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @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 AgentRegistration} 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, automationAccountName, 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 apiVersion = '2018-01-15'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName 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.Automation/automationAccounts/{automationAccountName}/agentRegistrationInformation'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['AgentRegistration']().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); + }); +} + +/** + * Regenerate a primary or secondary agent registration key + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} parameters The name of the agent registration key to be + * regenerated + * + * @param {string} parameters.keyName Gets or sets the agent registration key + * name - primary or secondary. Possible values include: 'primary', 'secondary' + * + * @param {string} [parameters.name] Gets or sets the name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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 AgentRegistration} 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 _regenerateKey(resourceGroupName, automationAccountName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2018-01-15'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters 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.Automation/automationAccounts/{automationAccountName}/agentRegistrationInformation/regenerateKey'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['AgentRegistrationRegenerateKeyParameter']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['AgentRegistration']().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 AgentRegistrationInformation. */ +class AgentRegistrationInformation { + /** + * Create a AgentRegistrationInformation. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._regenerateKey = _regenerateKey; + } + + /** + * Retrieve the automation agent registration information. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @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, automationAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the automation agent registration information. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @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 {AgentRegistration} - 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 AgentRegistration} 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, automationAccountName, 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, automationAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, automationAccountName, options, optionalCallback); + } + } + + /** + * Regenerate a primary or secondary agent registration key + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} parameters The name of the agent registration key to be + * regenerated + * + * @param {string} parameters.keyName Gets or sets the agent registration key + * name - primary or secondary. Possible values include: 'primary', 'secondary' + * + * @param {string} [parameters.name] Gets or sets the name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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. + */ + regenerateKeyWithHttpOperationResponse(resourceGroupName, automationAccountName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._regenerateKey(resourceGroupName, automationAccountName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Regenerate a primary or secondary agent registration key + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} parameters The name of the agent registration key to be + * regenerated + * + * @param {string} parameters.keyName Gets or sets the agent registration key + * name - primary or secondary. Possible values include: 'primary', 'secondary' + * + * @param {string} [parameters.name] Gets or sets the name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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 {AgentRegistration} - 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 AgentRegistration} 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. + */ + regenerateKey(resourceGroupName, automationAccountName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._regenerateKey(resourceGroupName, automationAccountName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._regenerateKey(resourceGroupName, automationAccountName, parameters, options, optionalCallback); + } + } + +} + +module.exports = AgentRegistrationInformation; diff --git a/lib/services/automationManagement/lib/lib/operations/automationAccountOperations.js b/lib/services/automationManagement/lib/lib/operations/automationAccountOperations.js new file mode 100644 index 0000000000..a35d725c5a --- /dev/null +++ b/lib/services/automationManagement/lib/lib/operations/automationAccountOperations.js @@ -0,0 +1,2016 @@ +/* + * 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; + +/** + * Update an automation account. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} automationAccountName Automation account name. + * + * @param {object} parameters Parameters supplied to the update automation + * account. + * + * @param {object} [parameters.sku] Gets or sets account SKU. + * + * @param {string} parameters.sku.name Gets or sets the SKU name of the + * account. Possible values include: 'Free', 'Basic' + * + * @param {string} [parameters.sku.family] Gets or sets the SKU family. + * + * @param {number} [parameters.sku.capacity] Gets or sets the SKU capacity. + * + * @param {string} [parameters.name] Gets or sets the name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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 AutomationAccount} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, automationAccountName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['AutomationAccountUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['AutomationAccount']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Create or update automation account. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} automationAccountName Parameters supplied to the create or + * update automation account. + * + * @param {object} parameters Parameters supplied to the create or update + * automation account. + * + * @param {object} [parameters.sku] Gets or sets account SKU. + * + * @param {string} parameters.sku.name Gets or sets the SKU name of the + * account. Possible values include: 'Free', 'Basic' + * + * @param {string} [parameters.sku.family] Gets or sets the SKU family. + * + * @param {number} [parameters.sku.capacity] Gets or sets the SKU capacity. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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 AutomationAccount} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, automationAccountName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['AutomationAccountCreateOrUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['AutomationAccount']().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['AutomationAccount']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Delete an automation account. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} automationAccountName Automation account 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. + * + * {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, automationAccountName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Get information about an Automation Account. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} automationAccountName The automation account 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 AutomationAccount} 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, automationAccountName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['AutomationAccount']().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); + }); +} + +/** + * Retrieve a list of accounts within a given resource group. + * + * @param {string} resourceGroupName The 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 AutomationAccountListResult} 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.'); + } + let apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['AutomationAccountListResult']().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 the Automation Accounts within an Azure subscription. + * + * Retrieve a list of accounts within a given subscription. + * + * @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 AutomationAccountListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2015-10-31'; + // 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.Automation/automationAccounts'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['AutomationAccountListResult']().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); + }); +} + +/** + * Retrieve a list of accounts within a given resource group. + * + * @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 AutomationAccountListResult} 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['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['AutomationAccountListResult']().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 the Automation Accounts within an Azure subscription. + * + * Retrieve a list of accounts within a given subscription. + * + * @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 AutomationAccountListResult} 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['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['AutomationAccountListResult']().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 AutomationAccountOperations. */ +class AutomationAccountOperations { + /** + * Create a AutomationAccountOperations. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._update = _update; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._listByResourceGroup = _listByResourceGroup; + this._list = _list; + this._listByResourceGroupNext = _listByResourceGroupNext; + this._listNext = _listNext; + } + + /** + * Update an automation account. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} automationAccountName Automation account name. + * + * @param {object} parameters Parameters supplied to the update automation + * account. + * + * @param {object} [parameters.sku] Gets or sets account SKU. + * + * @param {string} parameters.sku.name Gets or sets the SKU name of the + * account. Possible values include: 'Free', 'Basic' + * + * @param {string} [parameters.sku.family] Gets or sets the SKU family. + * + * @param {number} [parameters.sku.capacity] Gets or sets the SKU capacity. + * + * @param {string} [parameters.name] Gets or sets the name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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. + */ + updateWithHttpOperationResponse(resourceGroupName, automationAccountName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, automationAccountName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Update an automation account. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} automationAccountName Automation account name. + * + * @param {object} parameters Parameters supplied to the update automation + * account. + * + * @param {object} [parameters.sku] Gets or sets account SKU. + * + * @param {string} parameters.sku.name Gets or sets the SKU name of the + * account. Possible values include: 'Free', 'Basic' + * + * @param {string} [parameters.sku.family] Gets or sets the SKU family. + * + * @param {number} [parameters.sku.capacity] Gets or sets the SKU capacity. + * + * @param {string} [parameters.name] Gets or sets the name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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 {AutomationAccount} - 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 AutomationAccount} 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. + */ + update(resourceGroupName, automationAccountName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, automationAccountName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, automationAccountName, parameters, options, optionalCallback); + } + } + + /** + * Create or update automation account. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} automationAccountName Parameters supplied to the create or + * update automation account. + * + * @param {object} parameters Parameters supplied to the create or update + * automation account. + * + * @param {object} [parameters.sku] Gets or sets account SKU. + * + * @param {string} parameters.sku.name Gets or sets the SKU name of the + * account. Possible values include: 'Free', 'Basic' + * + * @param {string} [parameters.sku.family] Gets or sets the SKU family. + * + * @param {number} [parameters.sku.capacity] Gets or sets the SKU capacity. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, automationAccountName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, automationAccountName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create or update automation account. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} automationAccountName Parameters supplied to the create or + * update automation account. + * + * @param {object} parameters Parameters supplied to the create or update + * automation account. + * + * @param {object} [parameters.sku] Gets or sets account SKU. + * + * @param {string} parameters.sku.name Gets or sets the SKU name of the + * account. Possible values include: 'Free', 'Basic' + * + * @param {string} [parameters.sku.family] Gets or sets the SKU family. + * + * @param {number} [parameters.sku.capacity] Gets or sets the SKU capacity. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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 {AutomationAccount} - 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 AutomationAccount} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, automationAccountName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, automationAccountName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, automationAccountName, parameters, options, optionalCallback); + } + } + + /** + * Delete an automation account. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} automationAccountName Automation account 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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, automationAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete an automation account. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} automationAccountName Automation account 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 {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, automationAccountName, 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, automationAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, automationAccountName, options, optionalCallback); + } + } + + /** + * Get information about an Automation Account. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} automationAccountName The automation account 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. + */ + getWithHttpOperationResponse(resourceGroupName, automationAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get information about an Automation Account. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} automationAccountName The automation account 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 {AutomationAccount} - 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 AutomationAccount} 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, automationAccountName, 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, automationAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, automationAccountName, options, optionalCallback); + } + } + + /** + * Retrieve a list of accounts within a given resource group. + * + * @param {string} resourceGroupName The 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; + }); + }); + } + + /** + * Retrieve a list of accounts within a given resource group. + * + * @param {string} resourceGroupName The 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 {AutomationAccountListResult} - 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 AutomationAccountListResult} 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 Lists the Automation Accounts within an Azure subscription. + * + * Retrieve a list of accounts within a given subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - 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 the Automation Accounts within an Azure subscription. + * + * Retrieve a list of accounts within a given subscription. + * + * @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 {AutomationAccountListResult} - 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 AutomationAccountListResult} 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); + } + } + + /** + * Retrieve a list of accounts within a given resource group. + * + * @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; + }); + }); + } + + /** + * Retrieve a list of accounts within a given resource group. + * + * @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 {AutomationAccountListResult} - 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 AutomationAccountListResult} 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 Lists the Automation Accounts within an Azure subscription. + * + * Retrieve a list of accounts within a given subscription. + * + * @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 the Automation Accounts within an Azure subscription. + * + * Retrieve a list of accounts within a given subscription. + * + * @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 {AutomationAccountListResult} - 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 AutomationAccountListResult} 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 = AutomationAccountOperations; diff --git a/lib/services/automationManagement/lib/lib/operations/certificateOperations.js b/lib/services/automationManagement/lib/lib/operations/certificateOperations.js new file mode 100644 index 0000000000..af935dabdb --- /dev/null +++ b/lib/services/automationManagement/lib/lib/operations/certificateOperations.js @@ -0,0 +1,1620 @@ +/* + * 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; + +/** + * Delete the certificate. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} certificateName The name of certificate. + * + * @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, automationAccountName, certificateName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (certificateName === null || certificateName === undefined || typeof certificateName.valueOf() !== 'string') { + throw new Error('certificateName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{certificateName}', encodeURIComponent(certificateName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Retrieve the certificate identified by certificate name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} certificateName The name of certificate. + * + * @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 Certificate} 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, automationAccountName, certificateName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (certificateName === null || certificateName === undefined || typeof certificateName.valueOf() !== 'string') { + throw new Error('certificateName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{certificateName}', encodeURIComponent(certificateName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Certificate']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Create a certificate. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} certificateName The parameters supplied to the create or + * update certificate operation. + * + * @param {object} parameters The parameters supplied to the create or update + * certificate operation. + * + * @param {string} parameters.name Gets or sets the name of the certificate. + * + * @param {string} parameters.base64Value Gets or sets the base64 encoded value + * of the certificate. + * + * @param {string} [parameters.description] Gets or sets the description of the + * certificate. + * + * @param {string} [parameters.thumbprint] Gets or sets the thumbprint of the + * certificate. + * + * @param {boolean} [parameters.isExportable] Gets or sets the is exportable + * flag of the certificate. + * + * @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 Certificate} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, automationAccountName, certificateName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (certificateName === null || certificateName === undefined || typeof certificateName.valueOf() !== 'string') { + throw new Error('certificateName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{certificateName}', encodeURIComponent(certificateName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['CertificateCreateOrUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Certificate']().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['Certificate']().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); + }); +} + +/** + * Update a certificate. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} certificateName The parameters supplied to the update + * certificate operation. + * + * @param {object} parameters The parameters supplied to the update certificate + * operation. + * + * @param {string} [parameters.name] Gets or sets the name of the certificate. + * + * @param {string} [parameters.description] Gets or sets the description of the + * certificate. + * + * @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 Certificate} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, automationAccountName, certificateName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (certificateName === null || certificateName === undefined || typeof certificateName.valueOf() !== 'string') { + throw new Error('certificateName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{certificateName}', encodeURIComponent(certificateName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['CertificateUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Certificate']().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); + }); +} + +/** + * Retrieve a list of certificates. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 CertificateListResult} 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 _listByAutomationAccount(resourceGroupName, automationAccountName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['CertificateListResult']().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); + }); +} + +/** + * Retrieve a list of certificates. + * + * @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 CertificateListResult} 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 _listByAutomationAccountNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['CertificateListResult']().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 CertificateOperations. */ +class CertificateOperations { + /** + * Create a CertificateOperations. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._update = _update; + this._listByAutomationAccount = _listByAutomationAccount; + this._listByAutomationAccountNext = _listByAutomationAccountNext; + } + + /** + * Delete the certificate. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} certificateName The name of certificate. + * + * @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, automationAccountName, certificateName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, automationAccountName, certificateName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete the certificate. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} certificateName The name of certificate. + * + * @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, automationAccountName, certificateName, 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, automationAccountName, certificateName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, automationAccountName, certificateName, options, optionalCallback); + } + } + + /** + * Retrieve the certificate identified by certificate name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} certificateName The name of certificate. + * + * @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, automationAccountName, certificateName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, automationAccountName, certificateName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the certificate identified by certificate name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} certificateName The name of certificate. + * + * @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 {Certificate} - 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 Certificate} 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, automationAccountName, certificateName, 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, automationAccountName, certificateName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, automationAccountName, certificateName, options, optionalCallback); + } + } + + /** + * Create a certificate. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} certificateName The parameters supplied to the create or + * update certificate operation. + * + * @param {object} parameters The parameters supplied to the create or update + * certificate operation. + * + * @param {string} parameters.name Gets or sets the name of the certificate. + * + * @param {string} parameters.base64Value Gets or sets the base64 encoded value + * of the certificate. + * + * @param {string} [parameters.description] Gets or sets the description of the + * certificate. + * + * @param {string} [parameters.thumbprint] Gets or sets the thumbprint of the + * certificate. + * + * @param {boolean} [parameters.isExportable] Gets or sets the is exportable + * flag of the certificate. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, automationAccountName, certificateName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, automationAccountName, certificateName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create a certificate. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} certificateName The parameters supplied to the create or + * update certificate operation. + * + * @param {object} parameters The parameters supplied to the create or update + * certificate operation. + * + * @param {string} parameters.name Gets or sets the name of the certificate. + * + * @param {string} parameters.base64Value Gets or sets the base64 encoded value + * of the certificate. + * + * @param {string} [parameters.description] Gets or sets the description of the + * certificate. + * + * @param {string} [parameters.thumbprint] Gets or sets the thumbprint of the + * certificate. + * + * @param {boolean} [parameters.isExportable] Gets or sets the is exportable + * flag of the certificate. + * + * @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 {Certificate} - 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 Certificate} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, automationAccountName, certificateName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, automationAccountName, certificateName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, automationAccountName, certificateName, parameters, options, optionalCallback); + } + } + + /** + * Update a certificate. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} certificateName The parameters supplied to the update + * certificate operation. + * + * @param {object} parameters The parameters supplied to the update certificate + * operation. + * + * @param {string} [parameters.name] Gets or sets the name of the certificate. + * + * @param {string} [parameters.description] Gets or sets the description of the + * certificate. + * + * @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. + */ + updateWithHttpOperationResponse(resourceGroupName, automationAccountName, certificateName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, automationAccountName, certificateName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Update a certificate. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} certificateName The parameters supplied to the update + * certificate operation. + * + * @param {object} parameters The parameters supplied to the update certificate + * operation. + * + * @param {string} [parameters.name] Gets or sets the name of the certificate. + * + * @param {string} [parameters.description] Gets or sets the description of the + * certificate. + * + * @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 {Certificate} - 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 Certificate} 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. + */ + update(resourceGroupName, automationAccountName, certificateName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, automationAccountName, certificateName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, automationAccountName, certificateName, parameters, options, optionalCallback); + } + } + + /** + * Retrieve a list of certificates. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName, automationAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of certificates. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 {CertificateListResult} - 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 CertificateListResult} 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. + */ + listByAutomationAccount(resourceGroupName, automationAccountName, 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._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccount(resourceGroupName, automationAccountName, options, optionalCallback); + } + } + + /** + * Retrieve a list of certificates. + * + * @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. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccountNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of certificates. + * + * @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 {CertificateListResult} - 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 CertificateListResult} 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. + */ + listByAutomationAccountNext(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._listByAutomationAccountNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccountNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = CertificateOperations; diff --git a/lib/services/automationManagement/lib/lib/operations/connectionOperations.js b/lib/services/automationManagement/lib/lib/operations/connectionOperations.js new file mode 100644 index 0000000000..b6cdfdb030 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/operations/connectionOperations.js @@ -0,0 +1,1648 @@ +/* + * 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; + +/** + * Delete the connection. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} connectionName The name of connection. + * + * @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 Connection} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, automationAccountName, connectionName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (connectionName === null || connectionName === undefined || typeof connectionName.valueOf() !== 'string') { + throw new Error('connectionName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{connectionName}', encodeURIComponent(connectionName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Connection']().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); + }); +} + +/** + * Retrieve the connection identified by connection name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} connectionName The name of connection. + * + * @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 Connection} 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, automationAccountName, connectionName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (connectionName === null || connectionName === undefined || typeof connectionName.valueOf() !== 'string') { + throw new Error('connectionName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{connectionName}', encodeURIComponent(connectionName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Connection']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Create or update a connection. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} connectionName The parameters supplied to the create or + * update connection operation. + * + * @param {object} parameters The parameters supplied to the create or update + * connection operation. + * + * @param {string} parameters.name Gets or sets the name of the connection. + * + * @param {string} [parameters.description] Gets or sets the description of the + * connection. + * + * @param {object} parameters.connectionType Gets or sets the connectionType of + * the connection. + * + * @param {string} [parameters.connectionType.name] Gets or sets the name of + * the connection type. + * + * @param {object} [parameters.fieldDefinitionValues] Gets or sets the field + * definition properties of the connection. + * + * @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 Connection} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, automationAccountName, connectionName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (connectionName === null || connectionName === undefined || typeof connectionName.valueOf() !== 'string') { + throw new Error('connectionName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{connectionName}', encodeURIComponent(connectionName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['ConnectionCreateOrUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Connection']().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['Connection']().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); + }); +} + +/** + * Update a connection. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} connectionName The parameters supplied to the update a + * connection operation. + * + * @param {object} parameters The parameters supplied to the update a + * connection operation. + * + * @param {string} [parameters.name] Gets or sets the name of the connection. + * + * @param {string} [parameters.description] Gets or sets the description of the + * connection. + * + * @param {object} [parameters.fieldDefinitionValues] Gets or sets the field + * definition values of the connection. + * + * @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 Connection} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, automationAccountName, connectionName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (connectionName === null || connectionName === undefined || typeof connectionName.valueOf() !== 'string') { + throw new Error('connectionName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{connectionName}', encodeURIComponent(connectionName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['ConnectionUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Connection']().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); + }); +} + +/** + * Retrieve a list of connections. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 ConnectionListResult} 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 _listByAutomationAccount(resourceGroupName, automationAccountName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ConnectionListResult']().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); + }); +} + +/** + * Retrieve a list of connections. + * + * @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 ConnectionListResult} 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 _listByAutomationAccountNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ConnectionListResult']().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 ConnectionOperations. */ +class ConnectionOperations { + /** + * Create a ConnectionOperations. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._update = _update; + this._listByAutomationAccount = _listByAutomationAccount; + this._listByAutomationAccountNext = _listByAutomationAccountNext; + } + + /** + * Delete the connection. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} connectionName The name of connection. + * + * @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, automationAccountName, connectionName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, automationAccountName, connectionName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete the connection. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} connectionName The name of connection. + * + * @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 {Connection} - 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 Connection} 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. + */ + deleteMethod(resourceGroupName, automationAccountName, connectionName, 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, automationAccountName, connectionName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, automationAccountName, connectionName, options, optionalCallback); + } + } + + /** + * Retrieve the connection identified by connection name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} connectionName The name of connection. + * + * @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, automationAccountName, connectionName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, automationAccountName, connectionName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the connection identified by connection name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} connectionName The name of connection. + * + * @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 {Connection} - 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 Connection} 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, automationAccountName, connectionName, 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, automationAccountName, connectionName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, automationAccountName, connectionName, options, optionalCallback); + } + } + + /** + * Create or update a connection. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} connectionName The parameters supplied to the create or + * update connection operation. + * + * @param {object} parameters The parameters supplied to the create or update + * connection operation. + * + * @param {string} parameters.name Gets or sets the name of the connection. + * + * @param {string} [parameters.description] Gets or sets the description of the + * connection. + * + * @param {object} parameters.connectionType Gets or sets the connectionType of + * the connection. + * + * @param {string} [parameters.connectionType.name] Gets or sets the name of + * the connection type. + * + * @param {object} [parameters.fieldDefinitionValues] Gets or sets the field + * definition properties of the connection. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, automationAccountName, connectionName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, automationAccountName, connectionName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create or update a connection. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} connectionName The parameters supplied to the create or + * update connection operation. + * + * @param {object} parameters The parameters supplied to the create or update + * connection operation. + * + * @param {string} parameters.name Gets or sets the name of the connection. + * + * @param {string} [parameters.description] Gets or sets the description of the + * connection. + * + * @param {object} parameters.connectionType Gets or sets the connectionType of + * the connection. + * + * @param {string} [parameters.connectionType.name] Gets or sets the name of + * the connection type. + * + * @param {object} [parameters.fieldDefinitionValues] Gets or sets the field + * definition properties of the connection. + * + * @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 {Connection} - 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 Connection} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, automationAccountName, connectionName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, automationAccountName, connectionName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, automationAccountName, connectionName, parameters, options, optionalCallback); + } + } + + /** + * Update a connection. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} connectionName The parameters supplied to the update a + * connection operation. + * + * @param {object} parameters The parameters supplied to the update a + * connection operation. + * + * @param {string} [parameters.name] Gets or sets the name of the connection. + * + * @param {string} [parameters.description] Gets or sets the description of the + * connection. + * + * @param {object} [parameters.fieldDefinitionValues] Gets or sets the field + * definition values of the connection. + * + * @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. + */ + updateWithHttpOperationResponse(resourceGroupName, automationAccountName, connectionName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, automationAccountName, connectionName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Update a connection. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} connectionName The parameters supplied to the update a + * connection operation. + * + * @param {object} parameters The parameters supplied to the update a + * connection operation. + * + * @param {string} [parameters.name] Gets or sets the name of the connection. + * + * @param {string} [parameters.description] Gets or sets the description of the + * connection. + * + * @param {object} [parameters.fieldDefinitionValues] Gets or sets the field + * definition values of the connection. + * + * @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 {Connection} - 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 Connection} 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. + */ + update(resourceGroupName, automationAccountName, connectionName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, automationAccountName, connectionName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, automationAccountName, connectionName, parameters, options, optionalCallback); + } + } + + /** + * Retrieve a list of connections. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName, automationAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of connections. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 {ConnectionListResult} - 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 ConnectionListResult} 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. + */ + listByAutomationAccount(resourceGroupName, automationAccountName, 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._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccount(resourceGroupName, automationAccountName, options, optionalCallback); + } + } + + /** + * Retrieve a list of connections. + * + * @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. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccountNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of connections. + * + * @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 {ConnectionListResult} - 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 ConnectionListResult} 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. + */ + listByAutomationAccountNext(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._listByAutomationAccountNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccountNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = ConnectionOperations; diff --git a/lib/services/automationManagement/lib/lib/operations/connectionTypeOperations.js b/lib/services/automationManagement/lib/lib/operations/connectionTypeOperations.js new file mode 100644 index 0000000000..fdd1e9fedb --- /dev/null +++ b/lib/services/automationManagement/lib/lib/operations/connectionTypeOperations.js @@ -0,0 +1,1310 @@ +/* + * 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; + +/** + * Delete the connectiontype. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} connectionTypeName The name of connectiontype. + * + * @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, automationAccountName, connectionTypeName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (connectionTypeName === null || connectionTypeName === undefined || typeof connectionTypeName.valueOf() !== 'string') { + throw new Error('connectionTypeName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connectionTypes/{connectionTypeName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{connectionTypeName}', encodeURIComponent(connectionTypeName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Retrieve the connectiontype identified by connectiontype name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} connectionTypeName The name of connectiontype. + * + * @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 ConnectionType} 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, automationAccountName, connectionTypeName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (connectionTypeName === null || connectionTypeName === undefined || typeof connectionTypeName.valueOf() !== 'string') { + throw new Error('connectionTypeName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connectionTypes/{connectionTypeName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{connectionTypeName}', encodeURIComponent(connectionTypeName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ConnectionType']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Create a connectiontype. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} connectionTypeName The parameters supplied to the create or + * update connectiontype operation. + * + * @param {object} parameters The parameters supplied to the create or update + * connectiontype operation. + * + * @param {string} parameters.name Gets or sets the name of the connection + * type. + * + * @param {boolean} [parameters.isGlobal] Gets or sets a Boolean value to + * indicate if the connection type is global. + * + * @param {object} parameters.fieldDefinitions Gets or sets the field + * definitions of the connection type. + * + * @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 ConnectionType} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, automationAccountName, connectionTypeName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (connectionTypeName === null || connectionTypeName === undefined || typeof connectionTypeName.valueOf() !== 'string') { + throw new Error('connectionTypeName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connectionTypes/{connectionTypeName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{connectionTypeName}', encodeURIComponent(connectionTypeName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['ConnectionTypeCreateOrUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 201 && statusCode !== 409) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ConnectionType']().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 === 409) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ConnectionType']().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); + }); +} + +/** + * Retrieve a list of connectiontypes. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 ConnectionTypeListResult} 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 _listByAutomationAccount(resourceGroupName, automationAccountName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connectionTypes'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ConnectionTypeListResult']().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); + }); +} + +/** + * Retrieve a list of connectiontypes. + * + * @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 ConnectionTypeListResult} 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 _listByAutomationAccountNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ConnectionTypeListResult']().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 ConnectionTypeOperations. */ +class ConnectionTypeOperations { + /** + * Create a ConnectionTypeOperations. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._listByAutomationAccount = _listByAutomationAccount; + this._listByAutomationAccountNext = _listByAutomationAccountNext; + } + + /** + * Delete the connectiontype. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} connectionTypeName The name of connectiontype. + * + * @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, automationAccountName, connectionTypeName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, automationAccountName, connectionTypeName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete the connectiontype. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} connectionTypeName The name of connectiontype. + * + * @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, automationAccountName, connectionTypeName, 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, automationAccountName, connectionTypeName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, automationAccountName, connectionTypeName, options, optionalCallback); + } + } + + /** + * Retrieve the connectiontype identified by connectiontype name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} connectionTypeName The name of connectiontype. + * + * @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, automationAccountName, connectionTypeName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, automationAccountName, connectionTypeName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the connectiontype identified by connectiontype name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} connectionTypeName The name of connectiontype. + * + * @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 {ConnectionType} - 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 ConnectionType} 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, automationAccountName, connectionTypeName, 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, automationAccountName, connectionTypeName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, automationAccountName, connectionTypeName, options, optionalCallback); + } + } + + /** + * Create a connectiontype. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} connectionTypeName The parameters supplied to the create or + * update connectiontype operation. + * + * @param {object} parameters The parameters supplied to the create or update + * connectiontype operation. + * + * @param {string} parameters.name Gets or sets the name of the connection + * type. + * + * @param {boolean} [parameters.isGlobal] Gets or sets a Boolean value to + * indicate if the connection type is global. + * + * @param {object} parameters.fieldDefinitions Gets or sets the field + * definitions of the connection type. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, automationAccountName, connectionTypeName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, automationAccountName, connectionTypeName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create a connectiontype. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} connectionTypeName The parameters supplied to the create or + * update connectiontype operation. + * + * @param {object} parameters The parameters supplied to the create or update + * connectiontype operation. + * + * @param {string} parameters.name Gets or sets the name of the connection + * type. + * + * @param {boolean} [parameters.isGlobal] Gets or sets a Boolean value to + * indicate if the connection type is global. + * + * @param {object} parameters.fieldDefinitions Gets or sets the field + * definitions of the connection type. + * + * @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 {ConnectionType} - 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 ConnectionType} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, automationAccountName, connectionTypeName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, automationAccountName, connectionTypeName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, automationAccountName, connectionTypeName, parameters, options, optionalCallback); + } + } + + /** + * Retrieve a list of connectiontypes. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName, automationAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of connectiontypes. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 {ConnectionTypeListResult} - 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 ConnectionTypeListResult} 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. + */ + listByAutomationAccount(resourceGroupName, automationAccountName, 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._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccount(resourceGroupName, automationAccountName, options, optionalCallback); + } + } + + /** + * Retrieve a list of connectiontypes. + * + * @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. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccountNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of connectiontypes. + * + * @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 {ConnectionTypeListResult} - 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 ConnectionTypeListResult} 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. + */ + listByAutomationAccountNext(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._listByAutomationAccountNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccountNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = ConnectionTypeOperations; diff --git a/lib/services/automationManagement/lib/lib/operations/credentialOperations.js b/lib/services/automationManagement/lib/lib/operations/credentialOperations.js new file mode 100644 index 0000000000..f617c56f0b --- /dev/null +++ b/lib/services/automationManagement/lib/lib/operations/credentialOperations.js @@ -0,0 +1,1627 @@ +/* + * 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; + +/** + * Delete the credential. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} credentialName The name of credential. + * + * @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, automationAccountName, credentialName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (credentialName === null || credentialName === undefined || typeof credentialName.valueOf() !== 'string') { + throw new Error('credentialName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{credentialName}', encodeURIComponent(credentialName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Retrieve the credential identified by credential name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} credentialName The name of credential. + * + * @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 Credential} 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, automationAccountName, credentialName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (credentialName === null || credentialName === undefined || typeof credentialName.valueOf() !== 'string') { + throw new Error('credentialName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{credentialName}', encodeURIComponent(credentialName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Credential']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Create a credential. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} credentialName The parameters supplied to the create or + * update credential operation. + * + * @param {object} parameters The parameters supplied to the create or update + * credential operation. + * + * @param {string} parameters.name Gets or sets the name of the credential. + * + * @param {string} parameters.userName Gets or sets the user name of the + * credential. + * + * @param {string} parameters.password Gets or sets the password of the + * credential. + * + * @param {string} [parameters.description] Gets or sets the description of the + * credential. + * + * @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 Credential} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, automationAccountName, credentialName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (credentialName === null || credentialName === undefined || typeof credentialName.valueOf() !== 'string') { + throw new Error('credentialName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{credentialName}', encodeURIComponent(credentialName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['CredentialCreateOrUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Credential']().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['Credential']().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); + }); +} + +/** + * Update a credential. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} credentialName The parameters supplied to the Update + * credential operation. + * + * @param {object} parameters The parameters supplied to the Update credential + * operation. + * + * @param {string} [parameters.name] Gets or sets the name of the credential. + * + * @param {string} [parameters.userName] Gets or sets the user name of the + * credential. + * + * @param {string} [parameters.password] Gets or sets the password of the + * credential. + * + * @param {string} [parameters.description] Gets or sets the description of the + * credential. + * + * @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 Credential} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, automationAccountName, credentialName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (credentialName === null || credentialName === undefined || typeof credentialName.valueOf() !== 'string') { + throw new Error('credentialName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{credentialName}', encodeURIComponent(credentialName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['CredentialUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Credential']().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); + }); +} + +/** + * Retrieve a list of credentials. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 CredentialListResult} 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 _listByAutomationAccount(resourceGroupName, automationAccountName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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['CredentialListResult']().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); + }); +} + +/** + * Retrieve a list of credentials. + * + * @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 CredentialListResult} 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 _listByAutomationAccountNext(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['CredentialListResult']().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 CredentialOperations. */ +class CredentialOperations { + /** + * Create a CredentialOperations. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._update = _update; + this._listByAutomationAccount = _listByAutomationAccount; + this._listByAutomationAccountNext = _listByAutomationAccountNext; + } + + /** + * Delete the credential. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} credentialName The name of credential. + * + * @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, automationAccountName, credentialName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, automationAccountName, credentialName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete the credential. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} credentialName The name of credential. + * + * @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, automationAccountName, credentialName, 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, automationAccountName, credentialName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, automationAccountName, credentialName, options, optionalCallback); + } + } + + /** + * Retrieve the credential identified by credential name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} credentialName The name of credential. + * + * @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, automationAccountName, credentialName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, automationAccountName, credentialName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the credential identified by credential name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} credentialName The name of credential. + * + * @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 {Credential} - 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 Credential} 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, automationAccountName, credentialName, 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, automationAccountName, credentialName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, automationAccountName, credentialName, options, optionalCallback); + } + } + + /** + * Create a credential. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} credentialName The parameters supplied to the create or + * update credential operation. + * + * @param {object} parameters The parameters supplied to the create or update + * credential operation. + * + * @param {string} parameters.name Gets or sets the name of the credential. + * + * @param {string} parameters.userName Gets or sets the user name of the + * credential. + * + * @param {string} parameters.password Gets or sets the password of the + * credential. + * + * @param {string} [parameters.description] Gets or sets the description of the + * credential. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, automationAccountName, credentialName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, automationAccountName, credentialName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create a credential. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} credentialName The parameters supplied to the create or + * update credential operation. + * + * @param {object} parameters The parameters supplied to the create or update + * credential operation. + * + * @param {string} parameters.name Gets or sets the name of the credential. + * + * @param {string} parameters.userName Gets or sets the user name of the + * credential. + * + * @param {string} parameters.password Gets or sets the password of the + * credential. + * + * @param {string} [parameters.description] Gets or sets the description of the + * credential. + * + * @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 {Credential} - 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 Credential} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, automationAccountName, credentialName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, automationAccountName, credentialName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, automationAccountName, credentialName, parameters, options, optionalCallback); + } + } + + /** + * Update a credential. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} credentialName The parameters supplied to the Update + * credential operation. + * + * @param {object} parameters The parameters supplied to the Update credential + * operation. + * + * @param {string} [parameters.name] Gets or sets the name of the credential. + * + * @param {string} [parameters.userName] Gets or sets the user name of the + * credential. + * + * @param {string} [parameters.password] Gets or sets the password of the + * credential. + * + * @param {string} [parameters.description] Gets or sets the description of the + * credential. + * + * @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. + */ + updateWithHttpOperationResponse(resourceGroupName, automationAccountName, credentialName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, automationAccountName, credentialName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Update a credential. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} credentialName The parameters supplied to the Update + * credential operation. + * + * @param {object} parameters The parameters supplied to the Update credential + * operation. + * + * @param {string} [parameters.name] Gets or sets the name of the credential. + * + * @param {string} [parameters.userName] Gets or sets the user name of the + * credential. + * + * @param {string} [parameters.password] Gets or sets the password of the + * credential. + * + * @param {string} [parameters.description] Gets or sets the description of the + * credential. + * + * @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 {Credential} - 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 Credential} 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. + */ + update(resourceGroupName, automationAccountName, credentialName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, automationAccountName, credentialName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, automationAccountName, credentialName, parameters, options, optionalCallback); + } + } + + /** + * Retrieve a list of credentials. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName, automationAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of credentials. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 {CredentialListResult} - 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 CredentialListResult} 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. + */ + listByAutomationAccount(resourceGroupName, automationAccountName, 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._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccount(resourceGroupName, automationAccountName, options, optionalCallback); + } + } + + /** + * Retrieve a list of credentials. + * + * @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. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccountNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of credentials. + * + * @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 {CredentialListResult} - 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 CredentialListResult} 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. + */ + listByAutomationAccountNext(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._listByAutomationAccountNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccountNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = CredentialOperations; diff --git a/lib/services/automationManagement/lib/lib/operations/dscCompilationJobOperations.js b/lib/services/automationManagement/lib/lib/operations/dscCompilationJobOperations.js new file mode 100644 index 0000000000..d89ef1d387 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/operations/dscCompilationJobOperations.js @@ -0,0 +1,1599 @@ +/* + * 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; + + +/** + * Creates the Dsc compilation job of the configuration. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} compilationJobName The the DSC configuration Id. + * + * @param {object} parameters The parameters supplied to the create compilation + * job operation. + * + * @param {object} parameters.configuration Gets or sets the configuration. + * + * @param {string} [parameters.configuration.name] Gets or sets the name of the + * Dsc configuration. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * job. + * + * @param {boolean} [parameters.newNodeConfigurationBuildVersionRequired] If a + * new build version of NodeConfiguration is required. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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 DscCompilationJob} 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, automationAccountName, compilationJobName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreate(resourceGroupName, automationAccountName, compilationJobName, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DscCompilationJob']().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); + }); + }); +} + +/** + * Retrieve the Dsc configuration compilation job identified by job id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} compilationJobName The the DSC configuration Id. + * + * @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 DscCompilationJob} 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, automationAccountName, compilationJobName, 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 apiVersion = '2018-01-15'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (compilationJobName === null || compilationJobName === undefined || typeof compilationJobName.valueOf() !== 'string') { + throw new Error('compilationJobName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{compilationJobName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{compilationJobName}', encodeURIComponent(compilationJobName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DscCompilationJob']().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); + }); +} + +/** + * Retrieve a list of dsc compilation jobs. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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 DscCompilationJobListResult} 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 _listByAutomationAccount(resourceGroupName, automationAccountName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let apiVersion = '2018-01-15'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DscCompilationJobListResult']().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); + }); +} + +/** + * Retrieve the job stream identified by job stream id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {uuid} jobId The job id. + * + * @param {string} jobStreamId The job stream id. + * + * @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 JobStream} 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 _getStream(resourceGroupName, automationAccountName, jobId, jobStreamId, 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 apiVersion = '2018-01-15'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (jobId === null || jobId === undefined || typeof jobId.valueOf() !== 'string' || !msRest.isValidUuid(jobId)) { + throw new Error('jobId cannot be null or undefined and it must be of type string and must be a valid uuid.'); + } + if (jobStreamId === null || jobStreamId === undefined || typeof jobStreamId.valueOf() !== 'string') { + throw new Error('jobStreamId cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{jobId}/streams/{jobStreamId}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{jobId}', encodeURIComponent(jobId.toString())); + requestUrl = requestUrl.replace('{jobStreamId}', encodeURIComponent(jobStreamId)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['JobStream']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Creates the Dsc compilation job of the configuration. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} compilationJobName The the DSC configuration Id. + * + * @param {object} parameters The parameters supplied to the create compilation + * job operation. + * + * @param {object} parameters.configuration Gets or sets the configuration. + * + * @param {string} [parameters.configuration.name] Gets or sets the name of the + * Dsc configuration. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * job. + * + * @param {boolean} [parameters.newNodeConfigurationBuildVersionRequired] If a + * new build version of NodeConfiguration is required. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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 DscCompilationJob} 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 _beginCreate(resourceGroupName, automationAccountName, compilationJobName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2018-01-15'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (compilationJobName === null || compilationJobName === undefined || typeof compilationJobName.valueOf() !== 'string') { + throw new Error('compilationJobName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{compilationJobName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{compilationJobName}', encodeURIComponent(compilationJobName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['DscCompilationJobCreateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DscCompilationJob']().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); + }); +} + +/** + * Retrieve a list of dsc compilation jobs. + * + * @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 DscCompilationJobListResult} 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 _listByAutomationAccountNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DscCompilationJobListResult']().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 DscCompilationJobOperations. */ +class DscCompilationJobOperations { + /** + * Create a DscCompilationJobOperations. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._create = _create; + this._get = _get; + this._listByAutomationAccount = _listByAutomationAccount; + this._getStream = _getStream; + this._beginCreate = _beginCreate; + this._listByAutomationAccountNext = _listByAutomationAccountNext; + } + + /** + * Creates the Dsc compilation job of the configuration. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} compilationJobName The the DSC configuration Id. + * + * @param {object} parameters The parameters supplied to the create compilation + * job operation. + * + * @param {object} parameters.configuration Gets or sets the configuration. + * + * @param {string} [parameters.configuration.name] Gets or sets the name of the + * Dsc configuration. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * job. + * + * @param {boolean} [parameters.newNodeConfigurationBuildVersionRequired] If a + * new build version of NodeConfiguration is required. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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, automationAccountName, compilationJobName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._create(resourceGroupName, automationAccountName, compilationJobName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates the Dsc compilation job of the configuration. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} compilationJobName The the DSC configuration Id. + * + * @param {object} parameters The parameters supplied to the create compilation + * job operation. + * + * @param {object} parameters.configuration Gets or sets the configuration. + * + * @param {string} [parameters.configuration.name] Gets or sets the name of the + * Dsc configuration. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * job. + * + * @param {boolean} [parameters.newNodeConfigurationBuildVersionRequired] If a + * new build version of NodeConfiguration is required. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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 {DscCompilationJob} - 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 DscCompilationJob} 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, automationAccountName, compilationJobName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._create(resourceGroupName, automationAccountName, compilationJobName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(resourceGroupName, automationAccountName, compilationJobName, parameters, options, optionalCallback); + } + } + + /** + * Retrieve the Dsc configuration compilation job identified by job id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} compilationJobName The the DSC configuration Id. + * + * @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, automationAccountName, compilationJobName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, automationAccountName, compilationJobName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the Dsc configuration compilation job identified by job id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} compilationJobName The the DSC configuration Id. + * + * @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 {DscCompilationJob} - 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 DscCompilationJob} 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, automationAccountName, compilationJobName, 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, automationAccountName, compilationJobName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, automationAccountName, compilationJobName, options, optionalCallback); + } + } + + /** + * Retrieve a list of dsc compilation jobs. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName, automationAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of dsc compilation jobs. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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 {DscCompilationJobListResult} - 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 DscCompilationJobListResult} 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. + */ + listByAutomationAccount(resourceGroupName, automationAccountName, 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._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccount(resourceGroupName, automationAccountName, options, optionalCallback); + } + } + + /** + * Retrieve the job stream identified by job stream id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {uuid} jobId The job id. + * + * @param {string} jobStreamId The job stream id. + * + * @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. + */ + getStreamWithHttpOperationResponse(resourceGroupName, automationAccountName, jobId, jobStreamId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getStream(resourceGroupName, automationAccountName, jobId, jobStreamId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the job stream identified by job stream id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {uuid} jobId The job id. + * + * @param {string} jobStreamId The job stream id. + * + * @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 {JobStream} - 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 JobStream} 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. + */ + getStream(resourceGroupName, automationAccountName, jobId, jobStreamId, 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._getStream(resourceGroupName, automationAccountName, jobId, jobStreamId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getStream(resourceGroupName, automationAccountName, jobId, jobStreamId, options, optionalCallback); + } + } + + /** + * Creates the Dsc compilation job of the configuration. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} compilationJobName The the DSC configuration Id. + * + * @param {object} parameters The parameters supplied to the create compilation + * job operation. + * + * @param {object} parameters.configuration Gets or sets the configuration. + * + * @param {string} [parameters.configuration.name] Gets or sets the name of the + * Dsc configuration. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * job. + * + * @param {boolean} [parameters.newNodeConfigurationBuildVersionRequired] If a + * new build version of NodeConfiguration is required. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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. + */ + beginCreateWithHttpOperationResponse(resourceGroupName, automationAccountName, compilationJobName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreate(resourceGroupName, automationAccountName, compilationJobName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates the Dsc compilation job of the configuration. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} compilationJobName The the DSC configuration Id. + * + * @param {object} parameters The parameters supplied to the create compilation + * job operation. + * + * @param {object} parameters.configuration Gets or sets the configuration. + * + * @param {string} [parameters.configuration.name] Gets or sets the name of the + * Dsc configuration. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * job. + * + * @param {boolean} [parameters.newNodeConfigurationBuildVersionRequired] If a + * new build version of NodeConfiguration is required. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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 {DscCompilationJob} - 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 DscCompilationJob} 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. + */ + beginCreate(resourceGroupName, automationAccountName, compilationJobName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreate(resourceGroupName, automationAccountName, compilationJobName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreate(resourceGroupName, automationAccountName, compilationJobName, parameters, options, optionalCallback); + } + } + + /** + * Retrieve a list of dsc compilation jobs. + * + * @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. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccountNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of dsc compilation jobs. + * + * @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 {DscCompilationJobListResult} - 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 DscCompilationJobListResult} 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. + */ + listByAutomationAccountNext(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._listByAutomationAccountNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccountNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = DscCompilationJobOperations; diff --git a/lib/services/automationManagement/lib/lib/operations/dscCompilationJobStream.js b/lib/services/automationManagement/lib/lib/operations/dscCompilationJobStream.js new file mode 100644 index 0000000000..aa55a43755 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/operations/dscCompilationJobStream.js @@ -0,0 +1,284 @@ +/* + * 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; + +/** + * Retrieve all the job streams for the compilation Job. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {uuid} jobId The job id. + * + * @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 JobStreamListResult} 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 _listByJob(resourceGroupName, automationAccountName, jobId, 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 apiVersion = '2018-01-15'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (jobId === null || jobId === undefined || typeof jobId.valueOf() !== 'string' || !msRest.isValidUuid(jobId)) { + throw new Error('jobId cannot be null or undefined and it must be of type string and must be a valid uuid.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{jobId}/streams'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{jobId}', encodeURIComponent(jobId.toString())); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['JobStreamListResult']().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 DscCompilationJobStream. */ +class DscCompilationJobStream { + /** + * Create a DscCompilationJobStream. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listByJob = _listByJob; + } + + /** + * Retrieve all the job streams for the compilation Job. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {uuid} jobId The job id. + * + * @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. + */ + listByJobWithHttpOperationResponse(resourceGroupName, automationAccountName, jobId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByJob(resourceGroupName, automationAccountName, jobId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve all the job streams for the compilation Job. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {uuid} jobId The job id. + * + * @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 {JobStreamListResult} - 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 JobStreamListResult} 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. + */ + listByJob(resourceGroupName, automationAccountName, jobId, 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._listByJob(resourceGroupName, automationAccountName, jobId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByJob(resourceGroupName, automationAccountName, jobId, options, optionalCallback); + } + } + +} + +module.exports = DscCompilationJobStream; diff --git a/lib/services/automationManagement/lib/lib/operations/dscConfigurationOperations.js b/lib/services/automationManagement/lib/lib/operations/dscConfigurationOperations.js new file mode 100644 index 0000000000..8fb422a481 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/operations/dscConfigurationOperations.js @@ -0,0 +1,2043 @@ +/* + * 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; + +/** + * Delete the dsc configuration identified by configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} configurationName The configuration 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. + * + * {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, automationAccountName, configurationName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (configurationName === null || configurationName === undefined || typeof configurationName.valueOf() !== 'string') { + throw new Error('configurationName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{configurationName}', encodeURIComponent(configurationName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Retrieve the configuration identified by configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} configurationName The configuration 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 DscConfiguration} 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, automationAccountName, configurationName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (configurationName === null || configurationName === undefined || typeof configurationName.valueOf() !== 'string') { + throw new Error('configurationName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{configurationName}', encodeURIComponent(configurationName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DscConfiguration']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Create the configuration identified by configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} configurationName The create or update parameters for + * configuration. + * + * @param {object} parameters The create or update parameters for + * configuration. + * + * @param {boolean} [parameters.logVerbose] Gets or sets verbose log option. + * + * @param {boolean} [parameters.logProgress] Gets or sets progress log option. + * + * @param {object} parameters.source Gets or sets the source. + * + * @param {object} [parameters.source.hash] Gets or sets the hash. + * + * @param {string} parameters.source.hash.algorithm Gets or sets the content + * hash algorithm used to hash the content. + * + * @param {string} parameters.source.hash.value Gets or sets expected hash + * value of the content. + * + * @param {string} [parameters.source.type] Gets or sets the content source + * type. Possible values include: 'embeddedContent', 'uri' + * + * @param {string} [parameters.source.value] Gets or sets the value of the + * content. This is based on the content source type. + * + * @param {string} [parameters.source.version] Gets or sets the version of the + * content. + * + * @param {object} [parameters.parameters] Gets or sets the configuration + * parameters. + * + * @param {string} [parameters.description] Gets or sets the description of the + * configuration. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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 DscConfiguration} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, automationAccountName, configurationName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (configurationName === null || configurationName === undefined || typeof configurationName.valueOf() !== 'string') { + throw new Error('configurationName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{configurationName}', encodeURIComponent(configurationName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['DscConfigurationCreateOrUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DscConfiguration']().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['DscConfiguration']().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); + }); +} + +/** + * Create the configuration identified by configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} configurationName The create or update parameters for + * configuration. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.parameters] The create or update parameters for + * configuration. + * + * @param {boolean} [options.parameters.logVerbose] Gets or sets verbose log + * option. + * + * @param {boolean} [options.parameters.logProgress] Gets or sets progress log + * option. + * + * @param {object} options.parameters.source Gets or sets the source. + * + * @param {object} [options.parameters.source.hash] Gets or sets the hash. + * + * @param {string} options.parameters.source.hash.algorithm Gets or sets the + * content hash algorithm used to hash the content. + * + * @param {string} options.parameters.source.hash.value Gets or sets expected + * hash value of the content. + * + * @param {string} [options.parameters.source.type] Gets or sets the content + * source type. Possible values include: 'embeddedContent', 'uri' + * + * @param {string} [options.parameters.source.value] Gets or sets the value of + * the content. This is based on the content source type. + * + * @param {string} [options.parameters.source.version] Gets or sets the version + * of the content. + * + * @param {object} [options.parameters.parameters] Gets or sets the + * configuration parameters. + * + * @param {string} [options.parameters.description] Gets or sets the + * description of the configuration. + * + * @param {string} [options.parameters.name] Gets or sets name of the resource. + * + * @param {object} [options.parameters.tags] Gets or sets the tags attached to + * the resource. + * + * @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 DscConfiguration} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, automationAccountName, configurationName, 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 parameters = (options && options.parameters !== undefined) ? options.parameters : undefined; + let apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (configurationName === null || configurationName === undefined || typeof configurationName.valueOf() !== 'string') { + throw new Error('configurationName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{configurationName}', encodeURIComponent(configurationName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['DscConfigurationUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DscConfiguration']().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); + }); +} + +/** + * Retrieve the configuration script identified by configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} configurationName The configuration 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. + * + * {string} [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 _getContent(resourceGroupName, automationAccountName, configurationName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (configurationName === null || configurationName === undefined || typeof configurationName.valueOf() !== 'string') { + throw new Error('configurationName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}/content'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{configurationName}', encodeURIComponent(configurationName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = { + required: false, + serializedName: 'parsedResponse', + type: { + name: 'String' + } + }; + 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); + }); +} + +/** + * Retrieve a list of configurations. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 DscConfigurationListResult} 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 _listByAutomationAccount(resourceGroupName, automationAccountName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DscConfigurationListResult']().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); + }); +} + +/** + * Retrieve a list of configurations. + * + * @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 DscConfigurationListResult} 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 _listByAutomationAccountNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DscConfigurationListResult']().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 DscConfigurationOperations. */ +class DscConfigurationOperations { + /** + * Create a DscConfigurationOperations. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._update = _update; + this._getContent = _getContent; + this._listByAutomationAccount = _listByAutomationAccount; + this._listByAutomationAccountNext = _listByAutomationAccountNext; + } + + /** + * Delete the dsc configuration identified by configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} configurationName The configuration 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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, automationAccountName, configurationName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, automationAccountName, configurationName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete the dsc configuration identified by configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} configurationName The configuration 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 {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, automationAccountName, configurationName, 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, automationAccountName, configurationName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, automationAccountName, configurationName, options, optionalCallback); + } + } + + /** + * Retrieve the configuration identified by configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} configurationName The configuration 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. + */ + getWithHttpOperationResponse(resourceGroupName, automationAccountName, configurationName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, automationAccountName, configurationName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the configuration identified by configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} configurationName The configuration 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 {DscConfiguration} - 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 DscConfiguration} 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, automationAccountName, configurationName, 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, automationAccountName, configurationName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, automationAccountName, configurationName, options, optionalCallback); + } + } + + /** + * Create the configuration identified by configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} configurationName The create or update parameters for + * configuration. + * + * @param {object} parameters The create or update parameters for + * configuration. + * + * @param {boolean} [parameters.logVerbose] Gets or sets verbose log option. + * + * @param {boolean} [parameters.logProgress] Gets or sets progress log option. + * + * @param {object} parameters.source Gets or sets the source. + * + * @param {object} [parameters.source.hash] Gets or sets the hash. + * + * @param {string} parameters.source.hash.algorithm Gets or sets the content + * hash algorithm used to hash the content. + * + * @param {string} parameters.source.hash.value Gets or sets expected hash + * value of the content. + * + * @param {string} [parameters.source.type] Gets or sets the content source + * type. Possible values include: 'embeddedContent', 'uri' + * + * @param {string} [parameters.source.value] Gets or sets the value of the + * content. This is based on the content source type. + * + * @param {string} [parameters.source.version] Gets or sets the version of the + * content. + * + * @param {object} [parameters.parameters] Gets or sets the configuration + * parameters. + * + * @param {string} [parameters.description] Gets or sets the description of the + * configuration. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, automationAccountName, configurationName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, automationAccountName, configurationName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create the configuration identified by configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} configurationName The create or update parameters for + * configuration. + * + * @param {object} parameters The create or update parameters for + * configuration. + * + * @param {boolean} [parameters.logVerbose] Gets or sets verbose log option. + * + * @param {boolean} [parameters.logProgress] Gets or sets progress log option. + * + * @param {object} parameters.source Gets or sets the source. + * + * @param {object} [parameters.source.hash] Gets or sets the hash. + * + * @param {string} parameters.source.hash.algorithm Gets or sets the content + * hash algorithm used to hash the content. + * + * @param {string} parameters.source.hash.value Gets or sets expected hash + * value of the content. + * + * @param {string} [parameters.source.type] Gets or sets the content source + * type. Possible values include: 'embeddedContent', 'uri' + * + * @param {string} [parameters.source.value] Gets or sets the value of the + * content. This is based on the content source type. + * + * @param {string} [parameters.source.version] Gets or sets the version of the + * content. + * + * @param {object} [parameters.parameters] Gets or sets the configuration + * parameters. + * + * @param {string} [parameters.description] Gets or sets the description of the + * configuration. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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 {DscConfiguration} - 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 DscConfiguration} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, automationAccountName, configurationName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, automationAccountName, configurationName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, automationAccountName, configurationName, parameters, options, optionalCallback); + } + } + + /** + * Create the configuration identified by configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} configurationName The create or update parameters for + * configuration. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.parameters] The create or update parameters for + * configuration. + * + * @param {boolean} [options.parameters.logVerbose] Gets or sets verbose log + * option. + * + * @param {boolean} [options.parameters.logProgress] Gets or sets progress log + * option. + * + * @param {object} options.parameters.source Gets or sets the source. + * + * @param {object} [options.parameters.source.hash] Gets or sets the hash. + * + * @param {string} options.parameters.source.hash.algorithm Gets or sets the + * content hash algorithm used to hash the content. + * + * @param {string} options.parameters.source.hash.value Gets or sets expected + * hash value of the content. + * + * @param {string} [options.parameters.source.type] Gets or sets the content + * source type. Possible values include: 'embeddedContent', 'uri' + * + * @param {string} [options.parameters.source.value] Gets or sets the value of + * the content. This is based on the content source type. + * + * @param {string} [options.parameters.source.version] Gets or sets the version + * of the content. + * + * @param {object} [options.parameters.parameters] Gets or sets the + * configuration parameters. + * + * @param {string} [options.parameters.description] Gets or sets the + * description of the configuration. + * + * @param {string} [options.parameters.name] Gets or sets name of the resource. + * + * @param {object} [options.parameters.tags] Gets or sets the tags attached to + * the resource. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName, automationAccountName, configurationName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, automationAccountName, configurationName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create the configuration identified by configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} configurationName The create or update parameters for + * configuration. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.parameters] The create or update parameters for + * configuration. + * + * @param {boolean} [options.parameters.logVerbose] Gets or sets verbose log + * option. + * + * @param {boolean} [options.parameters.logProgress] Gets or sets progress log + * option. + * + * @param {object} options.parameters.source Gets or sets the source. + * + * @param {object} [options.parameters.source.hash] Gets or sets the hash. + * + * @param {string} options.parameters.source.hash.algorithm Gets or sets the + * content hash algorithm used to hash the content. + * + * @param {string} options.parameters.source.hash.value Gets or sets expected + * hash value of the content. + * + * @param {string} [options.parameters.source.type] Gets or sets the content + * source type. Possible values include: 'embeddedContent', 'uri' + * + * @param {string} [options.parameters.source.value] Gets or sets the value of + * the content. This is based on the content source type. + * + * @param {string} [options.parameters.source.version] Gets or sets the version + * of the content. + * + * @param {object} [options.parameters.parameters] Gets or sets the + * configuration parameters. + * + * @param {string} [options.parameters.description] Gets or sets the + * description of the configuration. + * + * @param {string} [options.parameters.name] Gets or sets name of the resource. + * + * @param {object} [options.parameters.tags] Gets or sets the tags attached to + * the resource. + * + * @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 {DscConfiguration} - 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 DscConfiguration} 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. + */ + update(resourceGroupName, automationAccountName, configurationName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, automationAccountName, configurationName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, automationAccountName, configurationName, options, optionalCallback); + } + } + + /** + * Retrieve the configuration script identified by configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} configurationName The configuration 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. + */ + getContentWithHttpOperationResponse(resourceGroupName, automationAccountName, configurationName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getContent(resourceGroupName, automationAccountName, configurationName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the configuration script identified by configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} configurationName The configuration 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 {String} - 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. + * + * {string} [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. + */ + getContent(resourceGroupName, automationAccountName, configurationName, 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._getContent(resourceGroupName, automationAccountName, configurationName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getContent(resourceGroupName, automationAccountName, configurationName, options, optionalCallback); + } + } + + /** + * Retrieve a list of configurations. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName, automationAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of configurations. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 {DscConfigurationListResult} - 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 DscConfigurationListResult} 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. + */ + listByAutomationAccount(resourceGroupName, automationAccountName, 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._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccount(resourceGroupName, automationAccountName, options, optionalCallback); + } + } + + /** + * Retrieve a list of configurations. + * + * @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. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccountNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of configurations. + * + * @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 {DscConfigurationListResult} - 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 DscConfigurationListResult} 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. + */ + listByAutomationAccountNext(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._listByAutomationAccountNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccountNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = DscConfigurationOperations; diff --git a/lib/services/automationManagement/lib/lib/operations/dscNodeConfigurationOperations.js b/lib/services/automationManagement/lib/lib/operations/dscNodeConfigurationOperations.js new file mode 100644 index 0000000000..6d8b0a61f0 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/operations/dscNodeConfigurationOperations.js @@ -0,0 +1,1636 @@ +/* + * 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; + +/** + * Delete the Dsc node configurations by node configuration. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeConfigurationName The Dsc node configuration 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. + * + * {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, automationAccountName, nodeConfigurationName, 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 apiVersion = '2018-01-15'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (nodeConfigurationName === null || nodeConfigurationName === undefined || typeof nodeConfigurationName.valueOf() !== 'string') { + throw new Error('nodeConfigurationName 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.Automation/automationAccounts/{automationAccountName}/nodeConfigurations/{nodeConfigurationName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{nodeConfigurationName}', encodeURIComponent(nodeConfigurationName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Retrieve the Dsc node configurations by node configuration. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeConfigurationName The Dsc node configuration 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 DscNodeConfiguration} 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, automationAccountName, nodeConfigurationName, 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 apiVersion = '2018-01-15'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (nodeConfigurationName === null || nodeConfigurationName === undefined || typeof nodeConfigurationName.valueOf() !== 'string') { + throw new Error('nodeConfigurationName 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.Automation/automationAccounts/{automationAccountName}/nodeConfigurations/{nodeConfigurationName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{nodeConfigurationName}', encodeURIComponent(nodeConfigurationName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DscNodeConfiguration']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Create the node configuration identified by node configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeConfigurationName The Dsc node configuration name. + * + * @param {object} parameters The create or update parameters for + * configuration. + * + * @param {object} parameters.source Gets or sets the source. + * + * @param {object} [parameters.source.hash] Gets or sets the hash. + * + * @param {string} parameters.source.hash.algorithm Gets or sets the content + * hash algorithm used to hash the content. + * + * @param {string} parameters.source.hash.value Gets or sets expected hash + * value of the content. + * + * @param {string} [parameters.source.type] Gets or sets the content source + * type. Possible values include: 'embeddedContent', 'uri' + * + * @param {string} [parameters.source.value] Gets or sets the value of the + * content. This is based on the content source type. + * + * @param {string} [parameters.source.version] Gets or sets the version of the + * content. + * + * @param {string} parameters.name Gets or sets the type of the parameter. + * + * @param {object} parameters.configuration Gets or sets the configuration of + * the node. + * + * @param {string} [parameters.configuration.name] Gets or sets the name of the + * Dsc configuration. + * + * @param {boolean} [parameters.incrementNodeConfigurationBuild] If a new build + * version of NodeConfiguration is required. + * + * @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 DscNodeConfiguration} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, automationAccountName, nodeConfigurationName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, automationAccountName, nodeConfigurationName, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DscNodeConfiguration']().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); + }); + }); +} + +/** + * Retrieve a list of dsc node configurations. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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 DscNodeConfigurationListResult} 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 _listByAutomationAccount(resourceGroupName, automationAccountName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let apiVersion = '2018-01-15'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (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.Automation/automationAccounts/{automationAccountName}/nodeConfigurations'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DscNodeConfigurationListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Create the node configuration identified by node configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeConfigurationName The Dsc node configuration name. + * + * @param {object} parameters The create or update parameters for + * configuration. + * + * @param {object} parameters.source Gets or sets the source. + * + * @param {object} [parameters.source.hash] Gets or sets the hash. + * + * @param {string} parameters.source.hash.algorithm Gets or sets the content + * hash algorithm used to hash the content. + * + * @param {string} parameters.source.hash.value Gets or sets expected hash + * value of the content. + * + * @param {string} [parameters.source.type] Gets or sets the content source + * type. Possible values include: 'embeddedContent', 'uri' + * + * @param {string} [parameters.source.value] Gets or sets the value of the + * content. This is based on the content source type. + * + * @param {string} [parameters.source.version] Gets or sets the version of the + * content. + * + * @param {string} parameters.name Gets or sets the type of the parameter. + * + * @param {object} parameters.configuration Gets or sets the configuration of + * the node. + * + * @param {string} [parameters.configuration.name] Gets or sets the name of the + * Dsc configuration. + * + * @param {boolean} [parameters.incrementNodeConfigurationBuild] If a new build + * version of NodeConfiguration is required. + * + * @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 DscNodeConfiguration} 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 _beginCreateOrUpdate(resourceGroupName, automationAccountName, nodeConfigurationName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2018-01-15'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (nodeConfigurationName === null || nodeConfigurationName === undefined || typeof nodeConfigurationName.valueOf() !== 'string') { + throw new Error('nodeConfigurationName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations/{nodeConfigurationName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{nodeConfigurationName}', encodeURIComponent(nodeConfigurationName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['DscNodeConfigurationCreateOrUpdateParametersProperties']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DscNodeConfiguration']().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); + }); +} + +/** + * Retrieve a list of dsc node configurations. + * + * @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 DscNodeConfigurationListResult} 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 _listByAutomationAccountNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DscNodeConfigurationListResult']().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 DscNodeConfigurationOperations. */ +class DscNodeConfigurationOperations { + /** + * Create a DscNodeConfigurationOperations. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._listByAutomationAccount = _listByAutomationAccount; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._listByAutomationAccountNext = _listByAutomationAccountNext; + } + + /** + * Delete the Dsc node configurations by node configuration. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeConfigurationName The Dsc node configuration 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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, automationAccountName, nodeConfigurationName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, automationAccountName, nodeConfigurationName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete the Dsc node configurations by node configuration. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeConfigurationName The Dsc node configuration 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 {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, automationAccountName, nodeConfigurationName, 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, automationAccountName, nodeConfigurationName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, automationAccountName, nodeConfigurationName, options, optionalCallback); + } + } + + /** + * Retrieve the Dsc node configurations by node configuration. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeConfigurationName The Dsc node configuration 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. + */ + getWithHttpOperationResponse(resourceGroupName, automationAccountName, nodeConfigurationName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, automationAccountName, nodeConfigurationName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the Dsc node configurations by node configuration. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeConfigurationName The Dsc node configuration 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 {DscNodeConfiguration} - 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 DscNodeConfiguration} 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, automationAccountName, nodeConfigurationName, 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, automationAccountName, nodeConfigurationName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, automationAccountName, nodeConfigurationName, options, optionalCallback); + } + } + + /** + * Create the node configuration identified by node configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeConfigurationName The Dsc node configuration name. + * + * @param {object} parameters The create or update parameters for + * configuration. + * + * @param {object} parameters.source Gets or sets the source. + * + * @param {object} [parameters.source.hash] Gets or sets the hash. + * + * @param {string} parameters.source.hash.algorithm Gets or sets the content + * hash algorithm used to hash the content. + * + * @param {string} parameters.source.hash.value Gets or sets expected hash + * value of the content. + * + * @param {string} [parameters.source.type] Gets or sets the content source + * type. Possible values include: 'embeddedContent', 'uri' + * + * @param {string} [parameters.source.value] Gets or sets the value of the + * content. This is based on the content source type. + * + * @param {string} [parameters.source.version] Gets or sets the version of the + * content. + * + * @param {string} parameters.name Gets or sets the type of the parameter. + * + * @param {object} parameters.configuration Gets or sets the configuration of + * the node. + * + * @param {string} [parameters.configuration.name] Gets or sets the name of the + * Dsc configuration. + * + * @param {boolean} [parameters.incrementNodeConfigurationBuild] If a new build + * version of NodeConfiguration is required. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, automationAccountName, nodeConfigurationName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, automationAccountName, nodeConfigurationName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create the node configuration identified by node configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeConfigurationName The Dsc node configuration name. + * + * @param {object} parameters The create or update parameters for + * configuration. + * + * @param {object} parameters.source Gets or sets the source. + * + * @param {object} [parameters.source.hash] Gets or sets the hash. + * + * @param {string} parameters.source.hash.algorithm Gets or sets the content + * hash algorithm used to hash the content. + * + * @param {string} parameters.source.hash.value Gets or sets expected hash + * value of the content. + * + * @param {string} [parameters.source.type] Gets or sets the content source + * type. Possible values include: 'embeddedContent', 'uri' + * + * @param {string} [parameters.source.value] Gets or sets the value of the + * content. This is based on the content source type. + * + * @param {string} [parameters.source.version] Gets or sets the version of the + * content. + * + * @param {string} parameters.name Gets or sets the type of the parameter. + * + * @param {object} parameters.configuration Gets or sets the configuration of + * the node. + * + * @param {string} [parameters.configuration.name] Gets or sets the name of the + * Dsc configuration. + * + * @param {boolean} [parameters.incrementNodeConfigurationBuild] If a new build + * version of NodeConfiguration is required. + * + * @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 {DscNodeConfiguration} - 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 DscNodeConfiguration} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, automationAccountName, nodeConfigurationName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, automationAccountName, nodeConfigurationName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, automationAccountName, nodeConfigurationName, parameters, options, optionalCallback); + } + } + + /** + * Retrieve a list of dsc node configurations. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName, automationAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of dsc node configurations. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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 {DscNodeConfigurationListResult} - 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 DscNodeConfigurationListResult} 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. + */ + listByAutomationAccount(resourceGroupName, automationAccountName, 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._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccount(resourceGroupName, automationAccountName, options, optionalCallback); + } + } + + /** + * Create the node configuration identified by node configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeConfigurationName The Dsc node configuration name. + * + * @param {object} parameters The create or update parameters for + * configuration. + * + * @param {object} parameters.source Gets or sets the source. + * + * @param {object} [parameters.source.hash] Gets or sets the hash. + * + * @param {string} parameters.source.hash.algorithm Gets or sets the content + * hash algorithm used to hash the content. + * + * @param {string} parameters.source.hash.value Gets or sets expected hash + * value of the content. + * + * @param {string} [parameters.source.type] Gets or sets the content source + * type. Possible values include: 'embeddedContent', 'uri' + * + * @param {string} [parameters.source.value] Gets or sets the value of the + * content. This is based on the content source type. + * + * @param {string} [parameters.source.version] Gets or sets the version of the + * content. + * + * @param {string} parameters.name Gets or sets the type of the parameter. + * + * @param {object} parameters.configuration Gets or sets the configuration of + * the node. + * + * @param {string} [parameters.configuration.name] Gets or sets the name of the + * Dsc configuration. + * + * @param {boolean} [parameters.incrementNodeConfigurationBuild] If a new build + * version of NodeConfiguration is required. + * + * @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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, automationAccountName, nodeConfigurationName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, automationAccountName, nodeConfigurationName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create the node configuration identified by node configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeConfigurationName The Dsc node configuration name. + * + * @param {object} parameters The create or update parameters for + * configuration. + * + * @param {object} parameters.source Gets or sets the source. + * + * @param {object} [parameters.source.hash] Gets or sets the hash. + * + * @param {string} parameters.source.hash.algorithm Gets or sets the content + * hash algorithm used to hash the content. + * + * @param {string} parameters.source.hash.value Gets or sets expected hash + * value of the content. + * + * @param {string} [parameters.source.type] Gets or sets the content source + * type. Possible values include: 'embeddedContent', 'uri' + * + * @param {string} [parameters.source.value] Gets or sets the value of the + * content. This is based on the content source type. + * + * @param {string} [parameters.source.version] Gets or sets the version of the + * content. + * + * @param {string} parameters.name Gets or sets the type of the parameter. + * + * @param {object} parameters.configuration Gets or sets the configuration of + * the node. + * + * @param {string} [parameters.configuration.name] Gets or sets the name of the + * Dsc configuration. + * + * @param {boolean} [parameters.incrementNodeConfigurationBuild] If a new build + * version of NodeConfiguration is required. + * + * @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 {DscNodeConfiguration} - 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 DscNodeConfiguration} 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. + */ + beginCreateOrUpdate(resourceGroupName, automationAccountName, nodeConfigurationName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, automationAccountName, nodeConfigurationName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, automationAccountName, nodeConfigurationName, parameters, options, optionalCallback); + } + } + + /** + * Retrieve a list of dsc node configurations. + * + * @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. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccountNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of dsc node configurations. + * + * @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 {DscNodeConfigurationListResult} - 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 DscNodeConfigurationListResult} 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. + */ + listByAutomationAccountNext(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._listByAutomationAccountNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccountNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = DscNodeConfigurationOperations; diff --git a/lib/services/automationManagement/lib/lib/operations/dscNodeOperations.js b/lib/services/automationManagement/lib/lib/operations/dscNodeOperations.js new file mode 100644 index 0000000000..16dd2a39b7 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/operations/dscNodeOperations.js @@ -0,0 +1,1333 @@ +/* + * 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; + +/** + * Delete the dsc node identified by node id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId The node id. + * + * @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 DscNode} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, automationAccountName, nodeId, 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 apiVersion = '2018-01-15'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (nodeId === null || nodeId === undefined || typeof nodeId.valueOf() !== 'string') { + throw new Error('nodeId cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{nodeId}', encodeURIComponent(nodeId)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DscNode']().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); + }); +} + +/** + * Retrieve the dsc node identified by node id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId The node id. + * + * @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 DscNode} 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, automationAccountName, nodeId, 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 apiVersion = '2018-01-15'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (nodeId === null || nodeId === undefined || typeof nodeId.valueOf() !== 'string') { + throw new Error('nodeId cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{nodeId}', encodeURIComponent(nodeId)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DscNode']().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); + }); +} + +/** + * Update the dsc node. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId Parameters supplied to the update dsc node. + * + * @param {object} dscNodeUpdateParameters Parameters supplied to the update + * dsc node. + * + * @param {string} [dscNodeUpdateParameters.nodeId] Gets or sets the id of the + * dsc node. + * + * @param {object} [dscNodeUpdateParameters.nodeConfiguration] Gets or sets the + * configuration of the node. + * + * @param {string} [dscNodeUpdateParameters.nodeConfiguration.name] Gets or + * sets the name of the dsc nodeconfiguration. + * + * @param {object} [dscNodeUpdateParameters.properties] + * + * @param {string} [dscNodeUpdateParameters.properties.name] Gets or sets the + * name of the dsc nodeconfiguration. + * + * @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 DscNode} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, automationAccountName, nodeId, dscNodeUpdateParameters, 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 apiVersion = '2018-01-15'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (nodeId === null || nodeId === undefined || typeof nodeId.valueOf() !== 'string') { + throw new Error('nodeId cannot be null or undefined and it must be of type string.'); + } + if (dscNodeUpdateParameters === null || dscNodeUpdateParameters === undefined) { + throw new Error('dscNodeUpdateParameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{nodeId}', encodeURIComponent(nodeId)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (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 (dscNodeUpdateParameters !== null && dscNodeUpdateParameters !== undefined) { + let requestModelMapper = new client.models['DscNodeUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, dscNodeUpdateParameters, 'dscNodeUpdateParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(dscNodeUpdateParameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DscNode']().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); + }); +} + +/** + * Retrieve a list of dsc nodes. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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 DscNodeListResult} 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 _listByAutomationAccount(resourceGroupName, automationAccountName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let apiVersion = '2018-01-15'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DscNodeListResult']().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); + }); +} + +/** + * Retrieve a list of dsc nodes. + * + * @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 DscNodeListResult} 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 _listByAutomationAccountNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DscNodeListResult']().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 DscNodeOperations. */ +class DscNodeOperations { + /** + * Create a DscNodeOperations. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._update = _update; + this._listByAutomationAccount = _listByAutomationAccount; + this._listByAutomationAccountNext = _listByAutomationAccountNext; + } + + /** + * Delete the dsc node identified by node id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId The node id. + * + * @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, automationAccountName, nodeId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, automationAccountName, nodeId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete the dsc node identified by node id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId The node id. + * + * @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 {DscNode} - 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 DscNode} 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. + */ + deleteMethod(resourceGroupName, automationAccountName, nodeId, 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, automationAccountName, nodeId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, automationAccountName, nodeId, options, optionalCallback); + } + } + + /** + * Retrieve the dsc node identified by node id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId The node id. + * + * @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, automationAccountName, nodeId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, automationAccountName, nodeId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the dsc node identified by node id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId The node id. + * + * @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 {DscNode} - 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 DscNode} 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, automationAccountName, nodeId, 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, automationAccountName, nodeId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, automationAccountName, nodeId, options, optionalCallback); + } + } + + /** + * Update the dsc node. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId Parameters supplied to the update dsc node. + * + * @param {object} dscNodeUpdateParameters Parameters supplied to the update + * dsc node. + * + * @param {string} [dscNodeUpdateParameters.nodeId] Gets or sets the id of the + * dsc node. + * + * @param {object} [dscNodeUpdateParameters.nodeConfiguration] Gets or sets the + * configuration of the node. + * + * @param {string} [dscNodeUpdateParameters.nodeConfiguration.name] Gets or + * sets the name of the dsc nodeconfiguration. + * + * @param {object} [dscNodeUpdateParameters.properties] + * + * @param {string} [dscNodeUpdateParameters.properties.name] Gets or sets the + * name of the dsc nodeconfiguration. + * + * @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. + */ + updateWithHttpOperationResponse(resourceGroupName, automationAccountName, nodeId, dscNodeUpdateParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, automationAccountName, nodeId, dscNodeUpdateParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Update the dsc node. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId Parameters supplied to the update dsc node. + * + * @param {object} dscNodeUpdateParameters Parameters supplied to the update + * dsc node. + * + * @param {string} [dscNodeUpdateParameters.nodeId] Gets or sets the id of the + * dsc node. + * + * @param {object} [dscNodeUpdateParameters.nodeConfiguration] Gets or sets the + * configuration of the node. + * + * @param {string} [dscNodeUpdateParameters.nodeConfiguration.name] Gets or + * sets the name of the dsc nodeconfiguration. + * + * @param {object} [dscNodeUpdateParameters.properties] + * + * @param {string} [dscNodeUpdateParameters.properties.name] Gets or sets the + * name of the dsc nodeconfiguration. + * + * @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 {DscNode} - 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 DscNode} 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. + */ + update(resourceGroupName, automationAccountName, nodeId, dscNodeUpdateParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, automationAccountName, nodeId, dscNodeUpdateParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, automationAccountName, nodeId, dscNodeUpdateParameters, options, optionalCallback); + } + } + + /** + * Retrieve a list of dsc nodes. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName, automationAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of dsc nodes. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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 {DscNodeListResult} - 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 DscNodeListResult} 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. + */ + listByAutomationAccount(resourceGroupName, automationAccountName, 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._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccount(resourceGroupName, automationAccountName, options, optionalCallback); + } + } + + /** + * Retrieve a list of dsc nodes. + * + * @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. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccountNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of dsc nodes. + * + * @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 {DscNodeListResult} - 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 DscNodeListResult} 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. + */ + listByAutomationAccountNext(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._listByAutomationAccountNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccountNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = DscNodeOperations; diff --git a/lib/services/automationManagement/lib/lib/operations/fields.js b/lib/services/automationManagement/lib/lib/operations/fields.js new file mode 100644 index 0000000000..99959d3d38 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/operations/fields.js @@ -0,0 +1,294 @@ +/* + * 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; + +/** + * Retrieve a list of fields of a given type identified by module name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The name of module. + * + * @param {string} typeName The name of type. + * + * @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 TypeFieldListResult} 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 _listByType(resourceGroupName, automationAccountName, moduleName, typeName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (moduleName === null || moduleName === undefined || typeof moduleName.valueOf() !== 'string') { + throw new Error('moduleName cannot be null or undefined and it must be of type string.'); + } + if (typeName === null || typeName === undefined || typeof typeName.valueOf() !== 'string') { + throw new Error('typeName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/types/{typeName}/fields'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{moduleName}', encodeURIComponent(moduleName)); + requestUrl = requestUrl.replace('{typeName}', encodeURIComponent(typeName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['TypeFieldListResult']().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 Fields. */ +class Fields { + /** + * Create a Fields. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listByType = _listByType; + } + + /** + * Retrieve a list of fields of a given type identified by module name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The name of module. + * + * @param {string} typeName The name of type. + * + * @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. + */ + listByTypeWithHttpOperationResponse(resourceGroupName, automationAccountName, moduleName, typeName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByType(resourceGroupName, automationAccountName, moduleName, typeName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of fields of a given type identified by module name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The name of module. + * + * @param {string} typeName The name of type. + * + * @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 {TypeFieldListResult} - 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 TypeFieldListResult} 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. + */ + listByType(resourceGroupName, automationAccountName, moduleName, typeName, 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._listByType(resourceGroupName, automationAccountName, moduleName, typeName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByType(resourceGroupName, automationAccountName, moduleName, typeName, options, optionalCallback); + } + } + +} + +module.exports = Fields; diff --git a/lib/services/automationManagement/lib/lib/operations/hybridRunbookWorkerGroupOperations.js b/lib/services/automationManagement/lib/lib/operations/hybridRunbookWorkerGroupOperations.js new file mode 100644 index 0000000000..51f2f367e7 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/operations/hybridRunbookWorkerGroupOperations.js @@ -0,0 +1,1291 @@ +/* + * 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; + +/** + * Delete a hybrid runbook worker group. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName Automation account name. + * + * @param {string} hybridRunbookWorkerGroupName The hybrid runbook worker 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. + * + * {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, automationAccountName, hybridRunbookWorkerGroupName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (hybridRunbookWorkerGroupName === null || hybridRunbookWorkerGroupName === undefined || typeof hybridRunbookWorkerGroupName.valueOf() !== 'string') { + throw new Error('hybridRunbookWorkerGroupName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{hybridRunbookWorkerGroupName}', encodeURIComponent(hybridRunbookWorkerGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Retrieve a hybrid runbook worker group. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} hybridRunbookWorkerGroupName The hybrid runbook worker 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 HybridRunbookWorkerGroup} 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, automationAccountName, hybridRunbookWorkerGroupName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (hybridRunbookWorkerGroupName === null || hybridRunbookWorkerGroupName === undefined || typeof hybridRunbookWorkerGroupName.valueOf() !== 'string') { + throw new Error('hybridRunbookWorkerGroupName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{hybridRunbookWorkerGroupName}', encodeURIComponent(hybridRunbookWorkerGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['HybridRunbookWorkerGroup']().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); + }); +} + +/** + * Update a hybrid runbook worker group. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} hybridRunbookWorkerGroupName The hybrid runbook worker group + * name + * + * @param {object} parameters The hybrid runbook worker group + * + * @param {object} [parameters.credential] Sets the credential of a worker + * group. + * + * @param {string} [parameters.credential.name] Gets or sets the name of the + * credential. + * + * @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 HybridRunbookWorkerGroup} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (hybridRunbookWorkerGroupName === null || hybridRunbookWorkerGroupName === undefined || typeof hybridRunbookWorkerGroupName.valueOf() !== 'string') { + throw new Error('hybridRunbookWorkerGroupName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{hybridRunbookWorkerGroupName}', encodeURIComponent(hybridRunbookWorkerGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['HybridRunbookWorkerGroupUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['HybridRunbookWorkerGroup']().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); + }); +} + +/** + * Retrieve a list of hybrid runbook worker groups. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 HybridRunbookWorkerGroupsListResult} 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 _listByAutomationAccount(resourceGroupName, automationAccountName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['HybridRunbookWorkerGroupsListResult']().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); + }); +} + +/** + * Retrieve a list of hybrid runbook worker groups. + * + * @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 HybridRunbookWorkerGroupsListResult} 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 _listByAutomationAccountNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['HybridRunbookWorkerGroupsListResult']().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 HybridRunbookWorkerGroupOperations. */ +class HybridRunbookWorkerGroupOperations { + /** + * Create a HybridRunbookWorkerGroupOperations. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._update = _update; + this._listByAutomationAccount = _listByAutomationAccount; + this._listByAutomationAccountNext = _listByAutomationAccountNext; + } + + /** + * Delete a hybrid runbook worker group. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName Automation account name. + * + * @param {string} hybridRunbookWorkerGroupName The hybrid runbook worker 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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete a hybrid runbook worker group. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName Automation account name. + * + * @param {string} hybridRunbookWorkerGroupName The hybrid runbook worker 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 {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, automationAccountName, hybridRunbookWorkerGroupName, 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, automationAccountName, hybridRunbookWorkerGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName, options, optionalCallback); + } + } + + /** + * Retrieve a hybrid runbook worker group. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} hybridRunbookWorkerGroupName The hybrid runbook worker 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. + */ + getWithHttpOperationResponse(resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a hybrid runbook worker group. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} hybridRunbookWorkerGroupName The hybrid runbook worker 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 {HybridRunbookWorkerGroup} - 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 HybridRunbookWorkerGroup} 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, automationAccountName, hybridRunbookWorkerGroupName, 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, automationAccountName, hybridRunbookWorkerGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName, options, optionalCallback); + } + } + + /** + * Update a hybrid runbook worker group. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} hybridRunbookWorkerGroupName The hybrid runbook worker group + * name + * + * @param {object} parameters The hybrid runbook worker group + * + * @param {object} [parameters.credential] Sets the credential of a worker + * group. + * + * @param {string} [parameters.credential.name] Gets or sets the name of the + * credential. + * + * @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. + */ + updateWithHttpOperationResponse(resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Update a hybrid runbook worker group. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} hybridRunbookWorkerGroupName The hybrid runbook worker group + * name + * + * @param {object} parameters The hybrid runbook worker group + * + * @param {object} [parameters.credential] Sets the credential of a worker + * group. + * + * @param {string} [parameters.credential.name] Gets or sets the name of the + * credential. + * + * @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 {HybridRunbookWorkerGroup} - 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 HybridRunbookWorkerGroup} 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. + */ + update(resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, automationAccountName, hybridRunbookWorkerGroupName, parameters, options, optionalCallback); + } + } + + /** + * Retrieve a list of hybrid runbook worker groups. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName, automationAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of hybrid runbook worker groups. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 {HybridRunbookWorkerGroupsListResult} - 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 HybridRunbookWorkerGroupsListResult} 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. + */ + listByAutomationAccount(resourceGroupName, automationAccountName, 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._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccount(resourceGroupName, automationAccountName, options, optionalCallback); + } + } + + /** + * Retrieve a list of hybrid runbook worker groups. + * + * @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. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccountNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of hybrid runbook worker groups. + * + * @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 {HybridRunbookWorkerGroupsListResult} - 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 HybridRunbookWorkerGroupsListResult} 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. + */ + listByAutomationAccountNext(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._listByAutomationAccountNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccountNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = HybridRunbookWorkerGroupOperations; diff --git a/lib/services/automationManagement/lib/lib/operations/index.d.ts b/lib/services/automationManagement/lib/lib/operations/index.d.ts new file mode 100644 index 0000000000..70eba8e768 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/operations/index.d.ts @@ -0,0 +1,12036 @@ +/* + * 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 + * AutomationAccountOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface AutomationAccountOperations { + + + /** + * Update an automation account. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} automationAccountName Automation account name. + * + * @param {object} parameters Parameters supplied to the update automation + * account. + * + * @param {object} [parameters.sku] Gets or sets account SKU. + * + * @param {string} parameters.sku.name Gets or sets the SKU name of the + * account. Possible values include: 'Free', 'Basic' + * + * @param {string} [parameters.sku.family] Gets or sets the SKU family. + * + * @param {number} [parameters.sku.capacity] Gets or sets the SKU capacity. + * + * @param {string} [parameters.name] Gets or sets the name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, parameters: models.AutomationAccountUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Update an automation account. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} automationAccountName Automation account name. + * + * @param {object} parameters Parameters supplied to the update automation + * account. + * + * @param {object} [parameters.sku] Gets or sets account SKU. + * + * @param {string} parameters.sku.name Gets or sets the SKU name of the + * account. Possible values include: 'Free', 'Basic' + * + * @param {string} [parameters.sku.family] Gets or sets the SKU family. + * + * @param {number} [parameters.sku.capacity] Gets or sets the SKU capacity. + * + * @param {string} [parameters.name] Gets or sets the name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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 {AutomationAccount} - 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. + * + * {AutomationAccount} [result] - The deserialized result object if an error did not occur. + * See {@link AutomationAccount} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, automationAccountName: string, parameters: models.AutomationAccountUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, automationAccountName: string, parameters: models.AutomationAccountUpdateParameters, callback: ServiceCallback): void; + update(resourceGroupName: string, automationAccountName: string, parameters: models.AutomationAccountUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create or update automation account. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} automationAccountName Parameters supplied to the create or + * update automation account. + * + * @param {object} parameters Parameters supplied to the create or update + * automation account. + * + * @param {object} [parameters.sku] Gets or sets account SKU. + * + * @param {string} parameters.sku.name Gets or sets the SKU name of the + * account. Possible values include: 'Free', 'Basic' + * + * @param {string} [parameters.sku.family] Gets or sets the SKU family. + * + * @param {number} [parameters.sku.capacity] Gets or sets the SKU capacity. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, parameters: models.AutomationAccountCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create or update automation account. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} automationAccountName Parameters supplied to the create or + * update automation account. + * + * @param {object} parameters Parameters supplied to the create or update + * automation account. + * + * @param {object} [parameters.sku] Gets or sets account SKU. + * + * @param {string} parameters.sku.name Gets or sets the SKU name of the + * account. Possible values include: 'Free', 'Basic' + * + * @param {string} [parameters.sku.family] Gets or sets the SKU family. + * + * @param {number} [parameters.sku.capacity] Gets or sets the SKU capacity. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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 {AutomationAccount} - 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. + * + * {AutomationAccount} [result] - The deserialized result object if an error did not occur. + * See {@link AutomationAccount} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, automationAccountName: string, parameters: models.AutomationAccountCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, automationAccountName: string, parameters: models.AutomationAccountCreateOrUpdateParameters, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, automationAccountName: string, parameters: models.AutomationAccountCreateOrUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete an automation account. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} automationAccountName Automation account 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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete an automation account. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} automationAccountName Automation account 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 {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, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, automationAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get information about an Automation Account. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} automationAccountName The automation account 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. + */ + getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get information about an Automation Account. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} automationAccountName The automation account 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 {AutomationAccount} - 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. + * + * {AutomationAccount} [result] - The deserialized result object if an error did not occur. + * See {@link AutomationAccount} 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, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of accounts within a given resource group. + * + * @param {string} resourceGroupName The 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>; + + /** + * Retrieve a list of accounts within a given resource group. + * + * @param {string} resourceGroupName The 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 {AutomationAccountListResult} - 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. + * + * {AutomationAccountListResult} [result] - The deserialized result object if an error did not occur. + * See {@link AutomationAccountListResult} 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 Lists the Automation Accounts within an Azure subscription. + * + * Retrieve a list of accounts within a given subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * @summary Lists the Automation Accounts within an Azure subscription. + * + * Retrieve a list of accounts within a given subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {AutomationAccountListResult} - 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. + * + * {AutomationAccountListResult} [result] - The deserialized result object if an error did not occur. + * See {@link AutomationAccountListResult} 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; + + + /** + * Retrieve a list of accounts within a given resource group. + * + * @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>; + + /** + * Retrieve a list of accounts within a given resource group. + * + * @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 {AutomationAccountListResult} - 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. + * + * {AutomationAccountListResult} [result] - The deserialized result object if an error did not occur. + * See {@link AutomationAccountListResult} 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 Lists the Automation Accounts within an Azure subscription. + * + * Retrieve a list of accounts within a given subscription. + * + * @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 the Automation Accounts within an Azure subscription. + * + * Retrieve a list of accounts within a given subscription. + * + * @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 {AutomationAccountListResult} - 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. + * + * {AutomationAccountListResult} [result] - The deserialized result object if an error did not occur. + * See {@link AutomationAccountListResult} 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 + * Operations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface Operations { + + + /** + * Lists all of the available Automation REST API operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all of the available Automation REST API operations. + * + * @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; +} + +/** + * @class + * StatisticsOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface StatisticsOperations { + + + /** + * Retrieve the statistics for the account. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} automationAccountName The automation account name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the statistics for the account. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} automationAccountName The automation account name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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 {StatisticsListResult} - 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. + * + * {StatisticsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link StatisticsListResult} 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. + */ + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Usages + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface Usages { + + + /** + * Retrieve the usage for the account id. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} automationAccountName The automation account 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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the usage for the account id. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} automationAccountName The automation account 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 {UsageListResult} - 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. + * + * {UsageListResult} [result] - The deserialized result object if an error did not occur. + * See {@link UsageListResult} 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. + */ + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Keys + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface Keys { + + + /** + * Retrieve the automation keys for an account. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the automation keys for an account. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 {KeyListResult} - 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. + * + * {KeyListResult} [result] - The deserialized result object if an error did not occur. + * See {@link KeyListResult} 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. + */ + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * CertificateOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface CertificateOperations { + + + /** + * Delete the certificate. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} certificateName The name of certificate. + * + * @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, automationAccountName: string, certificateName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete the certificate. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} certificateName The name of certificate. + * + * @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, automationAccountName: string, certificateName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, automationAccountName: string, certificateName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, automationAccountName: string, certificateName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve the certificate identified by certificate name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} certificateName The name of certificate. + * + * @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, automationAccountName: string, certificateName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the certificate identified by certificate name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} certificateName The name of certificate. + * + * @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 {Certificate} - 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. + * + * {Certificate} [result] - The deserialized result object if an error did not occur. + * See {@link Certificate} 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, automationAccountName: string, certificateName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, certificateName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, certificateName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create a certificate. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} certificateName The parameters supplied to the create or + * update certificate operation. + * + * @param {object} parameters The parameters supplied to the create or update + * certificate operation. + * + * @param {string} parameters.name Gets or sets the name of the certificate. + * + * @param {string} parameters.base64Value Gets or sets the base64 encoded value + * of the certificate. + * + * @param {string} [parameters.description] Gets or sets the description of the + * certificate. + * + * @param {string} [parameters.thumbprint] Gets or sets the thumbprint of the + * certificate. + * + * @param {boolean} [parameters.isExportable] Gets or sets the is exportable + * flag of the certificate. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, certificateName: string, parameters: models.CertificateCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create a certificate. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} certificateName The parameters supplied to the create or + * update certificate operation. + * + * @param {object} parameters The parameters supplied to the create or update + * certificate operation. + * + * @param {string} parameters.name Gets or sets the name of the certificate. + * + * @param {string} parameters.base64Value Gets or sets the base64 encoded value + * of the certificate. + * + * @param {string} [parameters.description] Gets or sets the description of the + * certificate. + * + * @param {string} [parameters.thumbprint] Gets or sets the thumbprint of the + * certificate. + * + * @param {boolean} [parameters.isExportable] Gets or sets the is exportable + * flag of the certificate. + * + * @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 {Certificate} - 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. + * + * {Certificate} [result] - The deserialized result object if an error did not occur. + * See {@link Certificate} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, automationAccountName: string, certificateName: string, parameters: models.CertificateCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, automationAccountName: string, certificateName: string, parameters: models.CertificateCreateOrUpdateParameters, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, automationAccountName: string, certificateName: string, parameters: models.CertificateCreateOrUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Update a certificate. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} certificateName The parameters supplied to the update + * certificate operation. + * + * @param {object} parameters The parameters supplied to the update certificate + * operation. + * + * @param {string} [parameters.name] Gets or sets the name of the certificate. + * + * @param {string} [parameters.description] Gets or sets the description of the + * certificate. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, certificateName: string, parameters: models.CertificateUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Update a certificate. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} certificateName The parameters supplied to the update + * certificate operation. + * + * @param {object} parameters The parameters supplied to the update certificate + * operation. + * + * @param {string} [parameters.name] Gets or sets the name of the certificate. + * + * @param {string} [parameters.description] Gets or sets the description of the + * certificate. + * + * @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 {Certificate} - 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. + * + * {Certificate} [result] - The deserialized result object if an error did not occur. + * See {@link Certificate} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, automationAccountName: string, certificateName: string, parameters: models.CertificateUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, automationAccountName: string, certificateName: string, parameters: models.CertificateUpdateParameters, callback: ServiceCallback): void; + update(resourceGroupName: string, automationAccountName: string, certificateName: string, parameters: models.CertificateUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of certificates. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of certificates. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 {CertificateListResult} - 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. + * + * {CertificateListResult} [result] - The deserialized result object if an error did not occur. + * See {@link CertificateListResult} 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. + */ + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of certificates. + * + * @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. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of certificates. + * + * @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 {CertificateListResult} - 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. + * + * {CertificateListResult} [result] - The deserialized result object if an error did not occur. + * See {@link CertificateListResult} 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. + */ + listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ConnectionOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface ConnectionOperations { + + + /** + * Delete the connection. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} connectionName The name of connection. + * + * @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, automationAccountName: string, connectionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete the connection. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} connectionName The name of connection. + * + * @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 {Connection} - 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. + * + * {Connection} [result] - The deserialized result object if an error did not occur. + * See {@link Connection} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, automationAccountName: string, connectionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, automationAccountName: string, connectionName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, automationAccountName: string, connectionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve the connection identified by connection name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} connectionName The name of connection. + * + * @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, automationAccountName: string, connectionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the connection identified by connection name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} connectionName The name of connection. + * + * @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 {Connection} - 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. + * + * {Connection} [result] - The deserialized result object if an error did not occur. + * See {@link Connection} 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, automationAccountName: string, connectionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, connectionName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, connectionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create or update a connection. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} connectionName The parameters supplied to the create or + * update connection operation. + * + * @param {object} parameters The parameters supplied to the create or update + * connection operation. + * + * @param {string} parameters.name Gets or sets the name of the connection. + * + * @param {string} [parameters.description] Gets or sets the description of the + * connection. + * + * @param {object} parameters.connectionType Gets or sets the connectionType of + * the connection. + * + * @param {string} [parameters.connectionType.name] Gets or sets the name of + * the connection type. + * + * @param {object} [parameters.fieldDefinitionValues] Gets or sets the field + * definition properties of the connection. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, connectionName: string, parameters: models.ConnectionCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create or update a connection. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} connectionName The parameters supplied to the create or + * update connection operation. + * + * @param {object} parameters The parameters supplied to the create or update + * connection operation. + * + * @param {string} parameters.name Gets or sets the name of the connection. + * + * @param {string} [parameters.description] Gets or sets the description of the + * connection. + * + * @param {object} parameters.connectionType Gets or sets the connectionType of + * the connection. + * + * @param {string} [parameters.connectionType.name] Gets or sets the name of + * the connection type. + * + * @param {object} [parameters.fieldDefinitionValues] Gets or sets the field + * definition properties of the connection. + * + * @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 {Connection} - 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. + * + * {Connection} [result] - The deserialized result object if an error did not occur. + * See {@link Connection} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, automationAccountName: string, connectionName: string, parameters: models.ConnectionCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, automationAccountName: string, connectionName: string, parameters: models.ConnectionCreateOrUpdateParameters, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, automationAccountName: string, connectionName: string, parameters: models.ConnectionCreateOrUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Update a connection. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} connectionName The parameters supplied to the update a + * connection operation. + * + * @param {object} parameters The parameters supplied to the update a + * connection operation. + * + * @param {string} [parameters.name] Gets or sets the name of the connection. + * + * @param {string} [parameters.description] Gets or sets the description of the + * connection. + * + * @param {object} [parameters.fieldDefinitionValues] Gets or sets the field + * definition values of the connection. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, connectionName: string, parameters: models.ConnectionUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Update a connection. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} connectionName The parameters supplied to the update a + * connection operation. + * + * @param {object} parameters The parameters supplied to the update a + * connection operation. + * + * @param {string} [parameters.name] Gets or sets the name of the connection. + * + * @param {string} [parameters.description] Gets or sets the description of the + * connection. + * + * @param {object} [parameters.fieldDefinitionValues] Gets or sets the field + * definition values of the connection. + * + * @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 {Connection} - 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. + * + * {Connection} [result] - The deserialized result object if an error did not occur. + * See {@link Connection} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, automationAccountName: string, connectionName: string, parameters: models.ConnectionUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, automationAccountName: string, connectionName: string, parameters: models.ConnectionUpdateParameters, callback: ServiceCallback): void; + update(resourceGroupName: string, automationAccountName: string, connectionName: string, parameters: models.ConnectionUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of connections. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of connections. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 {ConnectionListResult} - 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. + * + * {ConnectionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ConnectionListResult} 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. + */ + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of connections. + * + * @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. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of connections. + * + * @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 {ConnectionListResult} - 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. + * + * {ConnectionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ConnectionListResult} 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. + */ + listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ConnectionTypeOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface ConnectionTypeOperations { + + + /** + * Delete the connectiontype. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} connectionTypeName The name of connectiontype. + * + * @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, automationAccountName: string, connectionTypeName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete the connectiontype. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} connectionTypeName The name of connectiontype. + * + * @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, automationAccountName: string, connectionTypeName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, automationAccountName: string, connectionTypeName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, automationAccountName: string, connectionTypeName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve the connectiontype identified by connectiontype name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} connectionTypeName The name of connectiontype. + * + * @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, automationAccountName: string, connectionTypeName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the connectiontype identified by connectiontype name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} connectionTypeName The name of connectiontype. + * + * @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 {ConnectionType} - 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. + * + * {ConnectionType} [result] - The deserialized result object if an error did not occur. + * See {@link ConnectionType} 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, automationAccountName: string, connectionTypeName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, connectionTypeName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, connectionTypeName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create a connectiontype. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} connectionTypeName The parameters supplied to the create or + * update connectiontype operation. + * + * @param {object} parameters The parameters supplied to the create or update + * connectiontype operation. + * + * @param {string} parameters.name Gets or sets the name of the connection + * type. + * + * @param {boolean} [parameters.isGlobal] Gets or sets a Boolean value to + * indicate if the connection type is global. + * + * @param {object} parameters.fieldDefinitions Gets or sets the field + * definitions of the connection type. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, connectionTypeName: string, parameters: models.ConnectionTypeCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create a connectiontype. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} connectionTypeName The parameters supplied to the create or + * update connectiontype operation. + * + * @param {object} parameters The parameters supplied to the create or update + * connectiontype operation. + * + * @param {string} parameters.name Gets or sets the name of the connection + * type. + * + * @param {boolean} [parameters.isGlobal] Gets or sets a Boolean value to + * indicate if the connection type is global. + * + * @param {object} parameters.fieldDefinitions Gets or sets the field + * definitions of the connection type. + * + * @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 {ConnectionType} - 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. + * + * {ConnectionType} [result] - The deserialized result object if an error did not occur. + * See {@link ConnectionType} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, automationAccountName: string, connectionTypeName: string, parameters: models.ConnectionTypeCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, automationAccountName: string, connectionTypeName: string, parameters: models.ConnectionTypeCreateOrUpdateParameters, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, automationAccountName: string, connectionTypeName: string, parameters: models.ConnectionTypeCreateOrUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of connectiontypes. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of connectiontypes. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 {ConnectionTypeListResult} - 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. + * + * {ConnectionTypeListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ConnectionTypeListResult} 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. + */ + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of connectiontypes. + * + * @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. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of connectiontypes. + * + * @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 {ConnectionTypeListResult} - 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. + * + * {ConnectionTypeListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ConnectionTypeListResult} 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. + */ + listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * CredentialOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface CredentialOperations { + + + /** + * Delete the credential. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} credentialName The name of credential. + * + * @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, automationAccountName: string, credentialName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete the credential. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} credentialName The name of credential. + * + * @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, automationAccountName: string, credentialName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, automationAccountName: string, credentialName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, automationAccountName: string, credentialName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve the credential identified by credential name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} credentialName The name of credential. + * + * @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, automationAccountName: string, credentialName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the credential identified by credential name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} credentialName The name of credential. + * + * @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 {Credential} - 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. + * + * {Credential} [result] - The deserialized result object if an error did not occur. + * See {@link Credential} 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, automationAccountName: string, credentialName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, credentialName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, credentialName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create a credential. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} credentialName The parameters supplied to the create or + * update credential operation. + * + * @param {object} parameters The parameters supplied to the create or update + * credential operation. + * + * @param {string} parameters.name Gets or sets the name of the credential. + * + * @param {string} parameters.userName Gets or sets the user name of the + * credential. + * + * @param {string} parameters.password Gets or sets the password of the + * credential. + * + * @param {string} [parameters.description] Gets or sets the description of the + * credential. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, credentialName: string, parameters: models.CredentialCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create a credential. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} credentialName The parameters supplied to the create or + * update credential operation. + * + * @param {object} parameters The parameters supplied to the create or update + * credential operation. + * + * @param {string} parameters.name Gets or sets the name of the credential. + * + * @param {string} parameters.userName Gets or sets the user name of the + * credential. + * + * @param {string} parameters.password Gets or sets the password of the + * credential. + * + * @param {string} [parameters.description] Gets or sets the description of the + * credential. + * + * @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 {Credential} - 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. + * + * {Credential} [result] - The deserialized result object if an error did not occur. + * See {@link Credential} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, automationAccountName: string, credentialName: string, parameters: models.CredentialCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, automationAccountName: string, credentialName: string, parameters: models.CredentialCreateOrUpdateParameters, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, automationAccountName: string, credentialName: string, parameters: models.CredentialCreateOrUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Update a credential. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} credentialName The parameters supplied to the Update + * credential operation. + * + * @param {object} parameters The parameters supplied to the Update credential + * operation. + * + * @param {string} [parameters.name] Gets or sets the name of the credential. + * + * @param {string} [parameters.userName] Gets or sets the user name of the + * credential. + * + * @param {string} [parameters.password] Gets or sets the password of the + * credential. + * + * @param {string} [parameters.description] Gets or sets the description of the + * credential. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, credentialName: string, parameters: models.CredentialUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Update a credential. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} credentialName The parameters supplied to the Update + * credential operation. + * + * @param {object} parameters The parameters supplied to the Update credential + * operation. + * + * @param {string} [parameters.name] Gets or sets the name of the credential. + * + * @param {string} [parameters.userName] Gets or sets the user name of the + * credential. + * + * @param {string} [parameters.password] Gets or sets the password of the + * credential. + * + * @param {string} [parameters.description] Gets or sets the description of the + * credential. + * + * @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 {Credential} - 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. + * + * {Credential} [result] - The deserialized result object if an error did not occur. + * See {@link Credential} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, automationAccountName: string, credentialName: string, parameters: models.CredentialUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, automationAccountName: string, credentialName: string, parameters: models.CredentialUpdateParameters, callback: ServiceCallback): void; + update(resourceGroupName: string, automationAccountName: string, credentialName: string, parameters: models.CredentialUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of credentials. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of credentials. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 {CredentialListResult} - 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. + * + * {CredentialListResult} [result] - The deserialized result object if an error did not occur. + * See {@link CredentialListResult} 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. + */ + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of credentials. + * + * @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. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of credentials. + * + * @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 {CredentialListResult} - 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. + * + * {CredentialListResult} [result] - The deserialized result object if an error did not occur. + * See {@link CredentialListResult} 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. + */ + listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * DscConfigurationOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface DscConfigurationOperations { + + + /** + * Delete the dsc configuration identified by configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} configurationName The configuration 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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, configurationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete the dsc configuration identified by configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} configurationName The configuration 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 {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, automationAccountName: string, configurationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, automationAccountName: string, configurationName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, automationAccountName: string, configurationName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve the configuration identified by configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} configurationName The configuration 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. + */ + getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, configurationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the configuration identified by configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} configurationName The configuration 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 {DscConfiguration} - 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. + * + * {DscConfiguration} [result] - The deserialized result object if an error did not occur. + * See {@link DscConfiguration} 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, automationAccountName: string, configurationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, configurationName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, configurationName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create the configuration identified by configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} configurationName The create or update parameters for + * configuration. + * + * @param {object} parameters The create or update parameters for + * configuration. + * + * @param {boolean} [parameters.logVerbose] Gets or sets verbose log option. + * + * @param {boolean} [parameters.logProgress] Gets or sets progress log option. + * + * @param {object} parameters.source Gets or sets the source. + * + * @param {object} [parameters.source.hash] Gets or sets the hash. + * + * @param {string} parameters.source.hash.algorithm Gets or sets the content + * hash algorithm used to hash the content. + * + * @param {string} parameters.source.hash.value Gets or sets expected hash + * value of the content. + * + * @param {string} [parameters.source.type] Gets or sets the content source + * type. Possible values include: 'embeddedContent', 'uri' + * + * @param {string} [parameters.source.value] Gets or sets the value of the + * content. This is based on the content source type. + * + * @param {string} [parameters.source.version] Gets or sets the version of the + * content. + * + * @param {object} [parameters.parameters] Gets or sets the configuration + * parameters. + * + * @param {string} [parameters.description] Gets or sets the description of the + * configuration. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, configurationName: string, parameters: models.DscConfigurationCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create the configuration identified by configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} configurationName The create or update parameters for + * configuration. + * + * @param {object} parameters The create or update parameters for + * configuration. + * + * @param {boolean} [parameters.logVerbose] Gets or sets verbose log option. + * + * @param {boolean} [parameters.logProgress] Gets or sets progress log option. + * + * @param {object} parameters.source Gets or sets the source. + * + * @param {object} [parameters.source.hash] Gets or sets the hash. + * + * @param {string} parameters.source.hash.algorithm Gets or sets the content + * hash algorithm used to hash the content. + * + * @param {string} parameters.source.hash.value Gets or sets expected hash + * value of the content. + * + * @param {string} [parameters.source.type] Gets or sets the content source + * type. Possible values include: 'embeddedContent', 'uri' + * + * @param {string} [parameters.source.value] Gets or sets the value of the + * content. This is based on the content source type. + * + * @param {string} [parameters.source.version] Gets or sets the version of the + * content. + * + * @param {object} [parameters.parameters] Gets or sets the configuration + * parameters. + * + * @param {string} [parameters.description] Gets or sets the description of the + * configuration. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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 {DscConfiguration} - 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. + * + * {DscConfiguration} [result] - The deserialized result object if an error did not occur. + * See {@link DscConfiguration} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, automationAccountName: string, configurationName: string, parameters: models.DscConfigurationCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, automationAccountName: string, configurationName: string, parameters: models.DscConfigurationCreateOrUpdateParameters, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, automationAccountName: string, configurationName: string, parameters: models.DscConfigurationCreateOrUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create the configuration identified by configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} configurationName The create or update parameters for + * configuration. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.parameters] The create or update parameters for + * configuration. + * + * @param {boolean} [options.parameters.logVerbose] Gets or sets verbose log + * option. + * + * @param {boolean} [options.parameters.logProgress] Gets or sets progress log + * option. + * + * @param {object} options.parameters.source Gets or sets the source. + * + * @param {object} [options.parameters.source.hash] Gets or sets the hash. + * + * @param {string} options.parameters.source.hash.algorithm Gets or sets the + * content hash algorithm used to hash the content. + * + * @param {string} options.parameters.source.hash.value Gets or sets expected + * hash value of the content. + * + * @param {string} [options.parameters.source.type] Gets or sets the content + * source type. Possible values include: 'embeddedContent', 'uri' + * + * @param {string} [options.parameters.source.value] Gets or sets the value of + * the content. This is based on the content source type. + * + * @param {string} [options.parameters.source.version] Gets or sets the version + * of the content. + * + * @param {object} [options.parameters.parameters] Gets or sets the + * configuration parameters. + * + * @param {string} [options.parameters.description] Gets or sets the + * description of the configuration. + * + * @param {string} [options.parameters.name] Gets or sets name of the resource. + * + * @param {object} [options.parameters.tags] Gets or sets the tags attached to + * the resource. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, configurationName: string, options?: { parameters? : models.DscConfigurationUpdateParameters, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create the configuration identified by configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} configurationName The create or update parameters for + * configuration. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.parameters] The create or update parameters for + * configuration. + * + * @param {boolean} [options.parameters.logVerbose] Gets or sets verbose log + * option. + * + * @param {boolean} [options.parameters.logProgress] Gets or sets progress log + * option. + * + * @param {object} options.parameters.source Gets or sets the source. + * + * @param {object} [options.parameters.source.hash] Gets or sets the hash. + * + * @param {string} options.parameters.source.hash.algorithm Gets or sets the + * content hash algorithm used to hash the content. + * + * @param {string} options.parameters.source.hash.value Gets or sets expected + * hash value of the content. + * + * @param {string} [options.parameters.source.type] Gets or sets the content + * source type. Possible values include: 'embeddedContent', 'uri' + * + * @param {string} [options.parameters.source.value] Gets or sets the value of + * the content. This is based on the content source type. + * + * @param {string} [options.parameters.source.version] Gets or sets the version + * of the content. + * + * @param {object} [options.parameters.parameters] Gets or sets the + * configuration parameters. + * + * @param {string} [options.parameters.description] Gets or sets the + * description of the configuration. + * + * @param {string} [options.parameters.name] Gets or sets name of the resource. + * + * @param {object} [options.parameters.tags] Gets or sets the tags attached to + * the resource. + * + * @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 {DscConfiguration} - 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. + * + * {DscConfiguration} [result] - The deserialized result object if an error did not occur. + * See {@link DscConfiguration} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, automationAccountName: string, configurationName: string, options?: { parameters? : models.DscConfigurationUpdateParameters, customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, automationAccountName: string, configurationName: string, callback: ServiceCallback): void; + update(resourceGroupName: string, automationAccountName: string, configurationName: string, options: { parameters? : models.DscConfigurationUpdateParameters, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve the configuration script identified by configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} configurationName The configuration 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. + */ + getContentWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, configurationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the configuration script identified by configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} configurationName The configuration 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 {String} - 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. + * + * {String} [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. + */ + getContent(resourceGroupName: string, automationAccountName: string, configurationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getContent(resourceGroupName: string, automationAccountName: string, configurationName: string, callback: ServiceCallback): void; + getContent(resourceGroupName: string, automationAccountName: string, configurationName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of configurations. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of configurations. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 {DscConfigurationListResult} - 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. + * + * {DscConfigurationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DscConfigurationListResult} 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. + */ + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of configurations. + * + * @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. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of configurations. + * + * @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 {DscConfigurationListResult} - 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. + * + * {DscConfigurationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DscConfigurationListResult} 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. + */ + listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * HybridRunbookWorkerGroupOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface HybridRunbookWorkerGroupOperations { + + + /** + * Delete a hybrid runbook worker group. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName Automation account name. + * + * @param {string} hybridRunbookWorkerGroupName The hybrid runbook worker 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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, hybridRunbookWorkerGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete a hybrid runbook worker group. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName Automation account name. + * + * @param {string} hybridRunbookWorkerGroupName The hybrid runbook worker 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 {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, automationAccountName: string, hybridRunbookWorkerGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, automationAccountName: string, hybridRunbookWorkerGroupName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, automationAccountName: string, hybridRunbookWorkerGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a hybrid runbook worker group. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} hybridRunbookWorkerGroupName The hybrid runbook worker 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. + */ + getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, hybridRunbookWorkerGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a hybrid runbook worker group. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} hybridRunbookWorkerGroupName The hybrid runbook worker 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 {HybridRunbookWorkerGroup} - 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. + * + * {HybridRunbookWorkerGroup} [result] - The deserialized result object if an error did not occur. + * See {@link HybridRunbookWorkerGroup} 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, automationAccountName: string, hybridRunbookWorkerGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, hybridRunbookWorkerGroupName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, hybridRunbookWorkerGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Update a hybrid runbook worker group. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} hybridRunbookWorkerGroupName The hybrid runbook worker group + * name + * + * @param {object} parameters The hybrid runbook worker group + * + * @param {object} [parameters.credential] Sets the credential of a worker + * group. + * + * @param {string} [parameters.credential.name] Gets or sets the name of the + * credential. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, hybridRunbookWorkerGroupName: string, parameters: models.HybridRunbookWorkerGroupUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Update a hybrid runbook worker group. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} hybridRunbookWorkerGroupName The hybrid runbook worker group + * name + * + * @param {object} parameters The hybrid runbook worker group + * + * @param {object} [parameters.credential] Sets the credential of a worker + * group. + * + * @param {string} [parameters.credential.name] Gets or sets the name of the + * credential. + * + * @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 {HybridRunbookWorkerGroup} - 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. + * + * {HybridRunbookWorkerGroup} [result] - The deserialized result object if an error did not occur. + * See {@link HybridRunbookWorkerGroup} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, automationAccountName: string, hybridRunbookWorkerGroupName: string, parameters: models.HybridRunbookWorkerGroupUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, automationAccountName: string, hybridRunbookWorkerGroupName: string, parameters: models.HybridRunbookWorkerGroupUpdateParameters, callback: ServiceCallback): void; + update(resourceGroupName: string, automationAccountName: string, hybridRunbookWorkerGroupName: string, parameters: models.HybridRunbookWorkerGroupUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of hybrid runbook worker groups. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of hybrid runbook worker groups. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 {HybridRunbookWorkerGroupsListResult} - 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. + * + * {HybridRunbookWorkerGroupsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link HybridRunbookWorkerGroupsListResult} 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. + */ + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of hybrid runbook worker groups. + * + * @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. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of hybrid runbook worker groups. + * + * @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 {HybridRunbookWorkerGroupsListResult} - 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. + * + * {HybridRunbookWorkerGroupsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link HybridRunbookWorkerGroupsListResult} 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. + */ + listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * JobScheduleOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface JobScheduleOperations { + + + /** + * Delete the job schedule identified by job schedule name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {uuid} jobScheduleId The job schedule 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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, jobScheduleId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete the job schedule identified by job schedule name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {uuid} jobScheduleId The job schedule 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 {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, automationAccountName: string, jobScheduleId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, automationAccountName: string, jobScheduleId: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, automationAccountName: string, jobScheduleId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve the job schedule identified by job schedule name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {uuid} jobScheduleId The job schedule 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. + */ + getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, jobScheduleId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the job schedule identified by job schedule name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {uuid} jobScheduleId The job schedule 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 {JobSchedule} - 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. + * + * {JobSchedule} [result] - The deserialized result object if an error did not occur. + * See {@link JobSchedule} 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, automationAccountName: string, jobScheduleId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, jobScheduleId: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, jobScheduleId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create a job schedule. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {uuid} jobScheduleId The job schedule name. + * + * @param {object} parameters The parameters supplied to the create job + * schedule operation. + * + * @param {object} parameters.schedule Gets or sets the schedule. + * + * @param {string} [parameters.schedule.name] Gets or sets the name of the + * schedule. + * + * @param {object} parameters.runbook Gets or sets the runbook. + * + * @param {string} [parameters.runbook.name] Gets or sets the name of the + * runbook. + * + * @param {string} [parameters.runOn] Gets or sets the hybrid worker group that + * the scheduled job should run on. + * + * @param {object} [parameters.parameters] Gets or sets a list of job + * 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. + */ + createWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, jobScheduleId: string, parameters: models.JobScheduleCreateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create a job schedule. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {uuid} jobScheduleId The job schedule name. + * + * @param {object} parameters The parameters supplied to the create job + * schedule operation. + * + * @param {object} parameters.schedule Gets or sets the schedule. + * + * @param {string} [parameters.schedule.name] Gets or sets the name of the + * schedule. + * + * @param {object} parameters.runbook Gets or sets the runbook. + * + * @param {string} [parameters.runbook.name] Gets or sets the name of the + * runbook. + * + * @param {string} [parameters.runOn] Gets or sets the hybrid worker group that + * the scheduled job should run on. + * + * @param {object} [parameters.parameters] Gets or sets a list of job + * 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 {JobSchedule} - 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. + * + * {JobSchedule} [result] - The deserialized result object if an error did not occur. + * See {@link JobSchedule} 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, automationAccountName: string, jobScheduleId: string, parameters: models.JobScheduleCreateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, automationAccountName: string, jobScheduleId: string, parameters: models.JobScheduleCreateParameters, callback: ServiceCallback): void; + create(resourceGroupName: string, automationAccountName: string, jobScheduleId: string, parameters: models.JobScheduleCreateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of job schedules. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of job schedules. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 {JobScheduleListResult} - 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. + * + * {JobScheduleListResult} [result] - The deserialized result object if an error did not occur. + * See {@link JobScheduleListResult} 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. + */ + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of job schedules. + * + * @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. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of job schedules. + * + * @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 {JobScheduleListResult} - 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. + * + * {JobScheduleListResult} [result] - The deserialized result object if an error did not occur. + * See {@link JobScheduleListResult} 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. + */ + listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * LinkedWorkspaceOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface LinkedWorkspaceOperations { + + + /** + * Retrieve the linked workspace for the account id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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. + */ + getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the linked workspace for the account id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 {LinkedWorkspace} - 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. + * + * {LinkedWorkspace} [result] - The deserialized result object if an error did not occur. + * See {@link LinkedWorkspace} 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, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ActivityOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface ActivityOperations { + + + /** + * Retrieve the activity in the module identified by module name and activity + * name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The name of module. + * + * @param {string} activityName The name of activity. + * + * @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, automationAccountName: string, moduleName: string, activityName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the activity in the module identified by module name and activity + * name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The name of module. + * + * @param {string} activityName The name of activity. + * + * @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 {Activity} - 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. + * + * {Activity} [result] - The deserialized result object if an error did not occur. + * See {@link Activity} 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, automationAccountName: string, moduleName: string, activityName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, moduleName: string, activityName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, moduleName: string, activityName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of activities in the module identified by module name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The name of module. + * + * @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. + */ + listByModuleWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, moduleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of activities in the module identified by module name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The name of module. + * + * @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 {ActivityListResult} - 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. + * + * {ActivityListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ActivityListResult} 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. + */ + listByModule(resourceGroupName: string, automationAccountName: string, moduleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByModule(resourceGroupName: string, automationAccountName: string, moduleName: string, callback: ServiceCallback): void; + listByModule(resourceGroupName: string, automationAccountName: string, moduleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of activities in the module identified by module name. + * + * @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. + */ + listByModuleNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of activities in the module identified by module name. + * + * @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 {ActivityListResult} - 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. + * + * {ActivityListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ActivityListResult} 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. + */ + listByModuleNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByModuleNext(nextPageLink: string, callback: ServiceCallback): void; + listByModuleNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ModuleOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface ModuleOperations { + + + /** + * Delete the module by name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The module 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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, moduleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete the module by name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The module 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 {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, automationAccountName: string, moduleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, automationAccountName: string, moduleName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, automationAccountName: string, moduleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve the module identified by module name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The module 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. + */ + getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, moduleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the module identified by module name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The module 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 {Module} - 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. + * + * {Module} [result] - The deserialized result object if an error did not occur. + * See {@link Module} 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, automationAccountName: string, moduleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, moduleName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, moduleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create or Update the module identified by module name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The name of module. + * + * @param {object} parameters The create or update parameters for module. + * + * @param {object} parameters.contentLink Gets or sets the module content link. + * + * @param {string} [parameters.contentLink.uri] Gets or sets the uri of the + * runbook content. + * + * @param {object} [parameters.contentLink.contentHash] Gets or sets the hash. + * + * @param {string} parameters.contentLink.contentHash.algorithm Gets or sets + * the content hash algorithm used to hash the content. + * + * @param {string} parameters.contentLink.contentHash.value Gets or sets + * expected hash value of the content. + * + * @param {string} [parameters.contentLink.version] Gets or sets the version of + * the content. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, moduleName: string, parameters: models.ModuleCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create or Update the module identified by module name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The name of module. + * + * @param {object} parameters The create or update parameters for module. + * + * @param {object} parameters.contentLink Gets or sets the module content link. + * + * @param {string} [parameters.contentLink.uri] Gets or sets the uri of the + * runbook content. + * + * @param {object} [parameters.contentLink.contentHash] Gets or sets the hash. + * + * @param {string} parameters.contentLink.contentHash.algorithm Gets or sets + * the content hash algorithm used to hash the content. + * + * @param {string} parameters.contentLink.contentHash.value Gets or sets + * expected hash value of the content. + * + * @param {string} [parameters.contentLink.version] Gets or sets the version of + * the content. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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 {Module} - 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. + * + * {Module} [result] - The deserialized result object if an error did not occur. + * See {@link Module} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, automationAccountName: string, moduleName: string, parameters: models.ModuleCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, automationAccountName: string, moduleName: string, parameters: models.ModuleCreateOrUpdateParameters, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, automationAccountName: string, moduleName: string, parameters: models.ModuleCreateOrUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Update the module identified by module name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The name of module. + * + * @param {object} parameters The update parameters for module. + * + * @param {object} [parameters.contentLink] Gets or sets the module content + * link. + * + * @param {string} [parameters.contentLink.uri] Gets or sets the uri of the + * runbook content. + * + * @param {object} [parameters.contentLink.contentHash] Gets or sets the hash. + * + * @param {string} parameters.contentLink.contentHash.algorithm Gets or sets + * the content hash algorithm used to hash the content. + * + * @param {string} parameters.contentLink.contentHash.value Gets or sets + * expected hash value of the content. + * + * @param {string} [parameters.contentLink.version] Gets or sets the version of + * the content. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, moduleName: string, parameters: models.ModuleUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Update the module identified by module name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The name of module. + * + * @param {object} parameters The update parameters for module. + * + * @param {object} [parameters.contentLink] Gets or sets the module content + * link. + * + * @param {string} [parameters.contentLink.uri] Gets or sets the uri of the + * runbook content. + * + * @param {object} [parameters.contentLink.contentHash] Gets or sets the hash. + * + * @param {string} parameters.contentLink.contentHash.algorithm Gets or sets + * the content hash algorithm used to hash the content. + * + * @param {string} parameters.contentLink.contentHash.value Gets or sets + * expected hash value of the content. + * + * @param {string} [parameters.contentLink.version] Gets or sets the version of + * the content. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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 {Module} - 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. + * + * {Module} [result] - The deserialized result object if an error did not occur. + * See {@link Module} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, automationAccountName: string, moduleName: string, parameters: models.ModuleUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, automationAccountName: string, moduleName: string, parameters: models.ModuleUpdateParameters, callback: ServiceCallback): void; + update(resourceGroupName: string, automationAccountName: string, moduleName: string, parameters: models.ModuleUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of modules. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of modules. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 {ModuleListResult} - 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. + * + * {ModuleListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ModuleListResult} 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. + */ + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of modules. + * + * @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. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of modules. + * + * @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 {ModuleListResult} - 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. + * + * {ModuleListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ModuleListResult} 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. + */ + listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ObjectDataTypes + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface ObjectDataTypes { + + + /** + * Retrieve a list of fields of a given type identified by module name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The name of module. + * + * @param {string} typeName The name of type. + * + * @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. + */ + listFieldsByModuleAndTypeWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, moduleName: string, typeName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of fields of a given type identified by module name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The name of module. + * + * @param {string} typeName The name of type. + * + * @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 {TypeFieldListResult} - 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. + * + * {TypeFieldListResult} [result] - The deserialized result object if an error did not occur. + * See {@link TypeFieldListResult} 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. + */ + listFieldsByModuleAndType(resourceGroupName: string, automationAccountName: string, moduleName: string, typeName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listFieldsByModuleAndType(resourceGroupName: string, automationAccountName: string, moduleName: string, typeName: string, callback: ServiceCallback): void; + listFieldsByModuleAndType(resourceGroupName: string, automationAccountName: string, moduleName: string, typeName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of fields of a given type across all accessible modules. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} typeName The name of type. + * + * @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. + */ + listFieldsByTypeWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, typeName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of fields of a given type across all accessible modules. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} typeName The name of type. + * + * @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 {TypeFieldListResult} - 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. + * + * {TypeFieldListResult} [result] - The deserialized result object if an error did not occur. + * See {@link TypeFieldListResult} 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. + */ + listFieldsByType(resourceGroupName: string, automationAccountName: string, typeName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listFieldsByType(resourceGroupName: string, automationAccountName: string, typeName: string, callback: ServiceCallback): void; + listFieldsByType(resourceGroupName: string, automationAccountName: string, typeName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Fields + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface Fields { + + + /** + * Retrieve a list of fields of a given type identified by module name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The name of module. + * + * @param {string} typeName The name of type. + * + * @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. + */ + listByTypeWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, moduleName: string, typeName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of fields of a given type identified by module name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The name of module. + * + * @param {string} typeName The name of type. + * + * @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 {TypeFieldListResult} - 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. + * + * {TypeFieldListResult} [result] - The deserialized result object if an error did not occur. + * See {@link TypeFieldListResult} 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. + */ + listByType(resourceGroupName: string, automationAccountName: string, moduleName: string, typeName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByType(resourceGroupName: string, automationAccountName: string, moduleName: string, typeName: string, callback: ServiceCallback): void; + listByType(resourceGroupName: string, automationAccountName: string, moduleName: string, typeName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * RunbookDraftOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface RunbookDraftOperations { + + + /** + * Retrieve the content of runbook draft identified by runbook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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. + */ + getContentWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the content of runbook draft identified by runbook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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 {String} - 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. + * + * {String} [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. + */ + getContent(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getContent(resourceGroupName: string, automationAccountName: string, runbookName: string, callback: ServiceCallback): void; + getContent(resourceGroupName: string, automationAccountName: string, runbookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Replaces the runbook draft content. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook name. + * + * @param {string} runbookContent The runbook draft content. + * + * @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. + */ + replaceContentWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, runbookContent: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Replaces the runbook draft content. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook name. + * + * @param {string} runbookContent The runbook draft content. + * + * @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. + */ + replaceContent(resourceGroupName: string, automationAccountName: string, runbookName: string, runbookContent: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + replaceContent(resourceGroupName: string, automationAccountName: string, runbookName: string, runbookContent: string, callback: ServiceCallback): void; + replaceContent(resourceGroupName: string, automationAccountName: string, runbookName: string, runbookContent: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve the runbook draft identified by runbook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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. + */ + getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the runbook draft identified by runbook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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 {RunbookDraft} - 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. + * + * {RunbookDraft} [result] - The deserialized result object if an error did not occur. + * See {@link RunbookDraft} 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, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, runbookName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, runbookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Publish runbook draft. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The parameters supplied to the publish runbook + * 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. + */ + publishWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Publish runbook draft. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The parameters supplied to the publish runbook + * 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 {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. + */ + publish(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + publish(resourceGroupName: string, automationAccountName: string, runbookName: string, callback: ServiceCallback): void; + publish(resourceGroupName: string, automationAccountName: string, runbookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Undo draft edit to last known published state identified by runbook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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. + */ + undoEditWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Undo draft edit to last known published state identified by runbook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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 {RunbookDraftUndoEditResult} - 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. + * + * {RunbookDraftUndoEditResult} [result] - The deserialized result object if an error did not occur. + * See {@link RunbookDraftUndoEditResult} 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. + */ + undoEdit(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + undoEdit(resourceGroupName: string, automationAccountName: string, runbookName: string, callback: ServiceCallback): void; + undoEdit(resourceGroupName: string, automationAccountName: string, runbookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Replaces the runbook draft content. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook name. + * + * @param {string} runbookContent The runbook draft content. + * + * @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. + */ + beginReplaceContentWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, runbookContent: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Replaces the runbook draft content. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook name. + * + * @param {string} runbookContent The runbook draft content. + * + * @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. + */ + beginReplaceContent(resourceGroupName: string, automationAccountName: string, runbookName: string, runbookContent: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginReplaceContent(resourceGroupName: string, automationAccountName: string, runbookName: string, runbookContent: string, callback: ServiceCallback): void; + beginReplaceContent(resourceGroupName: string, automationAccountName: string, runbookName: string, runbookContent: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Publish runbook draft. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The parameters supplied to the publish runbook + * 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. + */ + beginPublishWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Publish runbook draft. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The parameters supplied to the publish runbook + * 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 {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. + */ + beginPublish(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginPublish(resourceGroupName: string, automationAccountName: string, runbookName: string, callback: ServiceCallback): void; + beginPublish(resourceGroupName: string, automationAccountName: string, runbookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * RunbookOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface RunbookOperations { + + + /** + * Retrieve the content of runbook identified by runbook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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. + */ + getContentWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the content of runbook identified by runbook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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 {String} - 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. + * + * {String} [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. + */ + getContent(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getContent(resourceGroupName: string, automationAccountName: string, runbookName: string, callback: ServiceCallback): void; + getContent(resourceGroupName: string, automationAccountName: string, runbookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve the runbook identified by runbook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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. + */ + getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the runbook identified by runbook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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 {Runbook} - 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. + * + * {Runbook} [result] - The deserialized result object if an error did not occur. + * See {@link Runbook} 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, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, runbookName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, runbookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create the runbook identified by runbook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook name. + * + * @param {object} parameters The create or update parameters for runbook. + * Provide either content link for a published runbook or draft, not both. + * + * @param {boolean} [parameters.logVerbose] Gets or sets verbose log option. + * + * @param {boolean} [parameters.logProgress] Gets or sets progress log option. + * + * @param {string} parameters.runbookType Gets or sets the type of the runbook. + * Possible values include: 'Script', 'Graph', 'PowerShellWorkflow', + * 'PowerShell', 'GraphPowerShellWorkflow', 'GraphPowerShell' + * + * @param {object} [parameters.draft] Gets or sets the draft runbook + * properties. + * + * @param {boolean} [parameters.draft.inEdit] Gets or sets whether runbook is + * in edit mode. + * + * @param {object} [parameters.draft.draftContentLink] Gets or sets the draft + * runbook content link. + * + * @param {date} [parameters.draft.creationTime] Gets or sets the creation time + * of the runbook draft. + * + * @param {date} [parameters.draft.lastModifiedTime] Gets or sets the last + * modified time of the runbook draft. + * + * @param {object} [parameters.draft.parameters] Gets or sets the runbook draft + * parameters. + * + * @param {array} [parameters.draft.outputTypes] Gets or sets the runbook + * output types. + * + * @param {object} [parameters.publishContentLink] Gets or sets the published + * runbook content link. + * + * @param {string} [parameters.publishContentLink.uri] Gets or sets the uri of + * the runbook content. + * + * @param {object} [parameters.publishContentLink.contentHash] Gets or sets the + * hash. + * + * @param {string} parameters.publishContentLink.contentHash.algorithm Gets or + * sets the content hash algorithm used to hash the content. + * + * @param {string} parameters.publishContentLink.contentHash.value Gets or sets + * expected hash value of the content. + * + * @param {string} [parameters.publishContentLink.version] Gets or sets the + * version of the content. + * + * @param {string} [parameters.description] Gets or sets the description of the + * runbook. + * + * @param {number} [parameters.logActivityTrace] Gets or sets the + * activity-level tracing options of the runbook. + * + * @param {string} [parameters.name] Gets or sets the name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, parameters: models.RunbookCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create the runbook identified by runbook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook name. + * + * @param {object} parameters The create or update parameters for runbook. + * Provide either content link for a published runbook or draft, not both. + * + * @param {boolean} [parameters.logVerbose] Gets or sets verbose log option. + * + * @param {boolean} [parameters.logProgress] Gets or sets progress log option. + * + * @param {string} parameters.runbookType Gets or sets the type of the runbook. + * Possible values include: 'Script', 'Graph', 'PowerShellWorkflow', + * 'PowerShell', 'GraphPowerShellWorkflow', 'GraphPowerShell' + * + * @param {object} [parameters.draft] Gets or sets the draft runbook + * properties. + * + * @param {boolean} [parameters.draft.inEdit] Gets or sets whether runbook is + * in edit mode. + * + * @param {object} [parameters.draft.draftContentLink] Gets or sets the draft + * runbook content link. + * + * @param {date} [parameters.draft.creationTime] Gets or sets the creation time + * of the runbook draft. + * + * @param {date} [parameters.draft.lastModifiedTime] Gets or sets the last + * modified time of the runbook draft. + * + * @param {object} [parameters.draft.parameters] Gets or sets the runbook draft + * parameters. + * + * @param {array} [parameters.draft.outputTypes] Gets or sets the runbook + * output types. + * + * @param {object} [parameters.publishContentLink] Gets or sets the published + * runbook content link. + * + * @param {string} [parameters.publishContentLink.uri] Gets or sets the uri of + * the runbook content. + * + * @param {object} [parameters.publishContentLink.contentHash] Gets or sets the + * hash. + * + * @param {string} parameters.publishContentLink.contentHash.algorithm Gets or + * sets the content hash algorithm used to hash the content. + * + * @param {string} parameters.publishContentLink.contentHash.value Gets or sets + * expected hash value of the content. + * + * @param {string} [parameters.publishContentLink.version] Gets or sets the + * version of the content. + * + * @param {string} [parameters.description] Gets or sets the description of the + * runbook. + * + * @param {number} [parameters.logActivityTrace] Gets or sets the + * activity-level tracing options of the runbook. + * + * @param {string} [parameters.name] Gets or sets the name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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 {Runbook} - 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. + * + * {Runbook} [result] - The deserialized result object if an error did not occur. + * See {@link Runbook} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, automationAccountName: string, runbookName: string, parameters: models.RunbookCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, automationAccountName: string, runbookName: string, parameters: models.RunbookCreateOrUpdateParameters, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, automationAccountName: string, runbookName: string, parameters: models.RunbookCreateOrUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Update the runbook identified by runbook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook name. + * + * @param {object} parameters The update parameters for runbook. + * + * @param {string} [parameters.description] Gets or sets the description of the + * runbook. + * + * @param {boolean} [parameters.logVerbose] Gets or sets verbose log option. + * + * @param {boolean} [parameters.logProgress] Gets or sets progress log option. + * + * @param {number} [parameters.logActivityTrace] Gets or sets the + * activity-level tracing options of the runbook. + * + * @param {string} [parameters.name] Gets or sets the name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, parameters: models.RunbookUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Update the runbook identified by runbook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook name. + * + * @param {object} parameters The update parameters for runbook. + * + * @param {string} [parameters.description] Gets or sets the description of the + * runbook. + * + * @param {boolean} [parameters.logVerbose] Gets or sets verbose log option. + * + * @param {boolean} [parameters.logProgress] Gets or sets progress log option. + * + * @param {number} [parameters.logActivityTrace] Gets or sets the + * activity-level tracing options of the runbook. + * + * @param {string} [parameters.name] Gets or sets the name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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 {Runbook} - 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. + * + * {Runbook} [result] - The deserialized result object if an error did not occur. + * See {@link Runbook} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, automationAccountName: string, runbookName: string, parameters: models.RunbookUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, automationAccountName: string, runbookName: string, parameters: models.RunbookUpdateParameters, callback: ServiceCallback): void; + update(resourceGroupName: string, automationAccountName: string, runbookName: string, parameters: models.RunbookUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete the runbook by name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete the runbook by name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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 {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, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, automationAccountName: string, runbookName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, automationAccountName: string, runbookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of runbooks. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of runbooks. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 {RunbookListResult} - 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. + * + * {RunbookListResult} [result] - The deserialized result object if an error did not occur. + * See {@link RunbookListResult} 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. + */ + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of runbooks. + * + * @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. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of runbooks. + * + * @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 {RunbookListResult} - 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. + * + * {RunbookListResult} [result] - The deserialized result object if an error did not occur. + * See {@link RunbookListResult} 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. + */ + listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * TestJobStreams + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface TestJobStreams { + + + /** + * Retrieve a test job stream of the test job identified by runbook name and + * stream id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook name. + * + * @param {string} jobStreamId The job stream id. + * + * @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, automationAccountName: string, runbookName: string, jobStreamId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a test job stream of the test job identified by runbook name and + * stream id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook name. + * + * @param {string} jobStreamId The job stream id. + * + * @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 {JobStream} - 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. + * + * {JobStream} [result] - The deserialized result object if an error did not occur. + * See {@link JobStream} 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, automationAccountName: string, runbookName: string, jobStreamId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, runbookName: string, jobStreamId: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, runbookName: string, jobStreamId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of test job streams identified by runbook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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. + */ + listByTestJobWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of test job streams identified by runbook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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 {JobStreamListResult} - 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. + * + * {JobStreamListResult} [result] - The deserialized result object if an error did not occur. + * See {@link JobStreamListResult} 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. + */ + listByTestJob(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByTestJob(resourceGroupName: string, automationAccountName: string, runbookName: string, callback: ServiceCallback): void; + listByTestJob(resourceGroupName: string, automationAccountName: string, runbookName: string, options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of test job streams identified by runbook name. + * + * @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. + */ + listByTestJobNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of test job streams identified by runbook name. + * + * @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 {JobStreamListResult} - 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. + * + * {JobStreamListResult} [result] - The deserialized result object if an error did not occur. + * See {@link JobStreamListResult} 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. + */ + listByTestJobNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByTestJobNext(nextPageLink: string, callback: ServiceCallback): void; + listByTestJobNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * TestJobOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface TestJobOperations { + + + /** + * Create a test job of the runbook. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The parameters supplied to the create test job + * operation. + * + * @param {object} parameters The parameters supplied to the create test job + * operation. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * test job. + * + * @param {string} [parameters.runOn] Gets or sets the runOn which specifies + * the group name where the job is to be executed. + * + * @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, automationAccountName: string, runbookName: string, parameters: models.TestJobCreateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create a test job of the runbook. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The parameters supplied to the create test job + * operation. + * + * @param {object} parameters The parameters supplied to the create test job + * operation. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * test job. + * + * @param {string} [parameters.runOn] Gets or sets the runOn which specifies + * the group name where the job is to be executed. + * + * @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 {TestJob} - 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. + * + * {TestJob} [result] - The deserialized result object if an error did not occur. + * See {@link TestJob} 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, automationAccountName: string, runbookName: string, parameters: models.TestJobCreateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, automationAccountName: string, runbookName: string, parameters: models.TestJobCreateParameters, callback: ServiceCallback): void; + create(resourceGroupName: string, automationAccountName: string, runbookName: string, parameters: models.TestJobCreateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve the test job for the specified runbook. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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. + */ + getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the test job for the specified runbook. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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 {TestJob} - 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. + * + * {TestJob} [result] - The deserialized result object if an error did not occur. + * See {@link TestJob} 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, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, runbookName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, runbookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Resume the test job. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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. + */ + resumeWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Resume the test job. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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 {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. + */ + resume(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + resume(resourceGroupName: string, automationAccountName: string, runbookName: string, callback: ServiceCallback): void; + resume(resourceGroupName: string, automationAccountName: string, runbookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Stop the test job. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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. + */ + stopWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Stop the test job. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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 {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. + */ + stop(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + stop(resourceGroupName: string, automationAccountName: string, runbookName: string, callback: ServiceCallback): void; + stop(resourceGroupName: string, automationAccountName: string, runbookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Suspend the test job. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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. + */ + suspendWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Suspend the test job. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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 {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. + */ + suspend(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + suspend(resourceGroupName: string, automationAccountName: string, runbookName: string, callback: ServiceCallback): void; + suspend(resourceGroupName: string, automationAccountName: string, runbookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ScheduleOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface ScheduleOperations { + + + /** + * Create a schedule. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} scheduleName The schedule name. + * + * @param {object} parameters The parameters supplied to the create or update + * schedule operation. + * + * @param {string} parameters.name Gets or sets the name of the schedule. + * + * @param {string} [parameters.description] Gets or sets the description of the + * schedule. + * + * @param {date} parameters.startTime Gets or sets the start time of the + * schedule. + * + * @param {date} [parameters.expiryTime] Gets or sets the end time of the + * schedule. + * + * @param {object} [parameters.interval] Gets or sets the interval of the + * schedule. + * + * @param {string} parameters.frequency Possible values include: 'OneTime', + * 'Day', 'Hour', 'Week', 'Month' + * + * @param {string} [parameters.timeZone] Gets or sets the time zone of the + * schedule. + * + * @param {object} [parameters.advancedSchedule] Gets or sets the + * AdvancedSchedule. + * + * @param {array} [parameters.advancedSchedule.weekDays] Days of the week that + * the job should execute on. + * + * @param {array} [parameters.advancedSchedule.monthDays] Days of the month + * that the job should execute on. Must be between 1 and 31. + * + * @param {array} [parameters.advancedSchedule.monthlyOccurrences] Occurrences + * of days within a month. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, scheduleName: string, parameters: models.ScheduleCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create a schedule. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} scheduleName The schedule name. + * + * @param {object} parameters The parameters supplied to the create or update + * schedule operation. + * + * @param {string} parameters.name Gets or sets the name of the schedule. + * + * @param {string} [parameters.description] Gets or sets the description of the + * schedule. + * + * @param {date} parameters.startTime Gets or sets the start time of the + * schedule. + * + * @param {date} [parameters.expiryTime] Gets or sets the end time of the + * schedule. + * + * @param {object} [parameters.interval] Gets or sets the interval of the + * schedule. + * + * @param {string} parameters.frequency Possible values include: 'OneTime', + * 'Day', 'Hour', 'Week', 'Month' + * + * @param {string} [parameters.timeZone] Gets or sets the time zone of the + * schedule. + * + * @param {object} [parameters.advancedSchedule] Gets or sets the + * AdvancedSchedule. + * + * @param {array} [parameters.advancedSchedule.weekDays] Days of the week that + * the job should execute on. + * + * @param {array} [parameters.advancedSchedule.monthDays] Days of the month + * that the job should execute on. Must be between 1 and 31. + * + * @param {array} [parameters.advancedSchedule.monthlyOccurrences] Occurrences + * of days within a month. + * + * @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 {Schedule} - 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. + * + * {Schedule} [result] - The deserialized result object if an error did not occur. + * See {@link Schedule} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, automationAccountName: string, scheduleName: string, parameters: models.ScheduleCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, automationAccountName: string, scheduleName: string, parameters: models.ScheduleCreateOrUpdateParameters, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, automationAccountName: string, scheduleName: string, parameters: models.ScheduleCreateOrUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Update the schedule identified by schedule name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} scheduleName The schedule name. + * + * @param {object} parameters The parameters supplied to the update schedule + * operation. + * + * @param {string} [parameters.name] Gets or sets the name of the schedule. + * + * @param {string} [parameters.description] Gets or sets the description of the + * schedule. + * + * @param {boolean} [parameters.isEnabled] Gets or sets a value indicating + * whether this schedule is enabled. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, scheduleName: string, parameters: models.ScheduleUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Update the schedule identified by schedule name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} scheduleName The schedule name. + * + * @param {object} parameters The parameters supplied to the update schedule + * operation. + * + * @param {string} [parameters.name] Gets or sets the name of the schedule. + * + * @param {string} [parameters.description] Gets or sets the description of the + * schedule. + * + * @param {boolean} [parameters.isEnabled] Gets or sets a value indicating + * whether this schedule is enabled. + * + * @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 {Schedule} - 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. + * + * {Schedule} [result] - The deserialized result object if an error did not occur. + * See {@link Schedule} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, automationAccountName: string, scheduleName: string, parameters: models.ScheduleUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, automationAccountName: string, scheduleName: string, parameters: models.ScheduleUpdateParameters, callback: ServiceCallback): void; + update(resourceGroupName: string, automationAccountName: string, scheduleName: string, parameters: models.ScheduleUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve the schedule identified by schedule name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} scheduleName The schedule 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. + */ + getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, scheduleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the schedule identified by schedule name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} scheduleName The schedule 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 {Schedule} - 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. + * + * {Schedule} [result] - The deserialized result object if an error did not occur. + * See {@link Schedule} 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, automationAccountName: string, scheduleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, scheduleName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, scheduleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete the schedule identified by schedule name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} scheduleName The schedule 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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, scheduleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete the schedule identified by schedule name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} scheduleName The schedule 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 {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, automationAccountName: string, scheduleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, automationAccountName: string, scheduleName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, automationAccountName: string, scheduleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of schedules. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of schedules. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 {ScheduleListResult} - 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. + * + * {ScheduleListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ScheduleListResult} 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. + */ + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of schedules. + * + * @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. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of schedules. + * + * @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 {ScheduleListResult} - 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. + * + * {ScheduleListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ScheduleListResult} 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. + */ + listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * VariableOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface VariableOperations { + + + /** + * Create a variable. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} variableName The variable name. + * + * @param {object} parameters The parameters supplied to the create or update + * variable operation. + * + * @param {string} parameters.name Gets or sets the name of the variable. + * + * @param {string} [parameters.value] Gets or sets the value of the variable. + * + * @param {string} [parameters.description] Gets or sets the description of the + * variable. + * + * @param {boolean} [parameters.isEncrypted] Gets or sets the encrypted flag of + * the variable. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, variableName: string, parameters: models.VariableCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create a variable. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} variableName The variable name. + * + * @param {object} parameters The parameters supplied to the create or update + * variable operation. + * + * @param {string} parameters.name Gets or sets the name of the variable. + * + * @param {string} [parameters.value] Gets or sets the value of the variable. + * + * @param {string} [parameters.description] Gets or sets the description of the + * variable. + * + * @param {boolean} [parameters.isEncrypted] Gets or sets the encrypted flag of + * the variable. + * + * @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 {Variable} - 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. + * + * {Variable} [result] - The deserialized result object if an error did not occur. + * See {@link Variable} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, automationAccountName: string, variableName: string, parameters: models.VariableCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, automationAccountName: string, variableName: string, parameters: models.VariableCreateOrUpdateParameters, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, automationAccountName: string, variableName: string, parameters: models.VariableCreateOrUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Update a variable. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} variableName The variable name. + * + * @param {object} parameters The parameters supplied to the update variable + * operation. + * + * @param {string} [parameters.name] Gets or sets the name of the variable. + * + * @param {string} [parameters.value] Gets or sets the value of the variable. + * + * @param {string} [parameters.description] Gets or sets the description of the + * variable. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, variableName: string, parameters: models.VariableUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Update a variable. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} variableName The variable name. + * + * @param {object} parameters The parameters supplied to the update variable + * operation. + * + * @param {string} [parameters.name] Gets or sets the name of the variable. + * + * @param {string} [parameters.value] Gets or sets the value of the variable. + * + * @param {string} [parameters.description] Gets or sets the description of the + * variable. + * + * @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 {Variable} - 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. + * + * {Variable} [result] - The deserialized result object if an error did not occur. + * See {@link Variable} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, automationAccountName: string, variableName: string, parameters: models.VariableUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, automationAccountName: string, variableName: string, parameters: models.VariableUpdateParameters, callback: ServiceCallback): void; + update(resourceGroupName: string, automationAccountName: string, variableName: string, parameters: models.VariableUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete the variable. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} variableName The name of variable. + * + * @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, automationAccountName: string, variableName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete the variable. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} variableName The name of variable. + * + * @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, automationAccountName: string, variableName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, automationAccountName: string, variableName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, automationAccountName: string, variableName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve the variable identified by variable name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} variableName The name of variable. + * + * @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, automationAccountName: string, variableName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the variable identified by variable name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} variableName The name of variable. + * + * @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 {Variable} - 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. + * + * {Variable} [result] - The deserialized result object if an error did not occur. + * See {@link Variable} 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, automationAccountName: string, variableName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, variableName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, variableName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of variables. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of variables. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 {VariableListResult} - 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. + * + * {VariableListResult} [result] - The deserialized result object if an error did not occur. + * See {@link VariableListResult} 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. + */ + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of variables. + * + * @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. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of variables. + * + * @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 {VariableListResult} - 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. + * + * {VariableListResult} [result] - The deserialized result object if an error did not occur. + * See {@link VariableListResult} 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. + */ + listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * WebhookOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface WebhookOperations { + + + /** + * Generates a Uri for use in creating a webhook. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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. + */ + generateUriWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Generates a Uri for use in creating a webhook. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 {String} - 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. + * + * {String} [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. + */ + generateUri(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + generateUri(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + generateUri(resourceGroupName: string, automationAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete the webhook by name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} webhookName The webhook 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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, webhookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete the webhook by name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} webhookName The webhook 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 {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, automationAccountName: string, webhookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, automationAccountName: string, webhookName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, automationAccountName: string, webhookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve the webhook identified by webhook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} webhookName The webhook 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. + */ + getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, webhookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the webhook identified by webhook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} webhookName The webhook 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 {Webhook} - 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. + * + * {Webhook} [result] - The deserialized result object if an error did not occur. + * See {@link Webhook} 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, automationAccountName: string, webhookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, webhookName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, webhookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create the webhook identified by webhook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} webhookName The webhook name. + * + * @param {object} parameters The create or update parameters for webhook. + * + * @param {string} parameters.name Gets or sets the name of the webhook. + * + * @param {boolean} [parameters.isEnabled] Gets or sets the value of the + * enabled flag of webhook. + * + * @param {string} [parameters.uri] Gets or sets the uri. + * + * @param {date} [parameters.expiryTime] Gets or sets the expiry time. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * job. + * + * @param {object} [parameters.runbook] Gets or sets the runbook. + * + * @param {string} [parameters.runbook.name] Gets or sets the name of the + * runbook. + * + * @param {string} [parameters.runOn] Gets or sets the name of the hybrid + * worker group the webhook job will run on. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, webhookName: string, parameters: models.WebhookCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create the webhook identified by webhook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} webhookName The webhook name. + * + * @param {object} parameters The create or update parameters for webhook. + * + * @param {string} parameters.name Gets or sets the name of the webhook. + * + * @param {boolean} [parameters.isEnabled] Gets or sets the value of the + * enabled flag of webhook. + * + * @param {string} [parameters.uri] Gets or sets the uri. + * + * @param {date} [parameters.expiryTime] Gets or sets the expiry time. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * job. + * + * @param {object} [parameters.runbook] Gets or sets the runbook. + * + * @param {string} [parameters.runbook.name] Gets or sets the name of the + * runbook. + * + * @param {string} [parameters.runOn] Gets or sets the name of the hybrid + * worker group the webhook job will run on. + * + * @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 {Webhook} - 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. + * + * {Webhook} [result] - The deserialized result object if an error did not occur. + * See {@link Webhook} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, automationAccountName: string, webhookName: string, parameters: models.WebhookCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, automationAccountName: string, webhookName: string, parameters: models.WebhookCreateOrUpdateParameters, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, automationAccountName: string, webhookName: string, parameters: models.WebhookCreateOrUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Update the webhook identified by webhook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} webhookName The webhook name. + * + * @param {object} parameters The update parameters for webhook. + * + * @param {string} [parameters.name] Gets or sets the name of the webhook. + * + * @param {boolean} [parameters.isEnabled] Gets or sets the value of the + * enabled flag of webhook. + * + * @param {string} [parameters.runOn] Gets or sets the name of the hybrid + * worker group the webhook job will run on. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * job. + * + * @param {string} [parameters.description] Gets or sets the description of the + * webhook. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, webhookName: string, parameters: models.WebhookUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Update the webhook identified by webhook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} webhookName The webhook name. + * + * @param {object} parameters The update parameters for webhook. + * + * @param {string} [parameters.name] Gets or sets the name of the webhook. + * + * @param {boolean} [parameters.isEnabled] Gets or sets the value of the + * enabled flag of webhook. + * + * @param {string} [parameters.runOn] Gets or sets the name of the hybrid + * worker group the webhook job will run on. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * job. + * + * @param {string} [parameters.description] Gets or sets the description of the + * webhook. + * + * @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 {Webhook} - 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. + * + * {Webhook} [result] - The deserialized result object if an error did not occur. + * See {@link Webhook} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, automationAccountName: string, webhookName: string, parameters: models.WebhookUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, automationAccountName: string, webhookName: string, parameters: models.WebhookUpdateParameters, callback: ServiceCallback): void; + update(resourceGroupName: string, automationAccountName: string, webhookName: string, parameters: models.WebhookUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of webhooks. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of webhooks. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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 {WebhookListResult} - 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. + * + * {WebhookListResult} [result] - The deserialized result object if an error did not occur. + * See {@link WebhookListResult} 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. + */ + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of webhooks. + * + * @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. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of webhooks. + * + * @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 {WebhookListResult} - 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. + * + * {WebhookListResult} [result] - The deserialized result object if an error did not occur. + * See {@link WebhookListResult} 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. + */ + listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * SoftwareUpdateConfigurations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface SoftwareUpdateConfigurations { + + + /** + * Create a new software update configuration with the name given in the URI. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} softwareUpdateConfigurationName The name of the software + * update configuration to be created. + * + * @param {object} parameters Request body. + * + * @param {object} parameters.updateConfiguration update specific properties + * for the Software update configuration + * + * @param {string} parameters.updateConfiguration.operatingSystem operating + * system of target machines. Possible values include: 'Windows', 'Linux' + * + * @param {object} [parameters.updateConfiguration.windows] Windows specific + * update configuration. + * + * @param {string} + * [parameters.updateConfiguration.windows.includedUpdateClassifications] + * Update classification included in the software update configuration. A comma + * separated string with required values. Possible values include: + * 'Unclassified', 'Critical', 'Security', 'UpdateRollup', 'FeaturePack', + * 'ServicePack', 'Definition', 'Tools', 'Updates' + * + * @param {array} [parameters.updateConfiguration.windows.excludedKbNumbers] KB + * numbers excluded from the software update configuration. + * + * @param {object} [parameters.updateConfiguration.linux] Linux specific update + * configuration. + * + * @param {string} + * [parameters.updateConfiguration.linux.includedPackageClassifications] Update + * classifications included in the software update configuration. Possible + * values include: 'Unclassified', 'Critical', 'Security', 'Other' + * + * @param {array} + * [parameters.updateConfiguration.linux.excludedPackageNameMasks] packages + * excluded from the software update configuration. + * + * @param {moment.duration} [parameters.updateConfiguration.duration] Maximum + * time allowed for the software update configuration run. Duration needs to be + * specified using the format PT[n]H[n]M[n]S as per ISO8601 + * + * @param {array} [parameters.updateConfiguration.azureVirtualMachines] List of + * azure resource Ids for azure virtual machines targeted by the software + * update configuration. + * + * @param {array} [parameters.updateConfiguration.nonAzureComputerNames] List + * of names of non-azure machines targeted by the software update + * configuration. + * + * @param {object} parameters.scheduleInfo Schedule information for the + * Software update configuration + * + * @param {date} [parameters.scheduleInfo.startTime] Gets or sets the start + * time of the schedule. + * + * @param {date} [parameters.scheduleInfo.expiryTime] Gets or sets the end time + * of the schedule. + * + * @param {number} [parameters.scheduleInfo.expiryTimeOffsetMinutes] Gets or + * sets the expiry time's offset in minutes. + * + * @param {boolean} [parameters.scheduleInfo.isEnabled] Gets or sets a value + * indicating whether this schedule is enabled. + * + * @param {date} [parameters.scheduleInfo.nextRun] Gets or sets the next run + * time of the schedule. + * + * @param {number} [parameters.scheduleInfo.nextRunOffsetMinutes] Gets or sets + * the next run time's offset in minutes. + * + * @param {number} [parameters.scheduleInfo.interval] Gets or sets the interval + * of the schedule. + * + * @param {string} [parameters.scheduleInfo.frequency] Gets or sets the + * frequency of the schedule. Possible values include: 'OneTime', 'Day', + * 'Hour', 'Week', 'Month' + * + * @param {string} [parameters.scheduleInfo.timeZone] Gets or sets the time + * zone of the schedule. + * + * @param {object} [parameters.scheduleInfo.advancedSchedule] Gets or sets the + * advanced schedule. + * + * @param {array} [parameters.scheduleInfo.advancedSchedule.weekDays] Days of + * the week that the job should execute on. + * + * @param {array} [parameters.scheduleInfo.advancedSchedule.monthDays] Days of + * the month that the job should execute on. Must be between 1 and 31. + * + * @param {array} [parameters.scheduleInfo.advancedSchedule.monthlyOccurrences] + * Occurrences of days within a month. + * + * @param {date} [parameters.scheduleInfo.creationTime] Gets or sets the + * creation time. + * + * @param {date} [parameters.scheduleInfo.lastModifiedTime] Gets or sets the + * last modified time. + * + * @param {string} [parameters.scheduleInfo.description] Gets or sets the + * description. + * + * @param {object} [parameters.error] detailes of provisioning error + * + * @param {string} [parameters.error.code] Error code + * + * @param {string} [parameters.error.message] Error message indicating why the + * operation failed. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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, automationAccountName: string, softwareUpdateConfigurationName: string, parameters: models.SoftwareUpdateConfiguration, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create a new software update configuration with the name given in the URI. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} softwareUpdateConfigurationName The name of the software + * update configuration to be created. + * + * @param {object} parameters Request body. + * + * @param {object} parameters.updateConfiguration update specific properties + * for the Software update configuration + * + * @param {string} parameters.updateConfiguration.operatingSystem operating + * system of target machines. Possible values include: 'Windows', 'Linux' + * + * @param {object} [parameters.updateConfiguration.windows] Windows specific + * update configuration. + * + * @param {string} + * [parameters.updateConfiguration.windows.includedUpdateClassifications] + * Update classification included in the software update configuration. A comma + * separated string with required values. Possible values include: + * 'Unclassified', 'Critical', 'Security', 'UpdateRollup', 'FeaturePack', + * 'ServicePack', 'Definition', 'Tools', 'Updates' + * + * @param {array} [parameters.updateConfiguration.windows.excludedKbNumbers] KB + * numbers excluded from the software update configuration. + * + * @param {object} [parameters.updateConfiguration.linux] Linux specific update + * configuration. + * + * @param {string} + * [parameters.updateConfiguration.linux.includedPackageClassifications] Update + * classifications included in the software update configuration. Possible + * values include: 'Unclassified', 'Critical', 'Security', 'Other' + * + * @param {array} + * [parameters.updateConfiguration.linux.excludedPackageNameMasks] packages + * excluded from the software update configuration. + * + * @param {moment.duration} [parameters.updateConfiguration.duration] Maximum + * time allowed for the software update configuration run. Duration needs to be + * specified using the format PT[n]H[n]M[n]S as per ISO8601 + * + * @param {array} [parameters.updateConfiguration.azureVirtualMachines] List of + * azure resource Ids for azure virtual machines targeted by the software + * update configuration. + * + * @param {array} [parameters.updateConfiguration.nonAzureComputerNames] List + * of names of non-azure machines targeted by the software update + * configuration. + * + * @param {object} parameters.scheduleInfo Schedule information for the + * Software update configuration + * + * @param {date} [parameters.scheduleInfo.startTime] Gets or sets the start + * time of the schedule. + * + * @param {date} [parameters.scheduleInfo.expiryTime] Gets or sets the end time + * of the schedule. + * + * @param {number} [parameters.scheduleInfo.expiryTimeOffsetMinutes] Gets or + * sets the expiry time's offset in minutes. + * + * @param {boolean} [parameters.scheduleInfo.isEnabled] Gets or sets a value + * indicating whether this schedule is enabled. + * + * @param {date} [parameters.scheduleInfo.nextRun] Gets or sets the next run + * time of the schedule. + * + * @param {number} [parameters.scheduleInfo.nextRunOffsetMinutes] Gets or sets + * the next run time's offset in minutes. + * + * @param {number} [parameters.scheduleInfo.interval] Gets or sets the interval + * of the schedule. + * + * @param {string} [parameters.scheduleInfo.frequency] Gets or sets the + * frequency of the schedule. Possible values include: 'OneTime', 'Day', + * 'Hour', 'Week', 'Month' + * + * @param {string} [parameters.scheduleInfo.timeZone] Gets or sets the time + * zone of the schedule. + * + * @param {object} [parameters.scheduleInfo.advancedSchedule] Gets or sets the + * advanced schedule. + * + * @param {array} [parameters.scheduleInfo.advancedSchedule.weekDays] Days of + * the week that the job should execute on. + * + * @param {array} [parameters.scheduleInfo.advancedSchedule.monthDays] Days of + * the month that the job should execute on. Must be between 1 and 31. + * + * @param {array} [parameters.scheduleInfo.advancedSchedule.monthlyOccurrences] + * Occurrences of days within a month. + * + * @param {date} [parameters.scheduleInfo.creationTime] Gets or sets the + * creation time. + * + * @param {date} [parameters.scheduleInfo.lastModifiedTime] Gets or sets the + * last modified time. + * + * @param {string} [parameters.scheduleInfo.description] Gets or sets the + * description. + * + * @param {object} [parameters.error] detailes of provisioning error + * + * @param {string} [parameters.error.code] Error code + * + * @param {string} [parameters.error.message] Error message indicating why the + * operation failed. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 {SoftwareUpdateConfiguration} - 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. + * + * {SoftwareUpdateConfiguration} [result] - The deserialized result object if an error did not occur. + * See {@link SoftwareUpdateConfiguration} 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, automationAccountName: string, softwareUpdateConfigurationName: string, parameters: models.SoftwareUpdateConfiguration, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, automationAccountName: string, softwareUpdateConfigurationName: string, parameters: models.SoftwareUpdateConfiguration, callback: ServiceCallback): void; + create(resourceGroupName: string, automationAccountName: string, softwareUpdateConfigurationName: string, parameters: models.SoftwareUpdateConfiguration, options: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get a single software update configuration by name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} softwareUpdateConfigurationName The name of the software + * update configuration to be created. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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. + */ + getByNameWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, softwareUpdateConfigurationName: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get a single software update configuration by name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} softwareUpdateConfigurationName The name of the software + * update configuration to be created. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 {SoftwareUpdateConfiguration} - 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. + * + * {SoftwareUpdateConfiguration} [result] - The deserialized result object if an error did not occur. + * See {@link SoftwareUpdateConfiguration} 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. + */ + getByName(resourceGroupName: string, automationAccountName: string, softwareUpdateConfigurationName: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + getByName(resourceGroupName: string, automationAccountName: string, softwareUpdateConfigurationName: string, callback: ServiceCallback): void; + getByName(resourceGroupName: string, automationAccountName: string, softwareUpdateConfigurationName: string, options: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * delete a specific software update configuration. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} softwareUpdateConfigurationName The name of the software + * update configuration to be created. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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, automationAccountName: string, softwareUpdateConfigurationName: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * delete a specific software update configuration. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} softwareUpdateConfigurationName The name of the software + * update configuration to be created. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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, automationAccountName: string, softwareUpdateConfigurationName: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, automationAccountName: string, softwareUpdateConfigurationName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, automationAccountName: string, softwareUpdateConfigurationName: string, options: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get all software update configurations for the account. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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(resourceGroupName: string, automationAccountName: string, options?: { clientRequestId? : string, filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get all software update configurations for the account. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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 {SoftwareUpdateConfigurationListResult} - 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. + * + * {SoftwareUpdateConfigurationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SoftwareUpdateConfigurationListResult} 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(resourceGroupName: string, automationAccountName: string, options?: { clientRequestId? : string, filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, automationAccountName: string, options: { clientRequestId? : string, filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * SoftwareUpdateConfigurationRuns + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface SoftwareUpdateConfigurationRuns { + + + /** + * Get a single software update configuration Run by Id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {uuid} softwareUpdateConfigurationRunId The Id of the software update + * configuration run. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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. + */ + getByIdWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, softwareUpdateConfigurationRunId: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get a single software update configuration Run by Id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {uuid} softwareUpdateConfigurationRunId The Id of the software update + * configuration run. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 {SoftwareUpdateConfigurationRun} - 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. + * + * {SoftwareUpdateConfigurationRun} [result] - The deserialized result object if an error did not occur. + * See {@link SoftwareUpdateConfigurationRun} 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. + */ + getById(resourceGroupName: string, automationAccountName: string, softwareUpdateConfigurationRunId: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + getById(resourceGroupName: string, automationAccountName: string, softwareUpdateConfigurationRunId: string, callback: ServiceCallback): void; + getById(resourceGroupName: string, automationAccountName: string, softwareUpdateConfigurationRunId: string, options: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Return list of software update configuration runs + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @param {string} [options.filter] The filter to apply on the operation. You + * can use the following filters: 'properties/osType', 'properties/status', + * 'properties/startTime', and 'properties/softwareUpdateConfiguration/name' + * + * @param {string} [options.skip] number of entries you skip before returning + * results + * + * @param {string} [options.top] Maximum number of entries returned in the + * results collection + * + * @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(resourceGroupName: string, automationAccountName: string, options?: { clientRequestId? : string, filter? : string, skip? : string, top? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Return list of software update configuration runs + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @param {string} [options.filter] The filter to apply on the operation. You + * can use the following filters: 'properties/osType', 'properties/status', + * 'properties/startTime', and 'properties/softwareUpdateConfiguration/name' + * + * @param {string} [options.skip] number of entries you skip before returning + * results + * + * @param {string} [options.top] Maximum number of entries returned in the + * results collection + * + * @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 {SoftwareUpdateConfigurationRunListResult} - 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. + * + * {SoftwareUpdateConfigurationRunListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SoftwareUpdateConfigurationRunListResult} + * 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(resourceGroupName: string, automationAccountName: string, options?: { clientRequestId? : string, filter? : string, skip? : string, top? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, automationAccountName: string, options: { clientRequestId? : string, filter? : string, skip? : string, top? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * SoftwareUpdateConfigurationMachineRuns + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface SoftwareUpdateConfigurationMachineRuns { + + + /** + * Get a single software update configuration machine run by Id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {uuid} softwareUpdateConfigurationMachineRunId The Id of the software + * update configuration machine run. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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. + */ + getByIdWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, softwareUpdateConfigurationMachineRunId: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get a single software update configuration machine run by Id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {uuid} softwareUpdateConfigurationMachineRunId The Id of the software + * update configuration machine run. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 {SoftwareUpdateConfigurationMachineRun} - 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. + * + * {SoftwareUpdateConfigurationMachineRun} [result] - The deserialized result object if an error did not occur. + * See {@link SoftwareUpdateConfigurationMachineRun} 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. + */ + getById(resourceGroupName: string, automationAccountName: string, softwareUpdateConfigurationMachineRunId: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + getById(resourceGroupName: string, automationAccountName: string, softwareUpdateConfigurationMachineRunId: string, callback: ServiceCallback): void; + getById(resourceGroupName: string, automationAccountName: string, softwareUpdateConfigurationMachineRunId: string, options: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Return list of software update configuration machine runs + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @param {string} [options.filter] The filter to apply on the operation. You + * can use the following filters: 'properties/osType', 'properties/status', + * 'properties/startTime', and 'properties/softwareUpdateConfiguration/name' + * + * @param {string} [options.skip] number of entries you skip before returning + * results + * + * @param {string} [options.top] Maximum number of entries returned in the + * results collection + * + * @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(resourceGroupName: string, automationAccountName: string, options?: { clientRequestId? : string, filter? : string, skip? : string, top? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Return list of software update configuration machine runs + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @param {string} [options.filter] The filter to apply on the operation. You + * can use the following filters: 'properties/osType', 'properties/status', + * 'properties/startTime', and 'properties/softwareUpdateConfiguration/name' + * + * @param {string} [options.skip] number of entries you skip before returning + * results + * + * @param {string} [options.top] Maximum number of entries returned in the + * results collection + * + * @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 {SoftwareUpdateConfigurationMachineRunListResult} - 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. + * + * {SoftwareUpdateConfigurationMachineRunListResult} [result] - The deserialized result object if an error did not occur. + * See {@link + * SoftwareUpdateConfigurationMachineRunListResult} 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(resourceGroupName: string, automationAccountName: string, options?: { clientRequestId? : string, filter? : string, skip? : string, top? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, automationAccountName: string, options: { clientRequestId? : string, filter? : string, skip? : string, top? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * SourceControlOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface SourceControlOperations { + + + /** + * Create a source control. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {object} parameters The parameters supplied to the create or update + * source control operation. + * + * @param {string} [parameters.repoUrl] Gets or sets the repo url of the source + * control. + * + * @param {string} [parameters.branch] Gets or sets the repo branch of the + * source control. Include branch as empty string for VsoTfvc. + * + * @param {string} [parameters.folderPath] Gets or sets the folder path of the + * source control. Path must be relative. + * + * @param {boolean} [parameters.autoSync] Gets or sets auto async of the source + * control. Default is false. + * + * @param {boolean} [parameters.publishRunbook] Gets or sets the auto publish + * of the source control. Default is true. + * + * @param {string} [parameters.sourceType] The source type. Must be one of + * VsoGit, VsoTfvc, GitHub, case sensitive. Possible values include: 'VsoGit', + * 'VsoTfvc', 'GitHub' + * + * @param {string} [parameters.securityToken] Gets or sets the authorization + * token for the repo of the source control. + * + * @param {string} [parameters.description] Gets or sets the user description + * of the source control. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, sourceControlName: string, parameters: models.SourceControlCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create a source control. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {object} parameters The parameters supplied to the create or update + * source control operation. + * + * @param {string} [parameters.repoUrl] Gets or sets the repo url of the source + * control. + * + * @param {string} [parameters.branch] Gets or sets the repo branch of the + * source control. Include branch as empty string for VsoTfvc. + * + * @param {string} [parameters.folderPath] Gets or sets the folder path of the + * source control. Path must be relative. + * + * @param {boolean} [parameters.autoSync] Gets or sets auto async of the source + * control. Default is false. + * + * @param {boolean} [parameters.publishRunbook] Gets or sets the auto publish + * of the source control. Default is true. + * + * @param {string} [parameters.sourceType] The source type. Must be one of + * VsoGit, VsoTfvc, GitHub, case sensitive. Possible values include: 'VsoGit', + * 'VsoTfvc', 'GitHub' + * + * @param {string} [parameters.securityToken] Gets or sets the authorization + * token for the repo of the source control. + * + * @param {string} [parameters.description] Gets or sets the user description + * of the source control. + * + * @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 {SourceControl} - 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. + * + * {SourceControl} [result] - The deserialized result object if an error did not occur. + * See {@link SourceControl} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, automationAccountName: string, sourceControlName: string, parameters: models.SourceControlCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, automationAccountName: string, sourceControlName: string, parameters: models.SourceControlCreateOrUpdateParameters, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, automationAccountName: string, sourceControlName: string, parameters: models.SourceControlCreateOrUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Update a source control. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {object} parameters The parameters supplied to the update source + * control operation. + * + * @param {string} [parameters.branch] Gets or sets the repo branch of the + * source control. + * + * @param {string} [parameters.folderPath] Gets or sets the folder path of the + * source control. Path must be relative. + * + * @param {boolean} [parameters.autoSync] Gets or sets auto async of the source + * control. Default is false. + * + * @param {boolean} [parameters.publishRunbook] Gets or sets the auto publish + * of the source control. Default is true. + * + * @param {string} [parameters.securityToken] Gets or sets the authorization + * token for the repo of the source control. + * + * @param {string} [parameters.description] Gets or sets the user description + * of the source control. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, sourceControlName: string, parameters: models.SourceControlUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Update a source control. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {object} parameters The parameters supplied to the update source + * control operation. + * + * @param {string} [parameters.branch] Gets or sets the repo branch of the + * source control. + * + * @param {string} [parameters.folderPath] Gets or sets the folder path of the + * source control. Path must be relative. + * + * @param {boolean} [parameters.autoSync] Gets or sets auto async of the source + * control. Default is false. + * + * @param {boolean} [parameters.publishRunbook] Gets or sets the auto publish + * of the source control. Default is true. + * + * @param {string} [parameters.securityToken] Gets or sets the authorization + * token for the repo of the source control. + * + * @param {string} [parameters.description] Gets or sets the user description + * of the source control. + * + * @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 {SourceControl} - 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. + * + * {SourceControl} [result] - The deserialized result object if an error did not occur. + * See {@link SourceControl} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, automationAccountName: string, sourceControlName: string, parameters: models.SourceControlUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, automationAccountName: string, sourceControlName: string, parameters: models.SourceControlUpdateParameters, callback: ServiceCallback): void; + update(resourceGroupName: string, automationAccountName: string, sourceControlName: string, parameters: models.SourceControlUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete the source control. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The name of source control. + * + * @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, automationAccountName: string, sourceControlName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete the source control. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The name of source control. + * + * @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, automationAccountName: string, sourceControlName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, automationAccountName: string, sourceControlName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, automationAccountName: string, sourceControlName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve the source control identified by source control name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The name of source control. + * + * @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, automationAccountName: string, sourceControlName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the source control identified by source control name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The name of source control. + * + * @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 {SourceControl} - 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. + * + * {SourceControl} [result] - The deserialized result object if an error did not occur. + * See {@link SourceControl} 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, automationAccountName: string, sourceControlName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, sourceControlName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, sourceControlName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of source controls. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of source controls. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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 {SourceControlListResult} - 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. + * + * {SourceControlListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SourceControlListResult} 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. + */ + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of source controls. + * + * @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. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of source controls. + * + * @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 {SourceControlListResult} - 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. + * + * {SourceControlListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SourceControlListResult} 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. + */ + listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * SourceControlSyncJobOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface SourceControlSyncJobOperations { + + + /** + * Creates the sync job for a source control. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {uuid} sourceControlSyncJobId The source control sync job id. + * + * @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, automationAccountName: string, sourceControlName: string, sourceControlSyncJobId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates the sync job for a source control. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {uuid} sourceControlSyncJobId The source control sync job id. + * + * @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 {SourceControlSyncJob} - 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. + * + * {SourceControlSyncJob} [result] - The deserialized result object if an error did not occur. + * See {@link SourceControlSyncJob} 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, automationAccountName: string, sourceControlName: string, sourceControlSyncJobId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, automationAccountName: string, sourceControlName: string, sourceControlSyncJobId: string, callback: ServiceCallback): void; + create(resourceGroupName: string, automationAccountName: string, sourceControlName: string, sourceControlSyncJobId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve the source control sync job identified by job id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {uuid} sourceControlSyncJobId The source control sync job id. + * + * @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, automationAccountName: string, sourceControlName: string, sourceControlSyncJobId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the source control sync job identified by job id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {uuid} sourceControlSyncJobId The source control sync job id. + * + * @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 {SourceControlSyncJobById} - 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. + * + * {SourceControlSyncJobById} [result] - The deserialized result object if an error did not occur. + * See {@link SourceControlSyncJobById} 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, automationAccountName: string, sourceControlName: string, sourceControlSyncJobId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, sourceControlName: string, sourceControlSyncJobId: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, sourceControlName: string, sourceControlSyncJobId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of source control sync jobs. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, sourceControlName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of source control sync jobs. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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 {SourceControlSyncJobListResult} - 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. + * + * {SourceControlSyncJobListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SourceControlSyncJobListResult} 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. + */ + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, sourceControlName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, sourceControlName: string, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, sourceControlName: string, options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of source control sync jobs. + * + * @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. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of source control sync jobs. + * + * @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 {SourceControlSyncJobListResult} - 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. + * + * {SourceControlSyncJobListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SourceControlSyncJobListResult} 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. + */ + listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * JobOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface JobOperations { + + + /** + * Retrieve the job output identified by job name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The name of the job to be created. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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. + */ + getOutputWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, jobName: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the job output identified by job name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The name of the job to be created. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 {String} - 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. + * + * {String} [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. + */ + getOutput(resourceGroupName: string, automationAccountName: string, jobName: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + getOutput(resourceGroupName: string, automationAccountName: string, jobName: string, callback: ServiceCallback): void; + getOutput(resourceGroupName: string, automationAccountName: string, jobName: string, options: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve the runbook content of the job identified by job name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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. + */ + getRunbookContentWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, jobName: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the runbook content of the job identified by job name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 {String} - 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. + * + * {String} [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. + */ + getRunbookContent(resourceGroupName: string, automationAccountName: string, jobName: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + getRunbookContent(resourceGroupName: string, automationAccountName: string, jobName: string, callback: ServiceCallback): void; + getRunbookContent(resourceGroupName: string, automationAccountName: string, jobName: string, options: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Suspend the job identified by job name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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. + */ + suspendWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, jobName: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Suspend the job identified by job name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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. + */ + suspend(resourceGroupName: string, automationAccountName: string, jobName: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + suspend(resourceGroupName: string, automationAccountName: string, jobName: string, callback: ServiceCallback): void; + suspend(resourceGroupName: string, automationAccountName: string, jobName: string, options: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Stop the job identified by jobName. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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. + */ + stopWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, jobName: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Stop the job identified by jobName. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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. + */ + stop(resourceGroupName: string, automationAccountName: string, jobName: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + stop(resourceGroupName: string, automationAccountName: string, jobName: string, callback: ServiceCallback): void; + stop(resourceGroupName: string, automationAccountName: string, jobName: string, options: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve the job identified by job name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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, automationAccountName: string, jobName: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the job identified by job name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 {Job} - 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. + * + * {Job} [result] - The deserialized result object if an error did not occur. + * See {@link Job} 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, automationAccountName: string, jobName: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, jobName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, jobName: string, options: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create a job of the runbook. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. + * + * @param {object} parameters The parameters supplied to the create job + * operation. + * + * @param {object} parameters.runbook Gets or sets the runbook. + * + * @param {string} [parameters.runbook.name] Gets or sets the name of the + * runbook. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * job. + * + * @param {string} [parameters.runOn] Gets or sets the runOn which specifies + * the group name where the job is to be executed. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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, automationAccountName: string, jobName: string, parameters: models.JobCreateParameters, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create a job of the runbook. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. + * + * @param {object} parameters The parameters supplied to the create job + * operation. + * + * @param {object} parameters.runbook Gets or sets the runbook. + * + * @param {string} [parameters.runbook.name] Gets or sets the name of the + * runbook. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * job. + * + * @param {string} [parameters.runOn] Gets or sets the runOn which specifies + * the group name where the job is to be executed. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 {Job} - 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. + * + * {Job} [result] - The deserialized result object if an error did not occur. + * See {@link Job} 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, automationAccountName: string, jobName: string, parameters: models.JobCreateParameters, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, automationAccountName: string, jobName: string, parameters: models.JobCreateParameters, callback: ServiceCallback): void; + create(resourceGroupName: string, automationAccountName: string, jobName: string, parameters: models.JobCreateParameters, options: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of jobs. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { filter? : string, clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of jobs. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 {JobListResultV2} - 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. + * + * {JobListResultV2} [result] - The deserialized result object if an error did not occur. + * See {@link JobListResultV2} 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. + */ + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { filter? : string, clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { filter? : string, clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Resume the job identified by jobName. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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. + */ + resumeWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, jobName: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Resume the job identified by jobName. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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. + */ + resume(resourceGroupName: string, automationAccountName: string, jobName: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + resume(resourceGroupName: string, automationAccountName: string, jobName: string, callback: ServiceCallback): void; + resume(resourceGroupName: string, automationAccountName: string, jobName: string, options: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of jobs. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of jobs. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 {JobListResultV2} - 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. + * + * {JobListResultV2} [result] - The deserialized result object if an error did not occur. + * See {@link JobListResultV2} 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. + */ + listByAutomationAccountNext(nextPageLink: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * JobStreamOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface JobStreamOperations { + + + /** + * Retrieve the job stream identified by job stream id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. + * + * @param {string} jobStreamId The job stream id. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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, automationAccountName: string, jobName: string, jobStreamId: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the job stream identified by job stream id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. + * + * @param {string} jobStreamId The job stream id. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 {JobStream} - 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. + * + * {JobStream} [result] - The deserialized result object if an error did not occur. + * See {@link JobStream} 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, automationAccountName: string, jobName: string, jobStreamId: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, jobName: string, jobStreamId: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, jobName: string, jobStreamId: string, options: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of jobs streams identified by job name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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. + */ + listByJobWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, jobName: string, options?: { filter? : string, clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of jobs streams identified by job name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 {JobStreamListResult} - 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. + * + * {JobStreamListResult} [result] - The deserialized result object if an error did not occur. + * See {@link JobStreamListResult} 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. + */ + listByJob(resourceGroupName: string, automationAccountName: string, jobName: string, options?: { filter? : string, clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByJob(resourceGroupName: string, automationAccountName: string, jobName: string, callback: ServiceCallback): void; + listByJob(resourceGroupName: string, automationAccountName: string, jobName: string, options: { filter? : string, clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of jobs streams identified by job name. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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. + */ + listByJobNextWithHttpOperationResponse(nextPageLink: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of jobs streams identified by job name. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 {JobStreamListResult} - 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. + * + * {JobStreamListResult} [result] - The deserialized result object if an error did not occur. + * See {@link JobStreamListResult} 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. + */ + listByJobNext(nextPageLink: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByJobNext(nextPageLink: string, callback: ServiceCallback): void; + listByJobNext(nextPageLink: string, options: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * AgentRegistrationInformation + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface AgentRegistrationInformation { + + + /** + * Retrieve the automation agent registration information. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @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, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the automation agent registration information. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @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 {AgentRegistration} - 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. + * + * {AgentRegistration} [result] - The deserialized result object if an error did not occur. + * See {@link AgentRegistration} 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, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Regenerate a primary or secondary agent registration key + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} parameters The name of the agent registration key to be + * regenerated + * + * @param {string} parameters.keyName Gets or sets the agent registration key + * name - primary or secondary. Possible values include: 'primary', 'secondary' + * + * @param {string} [parameters.name] Gets or sets the name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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. + */ + regenerateKeyWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, parameters: models.AgentRegistrationRegenerateKeyParameter, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Regenerate a primary or secondary agent registration key + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} parameters The name of the agent registration key to be + * regenerated + * + * @param {string} parameters.keyName Gets or sets the agent registration key + * name - primary or secondary. Possible values include: 'primary', 'secondary' + * + * @param {string} [parameters.name] Gets or sets the name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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 {AgentRegistration} - 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. + * + * {AgentRegistration} [result] - The deserialized result object if an error did not occur. + * See {@link AgentRegistration} 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. + */ + regenerateKey(resourceGroupName: string, automationAccountName: string, parameters: models.AgentRegistrationRegenerateKeyParameter, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + regenerateKey(resourceGroupName: string, automationAccountName: string, parameters: models.AgentRegistrationRegenerateKeyParameter, callback: ServiceCallback): void; + regenerateKey(resourceGroupName: string, automationAccountName: string, parameters: models.AgentRegistrationRegenerateKeyParameter, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * DscNodeOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface DscNodeOperations { + + + /** + * Delete the dsc node identified by node id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId The node id. + * + * @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, automationAccountName: string, nodeId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete the dsc node identified by node id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId The node id. + * + * @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 {DscNode} - 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. + * + * {DscNode} [result] - The deserialized result object if an error did not occur. + * See {@link DscNode} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, automationAccountName: string, nodeId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, automationAccountName: string, nodeId: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, automationAccountName: string, nodeId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve the dsc node identified by node id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId The node id. + * + * @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, automationAccountName: string, nodeId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the dsc node identified by node id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId The node id. + * + * @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 {DscNode} - 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. + * + * {DscNode} [result] - The deserialized result object if an error did not occur. + * See {@link DscNode} 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, automationAccountName: string, nodeId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, nodeId: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, nodeId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Update the dsc node. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId Parameters supplied to the update dsc node. + * + * @param {object} dscNodeUpdateParameters Parameters supplied to the update + * dsc node. + * + * @param {string} [dscNodeUpdateParameters.nodeId] Gets or sets the id of the + * dsc node. + * + * @param {object} [dscNodeUpdateParameters.nodeConfiguration] Gets or sets the + * configuration of the node. + * + * @param {string} [dscNodeUpdateParameters.nodeConfiguration.name] Gets or + * sets the name of the dsc nodeconfiguration. + * + * @param {object} [dscNodeUpdateParameters.properties] + * + * @param {string} [dscNodeUpdateParameters.properties.name] Gets or sets the + * name of the dsc nodeconfiguration. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, nodeId: string, dscNodeUpdateParameters: models.DscNodeUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Update the dsc node. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId Parameters supplied to the update dsc node. + * + * @param {object} dscNodeUpdateParameters Parameters supplied to the update + * dsc node. + * + * @param {string} [dscNodeUpdateParameters.nodeId] Gets or sets the id of the + * dsc node. + * + * @param {object} [dscNodeUpdateParameters.nodeConfiguration] Gets or sets the + * configuration of the node. + * + * @param {string} [dscNodeUpdateParameters.nodeConfiguration.name] Gets or + * sets the name of the dsc nodeconfiguration. + * + * @param {object} [dscNodeUpdateParameters.properties] + * + * @param {string} [dscNodeUpdateParameters.properties.name] Gets or sets the + * name of the dsc nodeconfiguration. + * + * @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 {DscNode} - 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. + * + * {DscNode} [result] - The deserialized result object if an error did not occur. + * See {@link DscNode} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, automationAccountName: string, nodeId: string, dscNodeUpdateParameters: models.DscNodeUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, automationAccountName: string, nodeId: string, dscNodeUpdateParameters: models.DscNodeUpdateParameters, callback: ServiceCallback): void; + update(resourceGroupName: string, automationAccountName: string, nodeId: string, dscNodeUpdateParameters: models.DscNodeUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of dsc nodes. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of dsc nodes. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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 {DscNodeListResult} - 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. + * + * {DscNodeListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DscNodeListResult} 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. + */ + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of dsc nodes. + * + * @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. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of dsc nodes. + * + * @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 {DscNodeListResult} - 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. + * + * {DscNodeListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DscNodeListResult} 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. + */ + listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * NodeReports + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface NodeReports { + + + /** + * Retrieve the Dsc node report list by node id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId The parameters supplied to the list operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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. + */ + listByNodeWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, nodeId: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the Dsc node report list by node id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId The parameters supplied to the list operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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 {DscNodeReportListResult} - 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. + * + * {DscNodeReportListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DscNodeReportListResult} 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. + */ + listByNode(resourceGroupName: string, automationAccountName: string, nodeId: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByNode(resourceGroupName: string, automationAccountName: string, nodeId: string, callback: ServiceCallback): void; + listByNode(resourceGroupName: string, automationAccountName: string, nodeId: string, options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve the Dsc node report data by node id and report id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId The Dsc node id. + * + * @param {string} reportId The report id. + * + * @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, automationAccountName: string, nodeId: string, reportId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the Dsc node report data by node id and report id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId The Dsc node id. + * + * @param {string} reportId The report id. + * + * @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 {DscNodeReport} - 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. + * + * {DscNodeReport} [result] - The deserialized result object if an error did not occur. + * See {@link DscNodeReport} 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, automationAccountName: string, nodeId: string, reportId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, nodeId: string, reportId: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, nodeId: string, reportId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve the Dsc node reports by node id and report id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId The Dsc node id. + * + * @param {string} reportId The report id. + * + * @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. + */ + getContentWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, nodeId: string, reportId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the Dsc node reports by node id and report id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId The Dsc node id. + * + * @param {string} reportId The report id. + * + * @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 {Object} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Object} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + getContent(resourceGroupName: string, automationAccountName: string, nodeId: string, reportId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getContent(resourceGroupName: string, automationAccountName: string, nodeId: string, reportId: string, callback: ServiceCallback): void; + getContent(resourceGroupName: string, automationAccountName: string, nodeId: string, reportId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve the Dsc node report list by node id. + * + * @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. + */ + listByNodeNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the Dsc node report list by node id. + * + * @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 {DscNodeReportListResult} - 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. + * + * {DscNodeReportListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DscNodeReportListResult} 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. + */ + listByNodeNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByNodeNext(nextPageLink: string, callback: ServiceCallback): void; + listByNodeNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * DscCompilationJobOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface DscCompilationJobOperations { + + + /** + * Creates the Dsc compilation job of the configuration. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} compilationJobName The the DSC configuration Id. + * + * @param {object} parameters The parameters supplied to the create compilation + * job operation. + * + * @param {object} parameters.configuration Gets or sets the configuration. + * + * @param {string} [parameters.configuration.name] Gets or sets the name of the + * Dsc configuration. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * job. + * + * @param {boolean} [parameters.newNodeConfigurationBuildVersionRequired] If a + * new build version of NodeConfiguration is required. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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, automationAccountName: string, compilationJobName: string, parameters: models.DscCompilationJobCreateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates the Dsc compilation job of the configuration. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} compilationJobName The the DSC configuration Id. + * + * @param {object} parameters The parameters supplied to the create compilation + * job operation. + * + * @param {object} parameters.configuration Gets or sets the configuration. + * + * @param {string} [parameters.configuration.name] Gets or sets the name of the + * Dsc configuration. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * job. + * + * @param {boolean} [parameters.newNodeConfigurationBuildVersionRequired] If a + * new build version of NodeConfiguration is required. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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 {DscCompilationJob} - 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. + * + * {DscCompilationJob} [result] - The deserialized result object if an error did not occur. + * See {@link DscCompilationJob} 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, automationAccountName: string, compilationJobName: string, parameters: models.DscCompilationJobCreateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, automationAccountName: string, compilationJobName: string, parameters: models.DscCompilationJobCreateParameters, callback: ServiceCallback): void; + create(resourceGroupName: string, automationAccountName: string, compilationJobName: string, parameters: models.DscCompilationJobCreateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve the Dsc configuration compilation job identified by job id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} compilationJobName The the DSC configuration Id. + * + * @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, automationAccountName: string, compilationJobName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the Dsc configuration compilation job identified by job id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} compilationJobName The the DSC configuration Id. + * + * @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 {DscCompilationJob} - 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. + * + * {DscCompilationJob} [result] - The deserialized result object if an error did not occur. + * See {@link DscCompilationJob} 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, automationAccountName: string, compilationJobName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, compilationJobName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, compilationJobName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of dsc compilation jobs. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of dsc compilation jobs. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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 {DscCompilationJobListResult} - 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. + * + * {DscCompilationJobListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DscCompilationJobListResult} 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. + */ + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve the job stream identified by job stream id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {uuid} jobId The job id. + * + * @param {string} jobStreamId The job stream id. + * + * @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. + */ + getStreamWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, jobId: string, jobStreamId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the job stream identified by job stream id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {uuid} jobId The job id. + * + * @param {string} jobStreamId The job stream id. + * + * @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 {JobStream} - 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. + * + * {JobStream} [result] - The deserialized result object if an error did not occur. + * See {@link JobStream} 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. + */ + getStream(resourceGroupName: string, automationAccountName: string, jobId: string, jobStreamId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getStream(resourceGroupName: string, automationAccountName: string, jobId: string, jobStreamId: string, callback: ServiceCallback): void; + getStream(resourceGroupName: string, automationAccountName: string, jobId: string, jobStreamId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates the Dsc compilation job of the configuration. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} compilationJobName The the DSC configuration Id. + * + * @param {object} parameters The parameters supplied to the create compilation + * job operation. + * + * @param {object} parameters.configuration Gets or sets the configuration. + * + * @param {string} [parameters.configuration.name] Gets or sets the name of the + * Dsc configuration. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * job. + * + * @param {boolean} [parameters.newNodeConfigurationBuildVersionRequired] If a + * new build version of NodeConfiguration is required. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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. + */ + beginCreateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, compilationJobName: string, parameters: models.DscCompilationJobCreateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates the Dsc compilation job of the configuration. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} compilationJobName The the DSC configuration Id. + * + * @param {object} parameters The parameters supplied to the create compilation + * job operation. + * + * @param {object} parameters.configuration Gets or sets the configuration. + * + * @param {string} [parameters.configuration.name] Gets or sets the name of the + * Dsc configuration. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * job. + * + * @param {boolean} [parameters.newNodeConfigurationBuildVersionRequired] If a + * new build version of NodeConfiguration is required. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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 {DscCompilationJob} - 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. + * + * {DscCompilationJob} [result] - The deserialized result object if an error did not occur. + * See {@link DscCompilationJob} 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. + */ + beginCreate(resourceGroupName: string, automationAccountName: string, compilationJobName: string, parameters: models.DscCompilationJobCreateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreate(resourceGroupName: string, automationAccountName: string, compilationJobName: string, parameters: models.DscCompilationJobCreateParameters, callback: ServiceCallback): void; + beginCreate(resourceGroupName: string, automationAccountName: string, compilationJobName: string, parameters: models.DscCompilationJobCreateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of dsc compilation jobs. + * + * @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. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of dsc compilation jobs. + * + * @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 {DscCompilationJobListResult} - 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. + * + * {DscCompilationJobListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DscCompilationJobListResult} 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. + */ + listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * DscCompilationJobStream + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface DscCompilationJobStream { + + + /** + * Retrieve all the job streams for the compilation Job. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {uuid} jobId The job id. + * + * @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. + */ + listByJobWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, jobId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve all the job streams for the compilation Job. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {uuid} jobId The job id. + * + * @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 {JobStreamListResult} - 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. + * + * {JobStreamListResult} [result] - The deserialized result object if an error did not occur. + * See {@link JobStreamListResult} 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. + */ + listByJob(resourceGroupName: string, automationAccountName: string, jobId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByJob(resourceGroupName: string, automationAccountName: string, jobId: string, callback: ServiceCallback): void; + listByJob(resourceGroupName: string, automationAccountName: string, jobId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * DscNodeConfigurationOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface DscNodeConfigurationOperations { + + + /** + * Delete the Dsc node configurations by node configuration. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeConfigurationName The Dsc node configuration 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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, nodeConfigurationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete the Dsc node configurations by node configuration. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeConfigurationName The Dsc node configuration 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 {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, automationAccountName: string, nodeConfigurationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, automationAccountName: string, nodeConfigurationName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, automationAccountName: string, nodeConfigurationName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve the Dsc node configurations by node configuration. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeConfigurationName The Dsc node configuration 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. + */ + getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, nodeConfigurationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the Dsc node configurations by node configuration. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeConfigurationName The Dsc node configuration 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 {DscNodeConfiguration} - 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. + * + * {DscNodeConfiguration} [result] - The deserialized result object if an error did not occur. + * See {@link DscNodeConfiguration} 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, automationAccountName: string, nodeConfigurationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, nodeConfigurationName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, nodeConfigurationName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create the node configuration identified by node configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeConfigurationName The Dsc node configuration name. + * + * @param {object} parameters The create or update parameters for + * configuration. + * + * @param {object} parameters.source Gets or sets the source. + * + * @param {object} [parameters.source.hash] Gets or sets the hash. + * + * @param {string} parameters.source.hash.algorithm Gets or sets the content + * hash algorithm used to hash the content. + * + * @param {string} parameters.source.hash.value Gets or sets expected hash + * value of the content. + * + * @param {string} [parameters.source.type] Gets or sets the content source + * type. Possible values include: 'embeddedContent', 'uri' + * + * @param {string} [parameters.source.value] Gets or sets the value of the + * content. This is based on the content source type. + * + * @param {string} [parameters.source.version] Gets or sets the version of the + * content. + * + * @param {string} parameters.name Gets or sets the type of the parameter. + * + * @param {object} parameters.configuration Gets or sets the configuration of + * the node. + * + * @param {string} [parameters.configuration.name] Gets or sets the name of the + * Dsc configuration. + * + * @param {boolean} [parameters.incrementNodeConfigurationBuild] If a new build + * version of NodeConfiguration is required. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, nodeConfigurationName: string, parameters: models.DscNodeConfigurationCreateOrUpdateParametersProperties, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create the node configuration identified by node configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeConfigurationName The Dsc node configuration name. + * + * @param {object} parameters The create or update parameters for + * configuration. + * + * @param {object} parameters.source Gets or sets the source. + * + * @param {object} [parameters.source.hash] Gets or sets the hash. + * + * @param {string} parameters.source.hash.algorithm Gets or sets the content + * hash algorithm used to hash the content. + * + * @param {string} parameters.source.hash.value Gets or sets expected hash + * value of the content. + * + * @param {string} [parameters.source.type] Gets or sets the content source + * type. Possible values include: 'embeddedContent', 'uri' + * + * @param {string} [parameters.source.value] Gets or sets the value of the + * content. This is based on the content source type. + * + * @param {string} [parameters.source.version] Gets or sets the version of the + * content. + * + * @param {string} parameters.name Gets or sets the type of the parameter. + * + * @param {object} parameters.configuration Gets or sets the configuration of + * the node. + * + * @param {string} [parameters.configuration.name] Gets or sets the name of the + * Dsc configuration. + * + * @param {boolean} [parameters.incrementNodeConfigurationBuild] If a new build + * version of NodeConfiguration is required. + * + * @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 {DscNodeConfiguration} - 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. + * + * {DscNodeConfiguration} [result] - The deserialized result object if an error did not occur. + * See {@link DscNodeConfiguration} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, automationAccountName: string, nodeConfigurationName: string, parameters: models.DscNodeConfigurationCreateOrUpdateParametersProperties, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, automationAccountName: string, nodeConfigurationName: string, parameters: models.DscNodeConfigurationCreateOrUpdateParametersProperties, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, automationAccountName: string, nodeConfigurationName: string, parameters: models.DscNodeConfigurationCreateOrUpdateParametersProperties, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of dsc node configurations. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of dsc node configurations. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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 {DscNodeConfigurationListResult} - 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. + * + * {DscNodeConfigurationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DscNodeConfigurationListResult} 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. + */ + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create the node configuration identified by node configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeConfigurationName The Dsc node configuration name. + * + * @param {object} parameters The create or update parameters for + * configuration. + * + * @param {object} parameters.source Gets or sets the source. + * + * @param {object} [parameters.source.hash] Gets or sets the hash. + * + * @param {string} parameters.source.hash.algorithm Gets or sets the content + * hash algorithm used to hash the content. + * + * @param {string} parameters.source.hash.value Gets or sets expected hash + * value of the content. + * + * @param {string} [parameters.source.type] Gets or sets the content source + * type. Possible values include: 'embeddedContent', 'uri' + * + * @param {string} [parameters.source.value] Gets or sets the value of the + * content. This is based on the content source type. + * + * @param {string} [parameters.source.version] Gets or sets the version of the + * content. + * + * @param {string} parameters.name Gets or sets the type of the parameter. + * + * @param {object} parameters.configuration Gets or sets the configuration of + * the node. + * + * @param {string} [parameters.configuration.name] Gets or sets the name of the + * Dsc configuration. + * + * @param {boolean} [parameters.incrementNodeConfigurationBuild] If a new build + * version of NodeConfiguration is required. + * + * @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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, nodeConfigurationName: string, parameters: models.DscNodeConfigurationCreateOrUpdateParametersProperties, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create the node configuration identified by node configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeConfigurationName The Dsc node configuration name. + * + * @param {object} parameters The create or update parameters for + * configuration. + * + * @param {object} parameters.source Gets or sets the source. + * + * @param {object} [parameters.source.hash] Gets or sets the hash. + * + * @param {string} parameters.source.hash.algorithm Gets or sets the content + * hash algorithm used to hash the content. + * + * @param {string} parameters.source.hash.value Gets or sets expected hash + * value of the content. + * + * @param {string} [parameters.source.type] Gets or sets the content source + * type. Possible values include: 'embeddedContent', 'uri' + * + * @param {string} [parameters.source.value] Gets or sets the value of the + * content. This is based on the content source type. + * + * @param {string} [parameters.source.version] Gets or sets the version of the + * content. + * + * @param {string} parameters.name Gets or sets the type of the parameter. + * + * @param {object} parameters.configuration Gets or sets the configuration of + * the node. + * + * @param {string} [parameters.configuration.name] Gets or sets the name of the + * Dsc configuration. + * + * @param {boolean} [parameters.incrementNodeConfigurationBuild] If a new build + * version of NodeConfiguration is required. + * + * @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 {DscNodeConfiguration} - 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. + * + * {DscNodeConfiguration} [result] - The deserialized result object if an error did not occur. + * See {@link DscNodeConfiguration} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, automationAccountName: string, nodeConfigurationName: string, parameters: models.DscNodeConfigurationCreateOrUpdateParametersProperties, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, automationAccountName: string, nodeConfigurationName: string, parameters: models.DscNodeConfigurationCreateOrUpdateParametersProperties, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, automationAccountName: string, nodeConfigurationName: string, parameters: models.DscNodeConfigurationCreateOrUpdateParametersProperties, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of dsc node configurations. + * + * @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. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of dsc node configurations. + * + * @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 {DscNodeConfigurationListResult} - 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. + * + * {DscNodeConfigurationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DscNodeConfigurationListResult} 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. + */ + listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} diff --git a/lib/services/automationManagement/lib/lib/operations/index.js b/lib/services/automationManagement/lib/lib/operations/index.js new file mode 100644 index 0000000000..63aeffd32f --- /dev/null +++ b/lib/services/automationManagement/lib/lib/operations/index.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. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +exports.AutomationAccountOperations = require('./automationAccountOperations'); +exports.Operations = require('./operations'); +exports.StatisticsOperations = require('./statisticsOperations'); +exports.Usages = require('./usages'); +exports.Keys = require('./keys'); +exports.CertificateOperations = require('./certificateOperations'); +exports.ConnectionOperations = require('./connectionOperations'); +exports.ConnectionTypeOperations = require('./connectionTypeOperations'); +exports.CredentialOperations = require('./credentialOperations'); +exports.DscConfigurationOperations = require('./dscConfigurationOperations'); +exports.HybridRunbookWorkerGroupOperations = require('./hybridRunbookWorkerGroupOperations'); +exports.JobScheduleOperations = require('./jobScheduleOperations'); +exports.LinkedWorkspaceOperations = require('./linkedWorkspaceOperations'); +exports.ActivityOperations = require('./activityOperations'); +exports.ModuleOperations = require('./moduleOperations'); +exports.ObjectDataTypes = require('./objectDataTypes'); +exports.Fields = require('./fields'); +exports.RunbookDraftOperations = require('./runbookDraftOperations'); +exports.RunbookOperations = require('./runbookOperations'); +exports.TestJobStreams = require('./testJobStreams'); +exports.TestJobOperations = require('./testJobOperations'); +exports.ScheduleOperations = require('./scheduleOperations'); +exports.VariableOperations = require('./variableOperations'); +exports.WebhookOperations = require('./webhookOperations'); +exports.SoftwareUpdateConfigurations = require('./softwareUpdateConfigurations'); +exports.SoftwareUpdateConfigurationRuns = require('./softwareUpdateConfigurationRuns'); +exports.SoftwareUpdateConfigurationMachineRuns = require('./softwareUpdateConfigurationMachineRuns'); +exports.SourceControlOperations = require('./sourceControlOperations'); +exports.SourceControlSyncJobOperations = require('./sourceControlSyncJobOperations'); +exports.JobOperations = require('./jobOperations'); +exports.JobStreamOperations = require('./jobStreamOperations'); +exports.AgentRegistrationInformation = require('./agentRegistrationInformation'); +exports.DscNodeOperations = require('./dscNodeOperations'); +exports.NodeReports = require('./nodeReports'); +exports.DscCompilationJobOperations = require('./dscCompilationJobOperations'); +exports.DscCompilationJobStream = require('./dscCompilationJobStream'); +exports.DscNodeConfigurationOperations = require('./dscNodeConfigurationOperations'); diff --git a/lib/services/automationManagement/lib/lib/operations/jobOperations.js b/lib/services/automationManagement/lib/lib/operations/jobOperations.js new file mode 100644 index 0000000000..df4b700f0b --- /dev/null +++ b/lib/services/automationManagement/lib/lib/operations/jobOperations.js @@ -0,0 +1,2437 @@ +/* + * 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; + +/** + * Retrieve the job output identified by job name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The name of the job to be created. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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. + * + * {string} [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 _getOutput(resourceGroupName, automationAccountName, jobName, 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 clientRequestId = (options && options.clientRequestId !== undefined) ? options.clientRequestId : undefined; + let apiVersion = '2017-05-15-preview'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (jobName === null || jobName === undefined || typeof jobName.valueOf() !== 'string') { + throw new Error('jobName cannot be null or undefined and it must be of type string.'); + } + if (clientRequestId !== null && clientRequestId !== undefined && typeof clientRequestId.valueOf() !== 'string') { + throw new Error('clientRequestId 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.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/output'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{jobName}', encodeURIComponent(jobName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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 (clientRequestId !== undefined && clientRequestId !== null) { + httpRequest.headers['clientRequestId'] = clientRequestId; + } + 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 = { + required: false, + serializedName: 'parsedResponse', + type: { + name: 'String' + } + }; + 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); + }); +} + +/** + * Retrieve the runbook content of the job identified by job name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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. + * + * {string} [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 _getRunbookContent(resourceGroupName, automationAccountName, jobName, 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 clientRequestId = (options && options.clientRequestId !== undefined) ? options.clientRequestId : undefined; + let apiVersion = '2017-05-15-preview'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (jobName === null || jobName === undefined || typeof jobName.valueOf() !== 'string') { + throw new Error('jobName cannot be null or undefined and it must be of type string.'); + } + if (clientRequestId !== null && clientRequestId !== undefined && typeof clientRequestId.valueOf() !== 'string') { + throw new Error('clientRequestId 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.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/runbookContent'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{jobName}', encodeURIComponent(jobName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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 (clientRequestId !== undefined && clientRequestId !== null) { + httpRequest.headers['clientRequestId'] = clientRequestId; + } + 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 = { + required: false, + serializedName: 'parsedResponse', + type: { + name: 'String' + } + }; + 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); + }); +} + +/** + * Suspend the job identified by job name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 _suspend(resourceGroupName, automationAccountName, jobName, 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 clientRequestId = (options && options.clientRequestId !== undefined) ? options.clientRequestId : undefined; + let apiVersion = '2017-05-15-preview'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (jobName === null || jobName === undefined || typeof jobName.valueOf() !== 'string') { + throw new Error('jobName cannot be null or undefined and it must be of type string.'); + } + if (clientRequestId !== null && clientRequestId !== undefined && typeof clientRequestId.valueOf() !== 'string') { + throw new Error('clientRequestId 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.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/suspend'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{jobName}', encodeURIComponent(jobName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (clientRequestId !== undefined && clientRequestId !== null) { + httpRequest.headers['clientRequestId'] = clientRequestId; + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Stop the job identified by jobName. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 _stop(resourceGroupName, automationAccountName, jobName, 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 clientRequestId = (options && options.clientRequestId !== undefined) ? options.clientRequestId : undefined; + let apiVersion = '2017-05-15-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (jobName === null || jobName === undefined || typeof jobName.valueOf() !== 'string') { + throw new Error('jobName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (clientRequestId !== null && clientRequestId !== undefined && typeof clientRequestId.valueOf() !== 'string') { + throw new Error('clientRequestId 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.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/stop'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{jobName}', encodeURIComponent(jobName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (clientRequestId !== undefined && clientRequestId !== null) { + httpRequest.headers['clientRequestId'] = clientRequestId; + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Retrieve the job identified by job name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 Job} 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, automationAccountName, jobName, 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 clientRequestId = (options && options.clientRequestId !== undefined) ? options.clientRequestId : undefined; + let apiVersion = '2017-05-15-preview'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (jobName === null || jobName === undefined || typeof jobName.valueOf() !== 'string') { + throw new Error('jobName cannot be null or undefined and it must be of type string.'); + } + if (clientRequestId !== null && clientRequestId !== undefined && typeof clientRequestId.valueOf() !== 'string') { + throw new Error('clientRequestId 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.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{jobName}', encodeURIComponent(jobName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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 (clientRequestId !== undefined && clientRequestId !== null) { + httpRequest.headers['clientRequestId'] = clientRequestId; + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Job']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Create a job of the runbook. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. + * + * @param {object} parameters The parameters supplied to the create job + * operation. + * + * @param {object} parameters.runbook Gets or sets the runbook. + * + * @param {string} [parameters.runbook.name] Gets or sets the name of the + * runbook. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * job. + * + * @param {string} [parameters.runOn] Gets or sets the runOn which specifies + * the group name where the job is to be executed. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 Job} 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, automationAccountName, jobName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let clientRequestId = (options && options.clientRequestId !== undefined) ? options.clientRequestId : undefined; + let apiVersion = '2017-05-15-preview'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (jobName === null || jobName === undefined || typeof jobName.valueOf() !== 'string') { + throw new Error('jobName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (clientRequestId !== null && clientRequestId !== undefined && typeof clientRequestId.valueOf() !== 'string') { + throw new Error('clientRequestId 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.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{jobName}', encodeURIComponent(jobName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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 (clientRequestId !== undefined && clientRequestId !== null) { + httpRequest.headers['clientRequestId'] = clientRequestId; + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['JobCreateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Job']().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); + }); +} + +/** + * Retrieve a list of jobs. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 JobListResultV2} 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 _listByAutomationAccount(resourceGroupName, automationAccountName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let clientRequestId = (options && options.clientRequestId !== undefined) ? options.clientRequestId : undefined; + let apiVersion = '2017-05-15-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (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 (clientRequestId !== null && clientRequestId !== undefined && typeof clientRequestId.valueOf() !== 'string') { + throw new Error('clientRequestId 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.Automation/automationAccounts/{automationAccountName}/jobs'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + queryParameters.push('api-version=' + encodeURIComponent(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 (clientRequestId !== undefined && clientRequestId !== null) { + httpRequest.headers['clientRequestId'] = clientRequestId; + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['JobListResultV2']().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); + }); +} + +/** + * Resume the job identified by jobName. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 _resume(resourceGroupName, automationAccountName, jobName, 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 clientRequestId = (options && options.clientRequestId !== undefined) ? options.clientRequestId : undefined; + let apiVersion = '2017-05-15-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (jobName === null || jobName === undefined || typeof jobName.valueOf() !== 'string') { + throw new Error('jobName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (clientRequestId !== null && clientRequestId !== undefined && typeof clientRequestId.valueOf() !== 'string') { + throw new Error('clientRequestId 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.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/resume'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{jobName}', encodeURIComponent(jobName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (clientRequestId !== undefined && clientRequestId !== null) { + httpRequest.headers['clientRequestId'] = clientRequestId; + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Retrieve a list of jobs. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 JobListResultV2} 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 _listByAutomationAccountNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let clientRequestId = (options && options.clientRequestId !== undefined) ? options.clientRequestId : undefined; + // 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 (clientRequestId !== null && clientRequestId !== undefined && typeof clientRequestId.valueOf() !== 'string') { + throw new Error('clientRequestId 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 (clientRequestId !== undefined && clientRequestId !== null) { + httpRequest.headers['clientRequestId'] = clientRequestId; + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['JobListResultV2']().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 JobOperations. */ +class JobOperations { + /** + * Create a JobOperations. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._getOutput = _getOutput; + this._getRunbookContent = _getRunbookContent; + this._suspend = _suspend; + this._stop = _stop; + this._get = _get; + this._create = _create; + this._listByAutomationAccount = _listByAutomationAccount; + this._resume = _resume; + this._listByAutomationAccountNext = _listByAutomationAccountNext; + } + + /** + * Retrieve the job output identified by job name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The name of the job to be created. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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. + */ + getOutputWithHttpOperationResponse(resourceGroupName, automationAccountName, jobName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getOutput(resourceGroupName, automationAccountName, jobName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the job output identified by job name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The name of the job to be created. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 {String} - 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. + * + * {string} [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. + */ + getOutput(resourceGroupName, automationAccountName, jobName, 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._getOutput(resourceGroupName, automationAccountName, jobName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getOutput(resourceGroupName, automationAccountName, jobName, options, optionalCallback); + } + } + + /** + * Retrieve the runbook content of the job identified by job name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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. + */ + getRunbookContentWithHttpOperationResponse(resourceGroupName, automationAccountName, jobName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getRunbookContent(resourceGroupName, automationAccountName, jobName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the runbook content of the job identified by job name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 {String} - 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. + * + * {string} [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. + */ + getRunbookContent(resourceGroupName, automationAccountName, jobName, 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._getRunbookContent(resourceGroupName, automationAccountName, jobName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getRunbookContent(resourceGroupName, automationAccountName, jobName, options, optionalCallback); + } + } + + /** + * Suspend the job identified by job name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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. + */ + suspendWithHttpOperationResponse(resourceGroupName, automationAccountName, jobName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._suspend(resourceGroupName, automationAccountName, jobName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Suspend the job identified by job name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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. + */ + suspend(resourceGroupName, automationAccountName, jobName, 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._suspend(resourceGroupName, automationAccountName, jobName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._suspend(resourceGroupName, automationAccountName, jobName, options, optionalCallback); + } + } + + /** + * Stop the job identified by jobName. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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. + */ + stopWithHttpOperationResponse(resourceGroupName, automationAccountName, jobName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._stop(resourceGroupName, automationAccountName, jobName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Stop the job identified by jobName. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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. + */ + stop(resourceGroupName, automationAccountName, jobName, 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._stop(resourceGroupName, automationAccountName, jobName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._stop(resourceGroupName, automationAccountName, jobName, options, optionalCallback); + } + } + + /** + * Retrieve the job identified by job name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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, automationAccountName, jobName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, automationAccountName, jobName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the job identified by job name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 {Job} - 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 Job} 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, automationAccountName, jobName, 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, automationAccountName, jobName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, automationAccountName, jobName, options, optionalCallback); + } + } + + /** + * Create a job of the runbook. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. + * + * @param {object} parameters The parameters supplied to the create job + * operation. + * + * @param {object} parameters.runbook Gets or sets the runbook. + * + * @param {string} [parameters.runbook.name] Gets or sets the name of the + * runbook. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * job. + * + * @param {string} [parameters.runOn] Gets or sets the runOn which specifies + * the group name where the job is to be executed. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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, automationAccountName, jobName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._create(resourceGroupName, automationAccountName, jobName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create a job of the runbook. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. + * + * @param {object} parameters The parameters supplied to the create job + * operation. + * + * @param {object} parameters.runbook Gets or sets the runbook. + * + * @param {string} [parameters.runbook.name] Gets or sets the name of the + * runbook. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * job. + * + * @param {string} [parameters.runOn] Gets or sets the runOn which specifies + * the group name where the job is to be executed. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 {Job} - 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 Job} 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, automationAccountName, jobName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._create(resourceGroupName, automationAccountName, jobName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(resourceGroupName, automationAccountName, jobName, parameters, options, optionalCallback); + } + } + + /** + * Retrieve a list of jobs. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName, automationAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of jobs. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 {JobListResultV2} - 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 JobListResultV2} 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. + */ + listByAutomationAccount(resourceGroupName, automationAccountName, 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._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccount(resourceGroupName, automationAccountName, options, optionalCallback); + } + } + + /** + * Resume the job identified by jobName. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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. + */ + resumeWithHttpOperationResponse(resourceGroupName, automationAccountName, jobName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._resume(resourceGroupName, automationAccountName, jobName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Resume the job identified by jobName. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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. + */ + resume(resourceGroupName, automationAccountName, jobName, 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._resume(resourceGroupName, automationAccountName, jobName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._resume(resourceGroupName, automationAccountName, jobName, options, optionalCallback); + } + } + + /** + * Retrieve a list of jobs. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccountNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of jobs. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 {JobListResultV2} - 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 JobListResultV2} 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. + */ + listByAutomationAccountNext(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._listByAutomationAccountNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccountNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = JobOperations; diff --git a/lib/services/automationManagement/lib/lib/operations/jobScheduleOperations.js b/lib/services/automationManagement/lib/lib/operations/jobScheduleOperations.js new file mode 100644 index 0000000000..0cda753c0a --- /dev/null +++ b/lib/services/automationManagement/lib/lib/operations/jobScheduleOperations.js @@ -0,0 +1,1307 @@ +/* + * 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; + +/** + * Delete the job schedule identified by job schedule name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {uuid} jobScheduleId The job schedule 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. + * + * {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, automationAccountName, jobScheduleId, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (jobScheduleId === null || jobScheduleId === undefined || typeof jobScheduleId.valueOf() !== 'string' || !msRest.isValidUuid(jobScheduleId)) { + throw new Error('jobScheduleId cannot be null or undefined and it must be of type string and must be a valid uuid.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobSchedules/{jobScheduleId}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{jobScheduleId}', encodeURIComponent(jobScheduleId.toString())); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Retrieve the job schedule identified by job schedule name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {uuid} jobScheduleId The job schedule 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 JobSchedule} 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, automationAccountName, jobScheduleId, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (jobScheduleId === null || jobScheduleId === undefined || typeof jobScheduleId.valueOf() !== 'string' || !msRest.isValidUuid(jobScheduleId)) { + throw new Error('jobScheduleId cannot be null or undefined and it must be of type string and must be a valid uuid.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobSchedules/{jobScheduleId}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{jobScheduleId}', encodeURIComponent(jobScheduleId.toString())); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['JobSchedule']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Create a job schedule. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {uuid} jobScheduleId The job schedule name. + * + * @param {object} parameters The parameters supplied to the create job + * schedule operation. + * + * @param {object} parameters.schedule Gets or sets the schedule. + * + * @param {string} [parameters.schedule.name] Gets or sets the name of the + * schedule. + * + * @param {object} parameters.runbook Gets or sets the runbook. + * + * @param {string} [parameters.runbook.name] Gets or sets the name of the + * runbook. + * + * @param {string} [parameters.runOn] Gets or sets the hybrid worker group that + * the scheduled job should run on. + * + * @param {object} [parameters.parameters] Gets or sets a list of job + * 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 JobSchedule} 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, automationAccountName, jobScheduleId, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (jobScheduleId === null || jobScheduleId === undefined || typeof jobScheduleId.valueOf() !== 'string' || !msRest.isValidUuid(jobScheduleId)) { + throw new Error('jobScheduleId cannot be null or undefined and it must be of type string and must be a valid uuid.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobSchedules/{jobScheduleId}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{jobScheduleId}', encodeURIComponent(jobScheduleId.toString())); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['JobScheduleCreateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['JobSchedule']().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); + }); +} + +/** + * Retrieve a list of job schedules. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 JobScheduleListResult} 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 _listByAutomationAccount(resourceGroupName, automationAccountName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobSchedules'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['JobScheduleListResult']().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); + }); +} + +/** + * Retrieve a list of job schedules. + * + * @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 JobScheduleListResult} 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 _listByAutomationAccountNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['JobScheduleListResult']().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 JobScheduleOperations. */ +class JobScheduleOperations { + /** + * Create a JobScheduleOperations. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._create = _create; + this._listByAutomationAccount = _listByAutomationAccount; + this._listByAutomationAccountNext = _listByAutomationAccountNext; + } + + /** + * Delete the job schedule identified by job schedule name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {uuid} jobScheduleId The job schedule 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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, automationAccountName, jobScheduleId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, automationAccountName, jobScheduleId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete the job schedule identified by job schedule name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {uuid} jobScheduleId The job schedule 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 {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, automationAccountName, jobScheduleId, 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, automationAccountName, jobScheduleId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, automationAccountName, jobScheduleId, options, optionalCallback); + } + } + + /** + * Retrieve the job schedule identified by job schedule name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {uuid} jobScheduleId The job schedule 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. + */ + getWithHttpOperationResponse(resourceGroupName, automationAccountName, jobScheduleId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, automationAccountName, jobScheduleId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the job schedule identified by job schedule name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {uuid} jobScheduleId The job schedule 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 {JobSchedule} - 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 JobSchedule} 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, automationAccountName, jobScheduleId, 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, automationAccountName, jobScheduleId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, automationAccountName, jobScheduleId, options, optionalCallback); + } + } + + /** + * Create a job schedule. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {uuid} jobScheduleId The job schedule name. + * + * @param {object} parameters The parameters supplied to the create job + * schedule operation. + * + * @param {object} parameters.schedule Gets or sets the schedule. + * + * @param {string} [parameters.schedule.name] Gets or sets the name of the + * schedule. + * + * @param {object} parameters.runbook Gets or sets the runbook. + * + * @param {string} [parameters.runbook.name] Gets or sets the name of the + * runbook. + * + * @param {string} [parameters.runOn] Gets or sets the hybrid worker group that + * the scheduled job should run on. + * + * @param {object} [parameters.parameters] Gets or sets a list of job + * 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. + */ + createWithHttpOperationResponse(resourceGroupName, automationAccountName, jobScheduleId, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._create(resourceGroupName, automationAccountName, jobScheduleId, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create a job schedule. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {uuid} jobScheduleId The job schedule name. + * + * @param {object} parameters The parameters supplied to the create job + * schedule operation. + * + * @param {object} parameters.schedule Gets or sets the schedule. + * + * @param {string} [parameters.schedule.name] Gets or sets the name of the + * schedule. + * + * @param {object} parameters.runbook Gets or sets the runbook. + * + * @param {string} [parameters.runbook.name] Gets or sets the name of the + * runbook. + * + * @param {string} [parameters.runOn] Gets or sets the hybrid worker group that + * the scheduled job should run on. + * + * @param {object} [parameters.parameters] Gets or sets a list of job + * 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 {JobSchedule} - 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 JobSchedule} 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, automationAccountName, jobScheduleId, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._create(resourceGroupName, automationAccountName, jobScheduleId, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(resourceGroupName, automationAccountName, jobScheduleId, parameters, options, optionalCallback); + } + } + + /** + * Retrieve a list of job schedules. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName, automationAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of job schedules. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 {JobScheduleListResult} - 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 JobScheduleListResult} 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. + */ + listByAutomationAccount(resourceGroupName, automationAccountName, 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._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccount(resourceGroupName, automationAccountName, options, optionalCallback); + } + } + + /** + * Retrieve a list of job schedules. + * + * @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. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccountNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of job schedules. + * + * @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 {JobScheduleListResult} - 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 JobScheduleListResult} 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. + */ + listByAutomationAccountNext(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._listByAutomationAccountNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccountNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = JobScheduleOperations; diff --git a/lib/services/automationManagement/lib/lib/operations/jobStreamOperations.js b/lib/services/automationManagement/lib/lib/operations/jobStreamOperations.js new file mode 100644 index 0000000000..3ce20fe210 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/operations/jobStreamOperations.js @@ -0,0 +1,823 @@ +/* + * 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; + +/** + * Retrieve the job stream identified by job stream id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. + * + * @param {string} jobStreamId The job stream id. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 JobStream} 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, automationAccountName, jobName, jobStreamId, 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 clientRequestId = (options && options.clientRequestId !== undefined) ? options.clientRequestId : undefined; + let apiVersion = '2017-05-15-preview'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (jobName === null || jobName === undefined || typeof jobName.valueOf() !== 'string') { + throw new Error('jobName cannot be null or undefined and it must be of type string.'); + } + if (jobStreamId === null || jobStreamId === undefined || typeof jobStreamId.valueOf() !== 'string') { + throw new Error('jobStreamId cannot be null or undefined and it must be of type string.'); + } + if (clientRequestId !== null && clientRequestId !== undefined && typeof clientRequestId.valueOf() !== 'string') { + throw new Error('clientRequestId 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.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/streams/{jobStreamId}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{jobName}', encodeURIComponent(jobName)); + requestUrl = requestUrl.replace('{jobStreamId}', encodeURIComponent(jobStreamId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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 (clientRequestId !== undefined && clientRequestId !== null) { + httpRequest.headers['clientRequestId'] = clientRequestId; + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['JobStream']().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); + }); +} + +/** + * Retrieve a list of jobs streams identified by job name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 JobStreamListResult} 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 _listByJob(resourceGroupName, automationAccountName, jobName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let clientRequestId = (options && options.clientRequestId !== undefined) ? options.clientRequestId : undefined; + let apiVersion = '2017-05-15-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (jobName === null || jobName === undefined || typeof jobName.valueOf() !== 'string') { + throw new Error('jobName cannot be null or undefined and it must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (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 (clientRequestId !== null && clientRequestId !== undefined && typeof clientRequestId.valueOf() !== 'string') { + throw new Error('clientRequestId 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.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/streams'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{jobName}', encodeURIComponent(jobName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + queryParameters.push('api-version=' + encodeURIComponent(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 (clientRequestId !== undefined && clientRequestId !== null) { + httpRequest.headers['clientRequestId'] = clientRequestId; + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['JobStreamListResult']().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); + }); +} + +/** + * Retrieve a list of jobs streams identified by job name. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 JobStreamListResult} 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 _listByJobNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let clientRequestId = (options && options.clientRequestId !== undefined) ? options.clientRequestId : undefined; + // 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 (clientRequestId !== null && clientRequestId !== undefined && typeof clientRequestId.valueOf() !== 'string') { + throw new Error('clientRequestId 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 (clientRequestId !== undefined && clientRequestId !== null) { + httpRequest.headers['clientRequestId'] = clientRequestId; + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['JobStreamListResult']().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 JobStreamOperations. */ +class JobStreamOperations { + /** + * Create a JobStreamOperations. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._listByJob = _listByJob; + this._listByJobNext = _listByJobNext; + } + + /** + * Retrieve the job stream identified by job stream id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. + * + * @param {string} jobStreamId The job stream id. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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, automationAccountName, jobName, jobStreamId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, automationAccountName, jobName, jobStreamId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the job stream identified by job stream id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. + * + * @param {string} jobStreamId The job stream id. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 {JobStream} - 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 JobStream} 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, automationAccountName, jobName, jobStreamId, 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, automationAccountName, jobName, jobStreamId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, automationAccountName, jobName, jobStreamId, options, optionalCallback); + } + } + + /** + * Retrieve a list of jobs streams identified by job name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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. + */ + listByJobWithHttpOperationResponse(resourceGroupName, automationAccountName, jobName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByJob(resourceGroupName, automationAccountName, jobName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of jobs streams identified by job name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 {JobStreamListResult} - 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 JobStreamListResult} 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. + */ + listByJob(resourceGroupName, automationAccountName, jobName, 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._listByJob(resourceGroupName, automationAccountName, jobName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByJob(resourceGroupName, automationAccountName, jobName, options, optionalCallback); + } + } + + /** + * Retrieve a list of jobs streams identified by job name. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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. + */ + listByJobNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByJobNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of jobs streams identified by job name. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 {JobStreamListResult} - 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 JobStreamListResult} 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. + */ + listByJobNext(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._listByJobNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByJobNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = JobStreamOperations; diff --git a/lib/services/automationManagement/lib/lib/operations/keys.js b/lib/services/automationManagement/lib/lib/operations/keys.js new file mode 100644 index 0000000000..2df8a00bf8 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/operations/keys.js @@ -0,0 +1,274 @@ +/* + * 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; + +/** + * Retrieve the automation keys for an account. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 KeyListResult} 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 _listByAutomationAccount(resourceGroupName, automationAccountName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/listKeys'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['KeyListResult']().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 Keys. */ +class Keys { + /** + * Create a Keys. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listByAutomationAccount = _listByAutomationAccount; + } + + /** + * Retrieve the automation keys for an account. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName, automationAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the automation keys for an account. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 {KeyListResult} - 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 KeyListResult} 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. + */ + listByAutomationAccount(resourceGroupName, automationAccountName, 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._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccount(resourceGroupName, automationAccountName, options, optionalCallback); + } + } + +} + +module.exports = Keys; diff --git a/lib/services/automationManagement/lib/lib/operations/linkedWorkspaceOperations.js b/lib/services/automationManagement/lib/lib/operations/linkedWorkspaceOperations.js new file mode 100644 index 0000000000..d000df7367 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/operations/linkedWorkspaceOperations.js @@ -0,0 +1,274 @@ +/* + * 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; + +/** + * Retrieve the linked workspace for the account id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 LinkedWorkspace} 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, automationAccountName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/linkedWorkspace'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LinkedWorkspace']().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 LinkedWorkspaceOperations. */ +class LinkedWorkspaceOperations { + /** + * Create a LinkedWorkspaceOperations. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + } + + /** + * Retrieve the linked workspace for the account id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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. + */ + getWithHttpOperationResponse(resourceGroupName, automationAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the linked workspace for the account id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 {LinkedWorkspace} - 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 LinkedWorkspace} 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, automationAccountName, 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, automationAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, automationAccountName, options, optionalCallback); + } + } + +} + +module.exports = LinkedWorkspaceOperations; diff --git a/lib/services/automationManagement/lib/lib/operations/moduleOperations.js b/lib/services/automationManagement/lib/lib/operations/moduleOperations.js new file mode 100644 index 0000000000..132b237c66 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/operations/moduleOperations.js @@ -0,0 +1,1698 @@ +/* + * 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; + +/** + * Delete the module by name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The module 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. + * + * {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, automationAccountName, moduleName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (moduleName === null || moduleName === undefined || typeof moduleName.valueOf() !== 'string') { + throw new Error('moduleName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{moduleName}', encodeURIComponent(moduleName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Retrieve the module identified by module name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The module 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 Module} 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, automationAccountName, moduleName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (moduleName === null || moduleName === undefined || typeof moduleName.valueOf() !== 'string') { + throw new Error('moduleName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{moduleName}', encodeURIComponent(moduleName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Module']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Create or Update the module identified by module name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The name of module. + * + * @param {object} parameters The create or update parameters for module. + * + * @param {object} parameters.contentLink Gets or sets the module content link. + * + * @param {string} [parameters.contentLink.uri] Gets or sets the uri of the + * runbook content. + * + * @param {object} [parameters.contentLink.contentHash] Gets or sets the hash. + * + * @param {string} parameters.contentLink.contentHash.algorithm Gets or sets + * the content hash algorithm used to hash the content. + * + * @param {string} parameters.contentLink.contentHash.value Gets or sets + * expected hash value of the content. + * + * @param {string} [parameters.contentLink.version] Gets or sets the version of + * the content. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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 Module} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, automationAccountName, moduleName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (moduleName === null || moduleName === undefined || typeof moduleName.valueOf() !== 'string') { + throw new Error('moduleName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{moduleName}', encodeURIComponent(moduleName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['ModuleCreateOrUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Module']().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['Module']().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); + }); +} + +/** + * Update the module identified by module name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The name of module. + * + * @param {object} parameters The update parameters for module. + * + * @param {object} [parameters.contentLink] Gets or sets the module content + * link. + * + * @param {string} [parameters.contentLink.uri] Gets or sets the uri of the + * runbook content. + * + * @param {object} [parameters.contentLink.contentHash] Gets or sets the hash. + * + * @param {string} parameters.contentLink.contentHash.algorithm Gets or sets + * the content hash algorithm used to hash the content. + * + * @param {string} parameters.contentLink.contentHash.value Gets or sets + * expected hash value of the content. + * + * @param {string} [parameters.contentLink.version] Gets or sets the version of + * the content. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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 Module} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, automationAccountName, moduleName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (moduleName === null || moduleName === undefined || typeof moduleName.valueOf() !== 'string') { + throw new Error('moduleName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{moduleName}', encodeURIComponent(moduleName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['ModuleUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Module']().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); + }); +} + +/** + * Retrieve a list of modules. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 ModuleListResult} 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 _listByAutomationAccount(resourceGroupName, automationAccountName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ModuleListResult']().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); + }); +} + +/** + * Retrieve a list of modules. + * + * @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 ModuleListResult} 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 _listByAutomationAccountNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ModuleListResult']().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 ModuleOperations. */ +class ModuleOperations { + /** + * Create a ModuleOperations. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._update = _update; + this._listByAutomationAccount = _listByAutomationAccount; + this._listByAutomationAccountNext = _listByAutomationAccountNext; + } + + /** + * Delete the module by name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The module 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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, automationAccountName, moduleName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, automationAccountName, moduleName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete the module by name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The module 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 {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, automationAccountName, moduleName, 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, automationAccountName, moduleName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, automationAccountName, moduleName, options, optionalCallback); + } + } + + /** + * Retrieve the module identified by module name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The module 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. + */ + getWithHttpOperationResponse(resourceGroupName, automationAccountName, moduleName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, automationAccountName, moduleName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the module identified by module name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The module 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 {Module} - 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 Module} 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, automationAccountName, moduleName, 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, automationAccountName, moduleName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, automationAccountName, moduleName, options, optionalCallback); + } + } + + /** + * Create or Update the module identified by module name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The name of module. + * + * @param {object} parameters The create or update parameters for module. + * + * @param {object} parameters.contentLink Gets or sets the module content link. + * + * @param {string} [parameters.contentLink.uri] Gets or sets the uri of the + * runbook content. + * + * @param {object} [parameters.contentLink.contentHash] Gets or sets the hash. + * + * @param {string} parameters.contentLink.contentHash.algorithm Gets or sets + * the content hash algorithm used to hash the content. + * + * @param {string} parameters.contentLink.contentHash.value Gets or sets + * expected hash value of the content. + * + * @param {string} [parameters.contentLink.version] Gets or sets the version of + * the content. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, automationAccountName, moduleName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, automationAccountName, moduleName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create or Update the module identified by module name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The name of module. + * + * @param {object} parameters The create or update parameters for module. + * + * @param {object} parameters.contentLink Gets or sets the module content link. + * + * @param {string} [parameters.contentLink.uri] Gets or sets the uri of the + * runbook content. + * + * @param {object} [parameters.contentLink.contentHash] Gets or sets the hash. + * + * @param {string} parameters.contentLink.contentHash.algorithm Gets or sets + * the content hash algorithm used to hash the content. + * + * @param {string} parameters.contentLink.contentHash.value Gets or sets + * expected hash value of the content. + * + * @param {string} [parameters.contentLink.version] Gets or sets the version of + * the content. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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 {Module} - 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 Module} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, automationAccountName, moduleName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, automationAccountName, moduleName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, automationAccountName, moduleName, parameters, options, optionalCallback); + } + } + + /** + * Update the module identified by module name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The name of module. + * + * @param {object} parameters The update parameters for module. + * + * @param {object} [parameters.contentLink] Gets or sets the module content + * link. + * + * @param {string} [parameters.contentLink.uri] Gets or sets the uri of the + * runbook content. + * + * @param {object} [parameters.contentLink.contentHash] Gets or sets the hash. + * + * @param {string} parameters.contentLink.contentHash.algorithm Gets or sets + * the content hash algorithm used to hash the content. + * + * @param {string} parameters.contentLink.contentHash.value Gets or sets + * expected hash value of the content. + * + * @param {string} [parameters.contentLink.version] Gets or sets the version of + * the content. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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. + */ + updateWithHttpOperationResponse(resourceGroupName, automationAccountName, moduleName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, automationAccountName, moduleName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Update the module identified by module name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The name of module. + * + * @param {object} parameters The update parameters for module. + * + * @param {object} [parameters.contentLink] Gets or sets the module content + * link. + * + * @param {string} [parameters.contentLink.uri] Gets or sets the uri of the + * runbook content. + * + * @param {object} [parameters.contentLink.contentHash] Gets or sets the hash. + * + * @param {string} parameters.contentLink.contentHash.algorithm Gets or sets + * the content hash algorithm used to hash the content. + * + * @param {string} parameters.contentLink.contentHash.value Gets or sets + * expected hash value of the content. + * + * @param {string} [parameters.contentLink.version] Gets or sets the version of + * the content. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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 {Module} - 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 Module} 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. + */ + update(resourceGroupName, automationAccountName, moduleName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, automationAccountName, moduleName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, automationAccountName, moduleName, parameters, options, optionalCallback); + } + } + + /** + * Retrieve a list of modules. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName, automationAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of modules. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 {ModuleListResult} - 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 ModuleListResult} 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. + */ + listByAutomationAccount(resourceGroupName, automationAccountName, 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._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccount(resourceGroupName, automationAccountName, options, optionalCallback); + } + } + + /** + * Retrieve a list of modules. + * + * @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. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccountNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of modules. + * + * @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 {ModuleListResult} - 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 ModuleListResult} 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. + */ + listByAutomationAccountNext(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._listByAutomationAccountNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccountNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = ModuleOperations; diff --git a/lib/services/automationManagement/lib/lib/operations/nodeReports.js b/lib/services/automationManagement/lib/lib/operations/nodeReports.js new file mode 100644 index 0000000000..337c9fd0a0 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/operations/nodeReports.js @@ -0,0 +1,1048 @@ +/* + * 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; + +/** + * Retrieve the Dsc node report list by node id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId The parameters supplied to the list operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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 DscNodeReportListResult} 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 _listByNode(resourceGroupName, automationAccountName, nodeId, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let apiVersion = '2018-01-15'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (nodeId === null || nodeId === undefined || typeof nodeId.valueOf() !== 'string') { + throw new Error('nodeId cannot be null or undefined and it must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}/reports'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{nodeId}', encodeURIComponent(nodeId)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DscNodeReportListResult']().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); + }); +} + +/** + * Retrieve the Dsc node report data by node id and report id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId The Dsc node id. + * + * @param {string} reportId The report id. + * + * @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 DscNodeReport} 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, automationAccountName, nodeId, reportId, 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 apiVersion = '2018-01-15'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (nodeId === null || nodeId === undefined || typeof nodeId.valueOf() !== 'string') { + throw new Error('nodeId cannot be null or undefined and it must be of type string.'); + } + if (reportId === null || reportId === undefined || typeof reportId.valueOf() !== 'string') { + throw new Error('reportId cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}/reports/{reportId}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{nodeId}', encodeURIComponent(nodeId)); + requestUrl = requestUrl.replace('{reportId}', encodeURIComponent(reportId)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DscNodeReport']().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); + }); +} + +/** + * Retrieve the Dsc node reports by node id and report id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId The Dsc node id. + * + * @param {string} reportId The report id. + * + * @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. + * + * {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 _getContent(resourceGroupName, automationAccountName, nodeId, reportId, 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 apiVersion = '2018-01-15'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (nodeId === null || nodeId === undefined || typeof nodeId.valueOf() !== 'string') { + throw new Error('nodeId cannot be null or undefined and it must be of type string.'); + } + if (reportId === null || reportId === undefined || typeof reportId.valueOf() !== 'string') { + throw new Error('reportId cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}/reports/{reportId}/content'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{nodeId}', encodeURIComponent(nodeId)); + requestUrl = requestUrl.replace('{reportId}', encodeURIComponent(reportId)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = { + required: false, + serializedName: 'parsedResponse', + type: { + name: 'Object' + } + }; + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Retrieve the Dsc node report list by node id. + * + * @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 DscNodeReportListResult} 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 _listByNodeNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DscNodeReportListResult']().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 NodeReports. */ +class NodeReports { + /** + * Create a NodeReports. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listByNode = _listByNode; + this._get = _get; + this._getContent = _getContent; + this._listByNodeNext = _listByNodeNext; + } + + /** + * Retrieve the Dsc node report list by node id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId The parameters supplied to the list operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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. + */ + listByNodeWithHttpOperationResponse(resourceGroupName, automationAccountName, nodeId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByNode(resourceGroupName, automationAccountName, nodeId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the Dsc node report list by node id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId The parameters supplied to the list operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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 {DscNodeReportListResult} - 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 DscNodeReportListResult} 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. + */ + listByNode(resourceGroupName, automationAccountName, nodeId, 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._listByNode(resourceGroupName, automationAccountName, nodeId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByNode(resourceGroupName, automationAccountName, nodeId, options, optionalCallback); + } + } + + /** + * Retrieve the Dsc node report data by node id and report id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId The Dsc node id. + * + * @param {string} reportId The report id. + * + * @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, automationAccountName, nodeId, reportId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, automationAccountName, nodeId, reportId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the Dsc node report data by node id and report id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId The Dsc node id. + * + * @param {string} reportId The report id. + * + * @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 {DscNodeReport} - 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 DscNodeReport} 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, automationAccountName, nodeId, reportId, 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, automationAccountName, nodeId, reportId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, automationAccountName, nodeId, reportId, options, optionalCallback); + } + } + + /** + * Retrieve the Dsc node reports by node id and report id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId The Dsc node id. + * + * @param {string} reportId The report id. + * + * @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. + */ + getContentWithHttpOperationResponse(resourceGroupName, automationAccountName, nodeId, reportId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getContent(resourceGroupName, automationAccountName, nodeId, reportId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the Dsc node reports by node id and report id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId The Dsc node id. + * + * @param {string} reportId The report id. + * + * @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 {Object} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + getContent(resourceGroupName, automationAccountName, nodeId, reportId, 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._getContent(resourceGroupName, automationAccountName, nodeId, reportId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getContent(resourceGroupName, automationAccountName, nodeId, reportId, options, optionalCallback); + } + } + + /** + * Retrieve the Dsc node report list by node id. + * + * @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. + */ + listByNodeNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByNodeNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the Dsc node report list by node id. + * + * @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 {DscNodeReportListResult} - 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 DscNodeReportListResult} 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. + */ + listByNodeNext(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._listByNodeNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByNodeNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = NodeReports; diff --git a/lib/services/automationManagement/lib/lib/operations/objectDataTypes.js b/lib/services/automationManagement/lib/lib/operations/objectDataTypes.js new file mode 100644 index 0000000000..602b0aff15 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/operations/objectDataTypes.js @@ -0,0 +1,549 @@ +/* + * 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; + +/** + * Retrieve a list of fields of a given type identified by module name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The name of module. + * + * @param {string} typeName The name of type. + * + * @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 TypeFieldListResult} 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 _listFieldsByModuleAndType(resourceGroupName, automationAccountName, moduleName, typeName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (moduleName === null || moduleName === undefined || typeof moduleName.valueOf() !== 'string') { + throw new Error('moduleName cannot be null or undefined and it must be of type string.'); + } + if (typeName === null || typeName === undefined || typeof typeName.valueOf() !== 'string') { + throw new Error('typeName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/objectDataTypes/{typeName}/fields'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{moduleName}', encodeURIComponent(moduleName)); + requestUrl = requestUrl.replace('{typeName}', encodeURIComponent(typeName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['TypeFieldListResult']().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); + }); +} + +/** + * Retrieve a list of fields of a given type across all accessible modules. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} typeName The name of type. + * + * @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 TypeFieldListResult} 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 _listFieldsByType(resourceGroupName, automationAccountName, typeName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (typeName === null || typeName === undefined || typeof typeName.valueOf() !== 'string') { + throw new Error('typeName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/objectDataTypes/{typeName}/fields'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{typeName}', encodeURIComponent(typeName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['TypeFieldListResult']().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 ObjectDataTypes. */ +class ObjectDataTypes { + /** + * Create a ObjectDataTypes. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listFieldsByModuleAndType = _listFieldsByModuleAndType; + this._listFieldsByType = _listFieldsByType; + } + + /** + * Retrieve a list of fields of a given type identified by module name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The name of module. + * + * @param {string} typeName The name of type. + * + * @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. + */ + listFieldsByModuleAndTypeWithHttpOperationResponse(resourceGroupName, automationAccountName, moduleName, typeName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listFieldsByModuleAndType(resourceGroupName, automationAccountName, moduleName, typeName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of fields of a given type identified by module name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The name of module. + * + * @param {string} typeName The name of type. + * + * @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 {TypeFieldListResult} - 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 TypeFieldListResult} 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. + */ + listFieldsByModuleAndType(resourceGroupName, automationAccountName, moduleName, typeName, 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._listFieldsByModuleAndType(resourceGroupName, automationAccountName, moduleName, typeName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listFieldsByModuleAndType(resourceGroupName, automationAccountName, moduleName, typeName, options, optionalCallback); + } + } + + /** + * Retrieve a list of fields of a given type across all accessible modules. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} typeName The name of type. + * + * @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. + */ + listFieldsByTypeWithHttpOperationResponse(resourceGroupName, automationAccountName, typeName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listFieldsByType(resourceGroupName, automationAccountName, typeName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of fields of a given type across all accessible modules. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} typeName The name of type. + * + * @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 {TypeFieldListResult} - 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 TypeFieldListResult} 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. + */ + listFieldsByType(resourceGroupName, automationAccountName, typeName, 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._listFieldsByType(resourceGroupName, automationAccountName, typeName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listFieldsByType(resourceGroupName, automationAccountName, typeName, options, optionalCallback); + } + } + +} + +module.exports = ObjectDataTypes; diff --git a/lib/services/automationManagement/lib/lib/operations/operations.js b/lib/services/automationManagement/lib/lib/operations/operations.js new file mode 100644 index 0000000000..f7b6c1a8fb --- /dev/null +++ b/lib/services/automationManagement/lib/lib/operations/operations.js @@ -0,0 +1,236 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Lists all of the available Automation REST API operations. + * + * @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.'); + } + let apiVersion = '2015-10-31'; + // 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.Automation/operations'; + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['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 {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + } + + /** + * Lists all of the available Automation REST API operations. + * + * @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; + }); + }); + } + + /** + * Lists all of the available Automation REST API operations. + * + * @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); + } + } + +} + +module.exports = Operations; diff --git a/lib/services/automationManagement/lib/lib/operations/runbookDraftOperations.js b/lib/services/automationManagement/lib/lib/operations/runbookDraftOperations.js new file mode 100644 index 0000000000..60012f7fed --- /dev/null +++ b/lib/services/automationManagement/lib/lib/operations/runbookDraftOperations.js @@ -0,0 +1,1622 @@ +/* + * 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; + +/** + * Retrieve the content of runbook draft identified by runbook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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. + * + * {string} [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 _getContent(resourceGroupName, automationAccountName, runbookName, 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 apiVersion = '2015-10-31'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (runbookName === null || runbookName === undefined || typeof runbookName.valueOf() !== 'string') { + throw new Error('runbookName 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.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/content'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{runbookName}', encodeURIComponent(runbookName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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 = { + required: false, + serializedName: 'parsedResponse', + type: { + name: 'String' + } + }; + 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); + }); +} + + +/** + * Replaces the runbook draft content. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook name. + * + * @param {string} runbookContent The runbook draft content. + * + * @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 _replaceContent(resourceGroupName, automationAccountName, runbookName, runbookContent, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginReplaceContent(resourceGroupName, automationAccountName, runbookName, runbookContent, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Retrieve the runbook draft identified by runbook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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 RunbookDraft} 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, automationAccountName, runbookName, 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 apiVersion = '2015-10-31'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (runbookName === null || runbookName === undefined || typeof runbookName.valueOf() !== 'string') { + throw new Error('runbookName 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.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{runbookName}', encodeURIComponent(runbookName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RunbookDraft']().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); + }); +} + + +/** + * Publish runbook draft. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The parameters supplied to the publish runbook + * 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. + * + * {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 _publish(resourceGroupName, automationAccountName, runbookName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginPublish(resourceGroupName, automationAccountName, runbookName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Undo draft edit to last known published state identified by runbook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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 RunbookDraftUndoEditResult} 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 _undoEdit(resourceGroupName, automationAccountName, runbookName, 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 apiVersion = '2015-10-31'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (runbookName === null || runbookName === undefined || typeof runbookName.valueOf() !== 'string') { + throw new Error('runbookName 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.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/undoEdit'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{runbookName}', encodeURIComponent(runbookName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RunbookDraftUndoEditResult']().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); + }); +} + +/** + * Replaces the runbook draft content. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook name. + * + * @param {string} runbookContent The runbook draft content. + * + * @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 _beginReplaceContent(resourceGroupName, automationAccountName, runbookName, runbookContent, 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 apiVersion = '2015-10-31'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (runbookName === null || runbookName === undefined || typeof runbookName.valueOf() !== 'string') { + throw new Error('runbookName cannot be null or undefined and it must be of type string.'); + } + if (runbookContent === null || runbookContent === undefined || typeof runbookContent.valueOf() !== 'string') { + throw new Error('runbookContent 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.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/content'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{runbookName}', encodeURIComponent(runbookName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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'] = 'text/powershell'; + 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 (runbookContent !== null && runbookContent !== undefined) { + let requestModelMapper = { + required: true, + serializedName: 'runbookContent', + type: { + name: 'String' + } + }; + requestModel = client.serialize(requestModelMapper, runbookContent, 'runbookContent'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(runbookContent, 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 !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Publish runbook draft. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The parameters supplied to the publish runbook + * 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. + * + * {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 _beginPublish(resourceGroupName, automationAccountName, runbookName, 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 apiVersion = '2015-10-31'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (runbookName === null || runbookName === undefined || typeof runbookName.valueOf() !== 'string') { + throw new Error('runbookName 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.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/publish'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{runbookName}', encodeURIComponent(runbookName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.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 !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a RunbookDraftOperations. */ +class RunbookDraftOperations { + /** + * Create a RunbookDraftOperations. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._getContent = _getContent; + this._replaceContent = _replaceContent; + this._get = _get; + this._publish = _publish; + this._undoEdit = _undoEdit; + this._beginReplaceContent = _beginReplaceContent; + this._beginPublish = _beginPublish; + } + + /** + * Retrieve the content of runbook draft identified by runbook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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. + */ + getContentWithHttpOperationResponse(resourceGroupName, automationAccountName, runbookName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getContent(resourceGroupName, automationAccountName, runbookName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the content of runbook draft identified by runbook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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 {String} - 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. + * + * {string} [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. + */ + getContent(resourceGroupName, automationAccountName, runbookName, 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._getContent(resourceGroupName, automationAccountName, runbookName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getContent(resourceGroupName, automationAccountName, runbookName, options, optionalCallback); + } + } + + /** + * Replaces the runbook draft content. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook name. + * + * @param {string} runbookContent The runbook draft content. + * + * @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. + */ + replaceContentWithHttpOperationResponse(resourceGroupName, automationAccountName, runbookName, runbookContent, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._replaceContent(resourceGroupName, automationAccountName, runbookName, runbookContent, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Replaces the runbook draft content. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook name. + * + * @param {string} runbookContent The runbook draft content. + * + * @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. + */ + replaceContent(resourceGroupName, automationAccountName, runbookName, runbookContent, 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._replaceContent(resourceGroupName, automationAccountName, runbookName, runbookContent, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._replaceContent(resourceGroupName, automationAccountName, runbookName, runbookContent, options, optionalCallback); + } + } + + /** + * Retrieve the runbook draft identified by runbook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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. + */ + getWithHttpOperationResponse(resourceGroupName, automationAccountName, runbookName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, automationAccountName, runbookName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the runbook draft identified by runbook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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 {RunbookDraft} - 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 RunbookDraft} 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, automationAccountName, runbookName, 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, automationAccountName, runbookName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, automationAccountName, runbookName, options, optionalCallback); + } + } + + /** + * Publish runbook draft. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The parameters supplied to the publish runbook + * 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. + */ + publishWithHttpOperationResponse(resourceGroupName, automationAccountName, runbookName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._publish(resourceGroupName, automationAccountName, runbookName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Publish runbook draft. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The parameters supplied to the publish runbook + * 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 {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. + */ + publish(resourceGroupName, automationAccountName, runbookName, 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._publish(resourceGroupName, automationAccountName, runbookName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._publish(resourceGroupName, automationAccountName, runbookName, options, optionalCallback); + } + } + + /** + * Undo draft edit to last known published state identified by runbook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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. + */ + undoEditWithHttpOperationResponse(resourceGroupName, automationAccountName, runbookName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._undoEdit(resourceGroupName, automationAccountName, runbookName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Undo draft edit to last known published state identified by runbook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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 {RunbookDraftUndoEditResult} - 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 RunbookDraftUndoEditResult} 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. + */ + undoEdit(resourceGroupName, automationAccountName, runbookName, 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._undoEdit(resourceGroupName, automationAccountName, runbookName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._undoEdit(resourceGroupName, automationAccountName, runbookName, options, optionalCallback); + } + } + + /** + * Replaces the runbook draft content. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook name. + * + * @param {string} runbookContent The runbook draft content. + * + * @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. + */ + beginReplaceContentWithHttpOperationResponse(resourceGroupName, automationAccountName, runbookName, runbookContent, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginReplaceContent(resourceGroupName, automationAccountName, runbookName, runbookContent, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Replaces the runbook draft content. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook name. + * + * @param {string} runbookContent The runbook draft content. + * + * @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. + */ + beginReplaceContent(resourceGroupName, automationAccountName, runbookName, runbookContent, 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._beginReplaceContent(resourceGroupName, automationAccountName, runbookName, runbookContent, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginReplaceContent(resourceGroupName, automationAccountName, runbookName, runbookContent, options, optionalCallback); + } + } + + /** + * Publish runbook draft. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The parameters supplied to the publish runbook + * 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. + */ + beginPublishWithHttpOperationResponse(resourceGroupName, automationAccountName, runbookName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginPublish(resourceGroupName, automationAccountName, runbookName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Publish runbook draft. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The parameters supplied to the publish runbook + * 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 {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. + */ + beginPublish(resourceGroupName, automationAccountName, runbookName, 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._beginPublish(resourceGroupName, automationAccountName, runbookName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginPublish(resourceGroupName, automationAccountName, runbookName, options, optionalCallback); + } + } + +} + +module.exports = RunbookDraftOperations; diff --git a/lib/services/automationManagement/lib/lib/operations/runbookOperations.js b/lib/services/automationManagement/lib/lib/operations/runbookOperations.js new file mode 100644 index 0000000000..5880429498 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/operations/runbookOperations.js @@ -0,0 +1,2049 @@ +/* + * 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; + +/** + * Retrieve the content of runbook identified by runbook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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. + * + * {string} [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 _getContent(resourceGroupName, automationAccountName, runbookName, 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 apiVersion = '2015-10-31'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (runbookName === null || runbookName === undefined || typeof runbookName.valueOf() !== 'string') { + throw new Error('runbookName 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.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/content'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{runbookName}', encodeURIComponent(runbookName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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 = { + required: false, + serializedName: 'parsedResponse', + type: { + name: 'String' + } + }; + 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); + }); +} + +/** + * Retrieve the runbook identified by runbook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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 Runbook} 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, automationAccountName, runbookName, 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 apiVersion = '2015-10-31'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (runbookName === null || runbookName === undefined || typeof runbookName.valueOf() !== 'string') { + throw new Error('runbookName 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.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{runbookName}', encodeURIComponent(runbookName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Runbook']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Create the runbook identified by runbook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook name. + * + * @param {object} parameters The create or update parameters for runbook. + * Provide either content link for a published runbook or draft, not both. + * + * @param {boolean} [parameters.logVerbose] Gets or sets verbose log option. + * + * @param {boolean} [parameters.logProgress] Gets or sets progress log option. + * + * @param {string} parameters.runbookType Gets or sets the type of the runbook. + * Possible values include: 'Script', 'Graph', 'PowerShellWorkflow', + * 'PowerShell', 'GraphPowerShellWorkflow', 'GraphPowerShell' + * + * @param {object} [parameters.draft] Gets or sets the draft runbook + * properties. + * + * @param {boolean} [parameters.draft.inEdit] Gets or sets whether runbook is + * in edit mode. + * + * @param {object} [parameters.draft.draftContentLink] Gets or sets the draft + * runbook content link. + * + * @param {date} [parameters.draft.creationTime] Gets or sets the creation time + * of the runbook draft. + * + * @param {date} [parameters.draft.lastModifiedTime] Gets or sets the last + * modified time of the runbook draft. + * + * @param {object} [parameters.draft.parameters] Gets or sets the runbook draft + * parameters. + * + * @param {array} [parameters.draft.outputTypes] Gets or sets the runbook + * output types. + * + * @param {object} [parameters.publishContentLink] Gets or sets the published + * runbook content link. + * + * @param {string} [parameters.publishContentLink.uri] Gets or sets the uri of + * the runbook content. + * + * @param {object} [parameters.publishContentLink.contentHash] Gets or sets the + * hash. + * + * @param {string} parameters.publishContentLink.contentHash.algorithm Gets or + * sets the content hash algorithm used to hash the content. + * + * @param {string} parameters.publishContentLink.contentHash.value Gets or sets + * expected hash value of the content. + * + * @param {string} [parameters.publishContentLink.version] Gets or sets the + * version of the content. + * + * @param {string} [parameters.description] Gets or sets the description of the + * runbook. + * + * @param {number} [parameters.logActivityTrace] Gets or sets the + * activity-level tracing options of the runbook. + * + * @param {string} [parameters.name] Gets or sets the name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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 Runbook} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, automationAccountName, runbookName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2015-10-31'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (runbookName === null || runbookName === undefined || typeof runbookName.valueOf() !== 'string') { + throw new Error('runbookName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters 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.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{runbookName}', encodeURIComponent(runbookName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['RunbookCreateOrUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201 && statusCode !== 400) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Runbook']().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['Runbook']().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); + }); +} + +/** + * Update the runbook identified by runbook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook name. + * + * @param {object} parameters The update parameters for runbook. + * + * @param {string} [parameters.description] Gets or sets the description of the + * runbook. + * + * @param {boolean} [parameters.logVerbose] Gets or sets verbose log option. + * + * @param {boolean} [parameters.logProgress] Gets or sets progress log option. + * + * @param {number} [parameters.logActivityTrace] Gets or sets the + * activity-level tracing options of the runbook. + * + * @param {string} [parameters.name] Gets or sets the name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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 Runbook} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, automationAccountName, runbookName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2015-10-31'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (runbookName === null || runbookName === undefined || typeof runbookName.valueOf() !== 'string') { + throw new Error('runbookName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters 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.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{runbookName}', encodeURIComponent(runbookName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['RunbookUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Runbook']().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); + }); +} + +/** + * Delete the runbook by name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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. + * + * {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, automationAccountName, runbookName, 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 apiVersion = '2015-10-31'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (runbookName === null || runbookName === undefined || typeof runbookName.valueOf() !== 'string') { + throw new Error('runbookName 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.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{runbookName}', encodeURIComponent(runbookName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Retrieve a list of runbooks. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 RunbookListResult} 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 _listByAutomationAccount(resourceGroupName, automationAccountName, 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 apiVersion = '2015-10-31'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName 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.Automation/automationAccounts/{automationAccountName}/runbooks'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RunbookListResult']().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); + }); +} + +/** + * Retrieve a list of runbooks. + * + * @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 RunbookListResult} 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 _listByAutomationAccountNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RunbookListResult']().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 RunbookOperations. */ +class RunbookOperations { + /** + * Create a RunbookOperations. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._getContent = _getContent; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._update = _update; + this._deleteMethod = _deleteMethod; + this._listByAutomationAccount = _listByAutomationAccount; + this._listByAutomationAccountNext = _listByAutomationAccountNext; + } + + /** + * Retrieve the content of runbook identified by runbook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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. + */ + getContentWithHttpOperationResponse(resourceGroupName, automationAccountName, runbookName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getContent(resourceGroupName, automationAccountName, runbookName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the content of runbook identified by runbook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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 {String} - 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. + * + * {string} [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. + */ + getContent(resourceGroupName, automationAccountName, runbookName, 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._getContent(resourceGroupName, automationAccountName, runbookName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getContent(resourceGroupName, automationAccountName, runbookName, options, optionalCallback); + } + } + + /** + * Retrieve the runbook identified by runbook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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. + */ + getWithHttpOperationResponse(resourceGroupName, automationAccountName, runbookName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, automationAccountName, runbookName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the runbook identified by runbook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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 {Runbook} - 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 Runbook} 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, automationAccountName, runbookName, 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, automationAccountName, runbookName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, automationAccountName, runbookName, options, optionalCallback); + } + } + + /** + * Create the runbook identified by runbook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook name. + * + * @param {object} parameters The create or update parameters for runbook. + * Provide either content link for a published runbook or draft, not both. + * + * @param {boolean} [parameters.logVerbose] Gets or sets verbose log option. + * + * @param {boolean} [parameters.logProgress] Gets or sets progress log option. + * + * @param {string} parameters.runbookType Gets or sets the type of the runbook. + * Possible values include: 'Script', 'Graph', 'PowerShellWorkflow', + * 'PowerShell', 'GraphPowerShellWorkflow', 'GraphPowerShell' + * + * @param {object} [parameters.draft] Gets or sets the draft runbook + * properties. + * + * @param {boolean} [parameters.draft.inEdit] Gets or sets whether runbook is + * in edit mode. + * + * @param {object} [parameters.draft.draftContentLink] Gets or sets the draft + * runbook content link. + * + * @param {date} [parameters.draft.creationTime] Gets or sets the creation time + * of the runbook draft. + * + * @param {date} [parameters.draft.lastModifiedTime] Gets or sets the last + * modified time of the runbook draft. + * + * @param {object} [parameters.draft.parameters] Gets or sets the runbook draft + * parameters. + * + * @param {array} [parameters.draft.outputTypes] Gets or sets the runbook + * output types. + * + * @param {object} [parameters.publishContentLink] Gets or sets the published + * runbook content link. + * + * @param {string} [parameters.publishContentLink.uri] Gets or sets the uri of + * the runbook content. + * + * @param {object} [parameters.publishContentLink.contentHash] Gets or sets the + * hash. + * + * @param {string} parameters.publishContentLink.contentHash.algorithm Gets or + * sets the content hash algorithm used to hash the content. + * + * @param {string} parameters.publishContentLink.contentHash.value Gets or sets + * expected hash value of the content. + * + * @param {string} [parameters.publishContentLink.version] Gets or sets the + * version of the content. + * + * @param {string} [parameters.description] Gets or sets the description of the + * runbook. + * + * @param {number} [parameters.logActivityTrace] Gets or sets the + * activity-level tracing options of the runbook. + * + * @param {string} [parameters.name] Gets or sets the name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, automationAccountName, runbookName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, automationAccountName, runbookName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create the runbook identified by runbook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook name. + * + * @param {object} parameters The create or update parameters for runbook. + * Provide either content link for a published runbook or draft, not both. + * + * @param {boolean} [parameters.logVerbose] Gets or sets verbose log option. + * + * @param {boolean} [parameters.logProgress] Gets or sets progress log option. + * + * @param {string} parameters.runbookType Gets or sets the type of the runbook. + * Possible values include: 'Script', 'Graph', 'PowerShellWorkflow', + * 'PowerShell', 'GraphPowerShellWorkflow', 'GraphPowerShell' + * + * @param {object} [parameters.draft] Gets or sets the draft runbook + * properties. + * + * @param {boolean} [parameters.draft.inEdit] Gets or sets whether runbook is + * in edit mode. + * + * @param {object} [parameters.draft.draftContentLink] Gets or sets the draft + * runbook content link. + * + * @param {date} [parameters.draft.creationTime] Gets or sets the creation time + * of the runbook draft. + * + * @param {date} [parameters.draft.lastModifiedTime] Gets or sets the last + * modified time of the runbook draft. + * + * @param {object} [parameters.draft.parameters] Gets or sets the runbook draft + * parameters. + * + * @param {array} [parameters.draft.outputTypes] Gets or sets the runbook + * output types. + * + * @param {object} [parameters.publishContentLink] Gets or sets the published + * runbook content link. + * + * @param {string} [parameters.publishContentLink.uri] Gets or sets the uri of + * the runbook content. + * + * @param {object} [parameters.publishContentLink.contentHash] Gets or sets the + * hash. + * + * @param {string} parameters.publishContentLink.contentHash.algorithm Gets or + * sets the content hash algorithm used to hash the content. + * + * @param {string} parameters.publishContentLink.contentHash.value Gets or sets + * expected hash value of the content. + * + * @param {string} [parameters.publishContentLink.version] Gets or sets the + * version of the content. + * + * @param {string} [parameters.description] Gets or sets the description of the + * runbook. + * + * @param {number} [parameters.logActivityTrace] Gets or sets the + * activity-level tracing options of the runbook. + * + * @param {string} [parameters.name] Gets or sets the name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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 {Runbook} - 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 Runbook} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, automationAccountName, runbookName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, automationAccountName, runbookName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, automationAccountName, runbookName, parameters, options, optionalCallback); + } + } + + /** + * Update the runbook identified by runbook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook name. + * + * @param {object} parameters The update parameters for runbook. + * + * @param {string} [parameters.description] Gets or sets the description of the + * runbook. + * + * @param {boolean} [parameters.logVerbose] Gets or sets verbose log option. + * + * @param {boolean} [parameters.logProgress] Gets or sets progress log option. + * + * @param {number} [parameters.logActivityTrace] Gets or sets the + * activity-level tracing options of the runbook. + * + * @param {string} [parameters.name] Gets or sets the name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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. + */ + updateWithHttpOperationResponse(resourceGroupName, automationAccountName, runbookName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, automationAccountName, runbookName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Update the runbook identified by runbook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook name. + * + * @param {object} parameters The update parameters for runbook. + * + * @param {string} [parameters.description] Gets or sets the description of the + * runbook. + * + * @param {boolean} [parameters.logVerbose] Gets or sets verbose log option. + * + * @param {boolean} [parameters.logProgress] Gets or sets progress log option. + * + * @param {number} [parameters.logActivityTrace] Gets or sets the + * activity-level tracing options of the runbook. + * + * @param {string} [parameters.name] Gets or sets the name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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 {Runbook} - 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 Runbook} 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. + */ + update(resourceGroupName, automationAccountName, runbookName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, automationAccountName, runbookName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, automationAccountName, runbookName, parameters, options, optionalCallback); + } + } + + /** + * Delete the runbook by name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, automationAccountName, runbookName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, automationAccountName, runbookName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete the runbook by name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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 {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, automationAccountName, runbookName, 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, automationAccountName, runbookName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, automationAccountName, runbookName, options, optionalCallback); + } + } + + /** + * Retrieve a list of runbooks. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName, automationAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of runbooks. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 {RunbookListResult} - 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 RunbookListResult} 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. + */ + listByAutomationAccount(resourceGroupName, automationAccountName, 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._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccount(resourceGroupName, automationAccountName, options, optionalCallback); + } + } + + /** + * Retrieve a list of runbooks. + * + * @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. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccountNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of runbooks. + * + * @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 {RunbookListResult} - 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 RunbookListResult} 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. + */ + listByAutomationAccountNext(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._listByAutomationAccountNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccountNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = RunbookOperations; diff --git a/lib/services/automationManagement/lib/lib/operations/scheduleOperations.js b/lib/services/automationManagement/lib/lib/operations/scheduleOperations.js new file mode 100644 index 0000000000..2657038aae --- /dev/null +++ b/lib/services/automationManagement/lib/lib/operations/scheduleOperations.js @@ -0,0 +1,1660 @@ +/* + * 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; + +/** + * Create a schedule. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} scheduleName The schedule name. + * + * @param {object} parameters The parameters supplied to the create or update + * schedule operation. + * + * @param {string} parameters.name Gets or sets the name of the schedule. + * + * @param {string} [parameters.description] Gets or sets the description of the + * schedule. + * + * @param {date} parameters.startTime Gets or sets the start time of the + * schedule. + * + * @param {date} [parameters.expiryTime] Gets or sets the end time of the + * schedule. + * + * @param {object} [parameters.interval] Gets or sets the interval of the + * schedule. + * + * @param {string} parameters.frequency Possible values include: 'OneTime', + * 'Day', 'Hour', 'Week', 'Month' + * + * @param {string} [parameters.timeZone] Gets or sets the time zone of the + * schedule. + * + * @param {object} [parameters.advancedSchedule] Gets or sets the + * AdvancedSchedule. + * + * @param {array} [parameters.advancedSchedule.weekDays] Days of the week that + * the job should execute on. + * + * @param {array} [parameters.advancedSchedule.monthDays] Days of the month + * that the job should execute on. Must be between 1 and 31. + * + * @param {array} [parameters.advancedSchedule.monthlyOccurrences] Occurrences + * of days within a month. + * + * @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 Schedule} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, automationAccountName, scheduleName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (scheduleName === null || scheduleName === undefined || typeof scheduleName.valueOf() !== 'string') { + throw new Error('scheduleName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{scheduleName}', encodeURIComponent(scheduleName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['ScheduleCreateOrUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 201 && statusCode !== 409) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Schedule']().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); + }); +} + +/** + * Update the schedule identified by schedule name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} scheduleName The schedule name. + * + * @param {object} parameters The parameters supplied to the update schedule + * operation. + * + * @param {string} [parameters.name] Gets or sets the name of the schedule. + * + * @param {string} [parameters.description] Gets or sets the description of the + * schedule. + * + * @param {boolean} [parameters.isEnabled] Gets or sets a value indicating + * whether this schedule is enabled. + * + * @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 Schedule} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, automationAccountName, scheduleName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (scheduleName === null || scheduleName === undefined || typeof scheduleName.valueOf() !== 'string') { + throw new Error('scheduleName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{scheduleName}', encodeURIComponent(scheduleName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['ScheduleUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Schedule']().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); + }); +} + +/** + * Retrieve the schedule identified by schedule name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} scheduleName The schedule 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 Schedule} 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, automationAccountName, scheduleName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (scheduleName === null || scheduleName === undefined || typeof scheduleName.valueOf() !== 'string') { + throw new Error('scheduleName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{scheduleName}', encodeURIComponent(scheduleName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Schedule']().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); + }); +} + +/** + * Delete the schedule identified by schedule name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} scheduleName The schedule 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. + * + * {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, automationAccountName, scheduleName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (scheduleName === null || scheduleName === undefined || typeof scheduleName.valueOf() !== 'string') { + throw new Error('scheduleName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{scheduleName}', encodeURIComponent(scheduleName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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 !== 404) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Retrieve a list of schedules. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 ScheduleListResult} 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 _listByAutomationAccount(resourceGroupName, automationAccountName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ScheduleListResult']().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); + }); +} + +/** + * Retrieve a list of schedules. + * + * @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 ScheduleListResult} 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 _listByAutomationAccountNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ScheduleListResult']().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 ScheduleOperations. */ +class ScheduleOperations { + /** + * Create a ScheduleOperations. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._createOrUpdate = _createOrUpdate; + this._update = _update; + this._get = _get; + this._deleteMethod = _deleteMethod; + this._listByAutomationAccount = _listByAutomationAccount; + this._listByAutomationAccountNext = _listByAutomationAccountNext; + } + + /** + * Create a schedule. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} scheduleName The schedule name. + * + * @param {object} parameters The parameters supplied to the create or update + * schedule operation. + * + * @param {string} parameters.name Gets or sets the name of the schedule. + * + * @param {string} [parameters.description] Gets or sets the description of the + * schedule. + * + * @param {date} parameters.startTime Gets or sets the start time of the + * schedule. + * + * @param {date} [parameters.expiryTime] Gets or sets the end time of the + * schedule. + * + * @param {object} [parameters.interval] Gets or sets the interval of the + * schedule. + * + * @param {string} parameters.frequency Possible values include: 'OneTime', + * 'Day', 'Hour', 'Week', 'Month' + * + * @param {string} [parameters.timeZone] Gets or sets the time zone of the + * schedule. + * + * @param {object} [parameters.advancedSchedule] Gets or sets the + * AdvancedSchedule. + * + * @param {array} [parameters.advancedSchedule.weekDays] Days of the week that + * the job should execute on. + * + * @param {array} [parameters.advancedSchedule.monthDays] Days of the month + * that the job should execute on. Must be between 1 and 31. + * + * @param {array} [parameters.advancedSchedule.monthlyOccurrences] Occurrences + * of days within a month. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, automationAccountName, scheduleName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, automationAccountName, scheduleName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create a schedule. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} scheduleName The schedule name. + * + * @param {object} parameters The parameters supplied to the create or update + * schedule operation. + * + * @param {string} parameters.name Gets or sets the name of the schedule. + * + * @param {string} [parameters.description] Gets or sets the description of the + * schedule. + * + * @param {date} parameters.startTime Gets or sets the start time of the + * schedule. + * + * @param {date} [parameters.expiryTime] Gets or sets the end time of the + * schedule. + * + * @param {object} [parameters.interval] Gets or sets the interval of the + * schedule. + * + * @param {string} parameters.frequency Possible values include: 'OneTime', + * 'Day', 'Hour', 'Week', 'Month' + * + * @param {string} [parameters.timeZone] Gets or sets the time zone of the + * schedule. + * + * @param {object} [parameters.advancedSchedule] Gets or sets the + * AdvancedSchedule. + * + * @param {array} [parameters.advancedSchedule.weekDays] Days of the week that + * the job should execute on. + * + * @param {array} [parameters.advancedSchedule.monthDays] Days of the month + * that the job should execute on. Must be between 1 and 31. + * + * @param {array} [parameters.advancedSchedule.monthlyOccurrences] Occurrences + * of days within a month. + * + * @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 {Schedule} - 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 Schedule} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, automationAccountName, scheduleName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, automationAccountName, scheduleName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, automationAccountName, scheduleName, parameters, options, optionalCallback); + } + } + + /** + * Update the schedule identified by schedule name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} scheduleName The schedule name. + * + * @param {object} parameters The parameters supplied to the update schedule + * operation. + * + * @param {string} [parameters.name] Gets or sets the name of the schedule. + * + * @param {string} [parameters.description] Gets or sets the description of the + * schedule. + * + * @param {boolean} [parameters.isEnabled] Gets or sets a value indicating + * whether this schedule is enabled. + * + * @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. + */ + updateWithHttpOperationResponse(resourceGroupName, automationAccountName, scheduleName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, automationAccountName, scheduleName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Update the schedule identified by schedule name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} scheduleName The schedule name. + * + * @param {object} parameters The parameters supplied to the update schedule + * operation. + * + * @param {string} [parameters.name] Gets or sets the name of the schedule. + * + * @param {string} [parameters.description] Gets or sets the description of the + * schedule. + * + * @param {boolean} [parameters.isEnabled] Gets or sets a value indicating + * whether this schedule is enabled. + * + * @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 {Schedule} - 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 Schedule} 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. + */ + update(resourceGroupName, automationAccountName, scheduleName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, automationAccountName, scheduleName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, automationAccountName, scheduleName, parameters, options, optionalCallback); + } + } + + /** + * Retrieve the schedule identified by schedule name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} scheduleName The schedule 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. + */ + getWithHttpOperationResponse(resourceGroupName, automationAccountName, scheduleName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, automationAccountName, scheduleName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the schedule identified by schedule name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} scheduleName The schedule 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 {Schedule} - 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 Schedule} 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, automationAccountName, scheduleName, 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, automationAccountName, scheduleName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, automationAccountName, scheduleName, options, optionalCallback); + } + } + + /** + * Delete the schedule identified by schedule name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} scheduleName The schedule 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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, automationAccountName, scheduleName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, automationAccountName, scheduleName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete the schedule identified by schedule name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} scheduleName The schedule 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 {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, automationAccountName, scheduleName, 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, automationAccountName, scheduleName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, automationAccountName, scheduleName, options, optionalCallback); + } + } + + /** + * Retrieve a list of schedules. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName, automationAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of schedules. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 {ScheduleListResult} - 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 ScheduleListResult} 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. + */ + listByAutomationAccount(resourceGroupName, automationAccountName, 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._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccount(resourceGroupName, automationAccountName, options, optionalCallback); + } + } + + /** + * Retrieve a list of schedules. + * + * @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. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccountNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of schedules. + * + * @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 {ScheduleListResult} - 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 ScheduleListResult} 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. + */ + listByAutomationAccountNext(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._listByAutomationAccountNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccountNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = ScheduleOperations; diff --git a/lib/services/automationManagement/lib/lib/operations/softwareUpdateConfigurationMachineRuns.js b/lib/services/automationManagement/lib/lib/operations/softwareUpdateConfigurationMachineRuns.js new file mode 100644 index 0000000000..dd36c0ac40 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/operations/softwareUpdateConfigurationMachineRuns.js @@ -0,0 +1,619 @@ +/* + * 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; + +/** + * Get a single software update configuration machine run by Id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {uuid} softwareUpdateConfigurationMachineRunId The Id of the software + * update configuration machine run. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 SoftwareUpdateConfigurationMachineRun} 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 _getById(resourceGroupName, automationAccountName, softwareUpdateConfigurationMachineRunId, 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 clientRequestId = (options && options.clientRequestId !== undefined) ? options.clientRequestId : undefined; + let apiVersion = '2017-05-15-preview'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (softwareUpdateConfigurationMachineRunId === null || softwareUpdateConfigurationMachineRunId === undefined || typeof softwareUpdateConfigurationMachineRunId.valueOf() !== 'string' || !msRest.isValidUuid(softwareUpdateConfigurationMachineRunId)) { + throw new Error('softwareUpdateConfigurationMachineRunId cannot be null or undefined and it must be of type string and must be a valid uuid.'); + } + if (clientRequestId !== null && clientRequestId !== undefined && typeof clientRequestId.valueOf() !== 'string') { + throw new Error('clientRequestId 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.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurationMachineRuns/{softwareUpdateConfigurationMachineRunId}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{softwareUpdateConfigurationMachineRunId}', encodeURIComponent(softwareUpdateConfigurationMachineRunId.toString())); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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 (clientRequestId !== undefined && clientRequestId !== null) { + httpRequest.headers['clientRequestId'] = clientRequestId; + } + 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 !== 404) { + 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['SoftwareUpdateConfigurationMachineRun']().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); + }); +} + +/** + * Return list of software update configuration machine runs + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @param {string} [options.filter] The filter to apply on the operation. You + * can use the following filters: 'properties/osType', 'properties/status', + * 'properties/startTime', and 'properties/softwareUpdateConfiguration/name' + * + * @param {string} [options.skip] number of entries you skip before returning + * results + * + * @param {string} [options.top] Maximum number of entries returned in the + * results collection + * + * @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 + * SoftwareUpdateConfigurationMachineRunListResult} 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(resourceGroupName, automationAccountName, 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 clientRequestId = (options && options.clientRequestId !== undefined) ? options.clientRequestId : undefined; + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let skip = (options && options.skip !== undefined) ? options.skip : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let apiVersion = '2017-05-15-preview'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (clientRequestId !== null && clientRequestId !== undefined && typeof clientRequestId.valueOf() !== 'string') { + throw new Error('clientRequestId must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (skip !== null && skip !== undefined && typeof skip.valueOf() !== 'string') { + throw new Error('skip must be of type string.'); + } + if (top !== null && top !== undefined && typeof top.valueOf() !== 'string') { + throw new Error('top 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.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurationMachineRuns'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (skip !== null && skip !== undefined) { + queryParameters.push('$skip=' + encodeURIComponent(skip)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top)); + } + 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 (clientRequestId !== undefined && clientRequestId !== null) { + httpRequest.headers['clientRequestId'] = clientRequestId; + } + 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 !== 404) { + 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['SoftwareUpdateConfigurationMachineRunListResult']().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 SoftwareUpdateConfigurationMachineRuns. */ +class SoftwareUpdateConfigurationMachineRuns { + /** + * Create a SoftwareUpdateConfigurationMachineRuns. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._getById = _getById; + this._list = _list; + } + + /** + * Get a single software update configuration machine run by Id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {uuid} softwareUpdateConfigurationMachineRunId The Id of the software + * update configuration machine run. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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. + */ + getByIdWithHttpOperationResponse(resourceGroupName, automationAccountName, softwareUpdateConfigurationMachineRunId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getById(resourceGroupName, automationAccountName, softwareUpdateConfigurationMachineRunId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get a single software update configuration machine run by Id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {uuid} softwareUpdateConfigurationMachineRunId The Id of the software + * update configuration machine run. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 {SoftwareUpdateConfigurationMachineRun} - 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 SoftwareUpdateConfigurationMachineRun} 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. + */ + getById(resourceGroupName, automationAccountName, softwareUpdateConfigurationMachineRunId, 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._getById(resourceGroupName, automationAccountName, softwareUpdateConfigurationMachineRunId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getById(resourceGroupName, automationAccountName, softwareUpdateConfigurationMachineRunId, options, optionalCallback); + } + } + + /** + * Return list of software update configuration machine runs + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @param {string} [options.filter] The filter to apply on the operation. You + * can use the following filters: 'properties/osType', 'properties/status', + * 'properties/startTime', and 'properties/softwareUpdateConfiguration/name' + * + * @param {string} [options.skip] number of entries you skip before returning + * results + * + * @param {string} [options.top] Maximum number of entries returned in the + * results collection + * + * @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(resourceGroupName, automationAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Return list of software update configuration machine runs + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @param {string} [options.filter] The filter to apply on the operation. You + * can use the following filters: 'properties/osType', 'properties/status', + * 'properties/startTime', and 'properties/softwareUpdateConfiguration/name' + * + * @param {string} [options.skip] number of entries you skip before returning + * results + * + * @param {string} [options.top] Maximum number of entries returned in the + * results collection + * + * @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 {SoftwareUpdateConfigurationMachineRunListResult} - 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 + * SoftwareUpdateConfigurationMachineRunListResult} 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(resourceGroupName, automationAccountName, 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(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, automationAccountName, options, optionalCallback); + } + } + +} + +module.exports = SoftwareUpdateConfigurationMachineRuns; diff --git a/lib/services/automationManagement/lib/lib/operations/softwareUpdateConfigurationRuns.js b/lib/services/automationManagement/lib/lib/operations/softwareUpdateConfigurationRuns.js new file mode 100644 index 0000000000..825c7c999e --- /dev/null +++ b/lib/services/automationManagement/lib/lib/operations/softwareUpdateConfigurationRuns.js @@ -0,0 +1,617 @@ +/* + * 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; + +/** + * Get a single software update configuration Run by Id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {uuid} softwareUpdateConfigurationRunId The Id of the software update + * configuration run. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 SoftwareUpdateConfigurationRun} 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 _getById(resourceGroupName, automationAccountName, softwareUpdateConfigurationRunId, 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 clientRequestId = (options && options.clientRequestId !== undefined) ? options.clientRequestId : undefined; + let apiVersion = '2017-05-15-preview'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (softwareUpdateConfigurationRunId === null || softwareUpdateConfigurationRunId === undefined || typeof softwareUpdateConfigurationRunId.valueOf() !== 'string' || !msRest.isValidUuid(softwareUpdateConfigurationRunId)) { + throw new Error('softwareUpdateConfigurationRunId cannot be null or undefined and it must be of type string and must be a valid uuid.'); + } + if (clientRequestId !== null && clientRequestId !== undefined && typeof clientRequestId.valueOf() !== 'string') { + throw new Error('clientRequestId 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.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurationRuns/{softwareUpdateConfigurationRunId}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{softwareUpdateConfigurationRunId}', encodeURIComponent(softwareUpdateConfigurationRunId.toString())); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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 (clientRequestId !== undefined && clientRequestId !== null) { + httpRequest.headers['clientRequestId'] = clientRequestId; + } + 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 !== 404) { + 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['SoftwareUpdateConfigurationRun']().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); + }); +} + +/** + * Return list of software update configuration runs + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @param {string} [options.filter] The filter to apply on the operation. You + * can use the following filters: 'properties/osType', 'properties/status', + * 'properties/startTime', and 'properties/softwareUpdateConfiguration/name' + * + * @param {string} [options.skip] number of entries you skip before returning + * results + * + * @param {string} [options.top] Maximum number of entries returned in the + * results collection + * + * @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 SoftwareUpdateConfigurationRunListResult} + * 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(resourceGroupName, automationAccountName, 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 clientRequestId = (options && options.clientRequestId !== undefined) ? options.clientRequestId : undefined; + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let skip = (options && options.skip !== undefined) ? options.skip : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let apiVersion = '2017-05-15-preview'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (clientRequestId !== null && clientRequestId !== undefined && typeof clientRequestId.valueOf() !== 'string') { + throw new Error('clientRequestId must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (skip !== null && skip !== undefined && typeof skip.valueOf() !== 'string') { + throw new Error('skip must be of type string.'); + } + if (top !== null && top !== undefined && typeof top.valueOf() !== 'string') { + throw new Error('top 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.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurationRuns'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (skip !== null && skip !== undefined) { + queryParameters.push('$skip=' + encodeURIComponent(skip)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top)); + } + 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 (clientRequestId !== undefined && clientRequestId !== null) { + httpRequest.headers['clientRequestId'] = clientRequestId; + } + 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 !== 404) { + 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['SoftwareUpdateConfigurationRunListResult']().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 SoftwareUpdateConfigurationRuns. */ +class SoftwareUpdateConfigurationRuns { + /** + * Create a SoftwareUpdateConfigurationRuns. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._getById = _getById; + this._list = _list; + } + + /** + * Get a single software update configuration Run by Id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {uuid} softwareUpdateConfigurationRunId The Id of the software update + * configuration run. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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. + */ + getByIdWithHttpOperationResponse(resourceGroupName, automationAccountName, softwareUpdateConfigurationRunId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getById(resourceGroupName, automationAccountName, softwareUpdateConfigurationRunId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get a single software update configuration Run by Id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {uuid} softwareUpdateConfigurationRunId The Id of the software update + * configuration run. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 {SoftwareUpdateConfigurationRun} - 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 SoftwareUpdateConfigurationRun} 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. + */ + getById(resourceGroupName, automationAccountName, softwareUpdateConfigurationRunId, 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._getById(resourceGroupName, automationAccountName, softwareUpdateConfigurationRunId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getById(resourceGroupName, automationAccountName, softwareUpdateConfigurationRunId, options, optionalCallback); + } + } + + /** + * Return list of software update configuration runs + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @param {string} [options.filter] The filter to apply on the operation. You + * can use the following filters: 'properties/osType', 'properties/status', + * 'properties/startTime', and 'properties/softwareUpdateConfiguration/name' + * + * @param {string} [options.skip] number of entries you skip before returning + * results + * + * @param {string} [options.top] Maximum number of entries returned in the + * results collection + * + * @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(resourceGroupName, automationAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Return list of software update configuration runs + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @param {string} [options.filter] The filter to apply on the operation. You + * can use the following filters: 'properties/osType', 'properties/status', + * 'properties/startTime', and 'properties/softwareUpdateConfiguration/name' + * + * @param {string} [options.skip] number of entries you skip before returning + * results + * + * @param {string} [options.top] Maximum number of entries returned in the + * results collection + * + * @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 {SoftwareUpdateConfigurationRunListResult} - 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 SoftwareUpdateConfigurationRunListResult} + * 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(resourceGroupName, automationAccountName, 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(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, automationAccountName, options, optionalCallback); + } + } + +} + +module.exports = SoftwareUpdateConfigurationRuns; diff --git a/lib/services/automationManagement/lib/lib/operations/softwareUpdateConfigurations.js b/lib/services/automationManagement/lib/lib/operations/softwareUpdateConfigurations.js new file mode 100644 index 0000000000..a23fd6b9da --- /dev/null +++ b/lib/services/automationManagement/lib/lib/operations/softwareUpdateConfigurations.js @@ -0,0 +1,1454 @@ +/* + * 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; + +/** + * Create a new software update configuration with the name given in the URI. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} softwareUpdateConfigurationName The name of the software + * update configuration to be created. + * + * @param {object} parameters Request body. + * + * @param {object} parameters.updateConfiguration update specific properties + * for the Software update configuration + * + * @param {string} parameters.updateConfiguration.operatingSystem operating + * system of target machines. Possible values include: 'Windows', 'Linux' + * + * @param {object} [parameters.updateConfiguration.windows] Windows specific + * update configuration. + * + * @param {string} + * [parameters.updateConfiguration.windows.includedUpdateClassifications] + * Update classification included in the software update configuration. A comma + * separated string with required values. Possible values include: + * 'Unclassified', 'Critical', 'Security', 'UpdateRollup', 'FeaturePack', + * 'ServicePack', 'Definition', 'Tools', 'Updates' + * + * @param {array} [parameters.updateConfiguration.windows.excludedKbNumbers] KB + * numbers excluded from the software update configuration. + * + * @param {object} [parameters.updateConfiguration.linux] Linux specific update + * configuration. + * + * @param {string} + * [parameters.updateConfiguration.linux.includedPackageClassifications] Update + * classifications included in the software update configuration. Possible + * values include: 'Unclassified', 'Critical', 'Security', 'Other' + * + * @param {array} + * [parameters.updateConfiguration.linux.excludedPackageNameMasks] packages + * excluded from the software update configuration. + * + * @param {moment.duration} [parameters.updateConfiguration.duration] Maximum + * time allowed for the software update configuration run. Duration needs to be + * specified using the format PT[n]H[n]M[n]S as per ISO8601 + * + * @param {array} [parameters.updateConfiguration.azureVirtualMachines] List of + * azure resource Ids for azure virtual machines targeted by the software + * update configuration. + * + * @param {array} [parameters.updateConfiguration.nonAzureComputerNames] List + * of names of non-azure machines targeted by the software update + * configuration. + * + * @param {object} parameters.scheduleInfo Schedule information for the + * Software update configuration + * + * @param {date} [parameters.scheduleInfo.startTime] Gets or sets the start + * time of the schedule. + * + * @param {date} [parameters.scheduleInfo.expiryTime] Gets or sets the end time + * of the schedule. + * + * @param {number} [parameters.scheduleInfo.expiryTimeOffsetMinutes] Gets or + * sets the expiry time's offset in minutes. + * + * @param {boolean} [parameters.scheduleInfo.isEnabled] Gets or sets a value + * indicating whether this schedule is enabled. + * + * @param {date} [parameters.scheduleInfo.nextRun] Gets or sets the next run + * time of the schedule. + * + * @param {number} [parameters.scheduleInfo.nextRunOffsetMinutes] Gets or sets + * the next run time's offset in minutes. + * + * @param {number} [parameters.scheduleInfo.interval] Gets or sets the interval + * of the schedule. + * + * @param {string} [parameters.scheduleInfo.frequency] Gets or sets the + * frequency of the schedule. Possible values include: 'OneTime', 'Day', + * 'Hour', 'Week', 'Month' + * + * @param {string} [parameters.scheduleInfo.timeZone] Gets or sets the time + * zone of the schedule. + * + * @param {object} [parameters.scheduleInfo.advancedSchedule] Gets or sets the + * advanced schedule. + * + * @param {array} [parameters.scheduleInfo.advancedSchedule.weekDays] Days of + * the week that the job should execute on. + * + * @param {array} [parameters.scheduleInfo.advancedSchedule.monthDays] Days of + * the month that the job should execute on. Must be between 1 and 31. + * + * @param {array} [parameters.scheduleInfo.advancedSchedule.monthlyOccurrences] + * Occurrences of days within a month. + * + * @param {date} [parameters.scheduleInfo.creationTime] Gets or sets the + * creation time. + * + * @param {date} [parameters.scheduleInfo.lastModifiedTime] Gets or sets the + * last modified time. + * + * @param {string} [parameters.scheduleInfo.description] Gets or sets the + * description. + * + * @param {object} [parameters.error] detailes of provisioning error + * + * @param {string} [parameters.error.code] Error code + * + * @param {string} [parameters.error.message] Error message indicating why the + * operation failed. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 SoftwareUpdateConfiguration} 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, automationAccountName, softwareUpdateConfigurationName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let clientRequestId = (options && options.clientRequestId !== undefined) ? options.clientRequestId : undefined; + let apiVersion = '2017-05-15-preview'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (softwareUpdateConfigurationName === null || softwareUpdateConfigurationName === undefined || typeof softwareUpdateConfigurationName.valueOf() !== 'string') { + throw new Error('softwareUpdateConfigurationName cannot be null or undefined and it must be of type string.'); + } + if (clientRequestId !== null && clientRequestId !== undefined && typeof clientRequestId.valueOf() !== 'string') { + throw new Error('clientRequestId must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters 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.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations/{softwareUpdateConfigurationName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{softwareUpdateConfigurationName}', encodeURIComponent(softwareUpdateConfigurationName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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 (clientRequestId !== undefined && clientRequestId !== null) { + httpRequest.headers['clientRequestId'] = clientRequestId; + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['SoftwareUpdateConfiguration']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201 && statusCode !== 400 && statusCode !== 404 && statusCode !== 409) { + 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['SoftwareUpdateConfiguration']().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['SoftwareUpdateConfiguration']().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); + }); +} + +/** + * Get a single software update configuration by name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} softwareUpdateConfigurationName The name of the software + * update configuration to be created. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 SoftwareUpdateConfiguration} 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 _getByName(resourceGroupName, automationAccountName, softwareUpdateConfigurationName, 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 clientRequestId = (options && options.clientRequestId !== undefined) ? options.clientRequestId : undefined; + let apiVersion = '2017-05-15-preview'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (softwareUpdateConfigurationName === null || softwareUpdateConfigurationName === undefined || typeof softwareUpdateConfigurationName.valueOf() !== 'string') { + throw new Error('softwareUpdateConfigurationName cannot be null or undefined and it must be of type string.'); + } + if (clientRequestId !== null && clientRequestId !== undefined && typeof clientRequestId.valueOf() !== 'string') { + throw new Error('clientRequestId 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.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations/{softwareUpdateConfigurationName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{softwareUpdateConfigurationName}', encodeURIComponent(softwareUpdateConfigurationName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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 (clientRequestId !== undefined && clientRequestId !== null) { + httpRequest.headers['clientRequestId'] = clientRequestId; + } + 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 !== 404) { + 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['SoftwareUpdateConfiguration']().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); + }); +} + +/** + * delete a specific software update configuration. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} softwareUpdateConfigurationName The name of the software + * update configuration to be created. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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, automationAccountName, softwareUpdateConfigurationName, 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 clientRequestId = (options && options.clientRequestId !== undefined) ? options.clientRequestId : undefined; + let apiVersion = '2017-05-15-preview'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (softwareUpdateConfigurationName === null || softwareUpdateConfigurationName === undefined || typeof softwareUpdateConfigurationName.valueOf() !== 'string') { + throw new Error('softwareUpdateConfigurationName cannot be null or undefined and it must be of type string.'); + } + if (clientRequestId !== null && clientRequestId !== undefined && typeof clientRequestId.valueOf() !== 'string') { + throw new Error('clientRequestId 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.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations/{softwareUpdateConfigurationName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{softwareUpdateConfigurationName}', encodeURIComponent(softwareUpdateConfigurationName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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 (clientRequestId !== undefined && clientRequestId !== null) { + httpRequest.headers['clientRequestId'] = clientRequestId; + } + 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 && statusCode !== 404) { + 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; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Get all software update configurations for the account. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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 SoftwareUpdateConfigurationListResult} 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(resourceGroupName, automationAccountName, 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 clientRequestId = (options && options.clientRequestId !== undefined) ? options.clientRequestId : undefined; + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let apiVersion = '2017-05-15-preview'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (clientRequestId !== null && clientRequestId !== undefined && typeof clientRequestId.valueOf() !== 'string') { + throw new Error('clientRequestId must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter 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.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + 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 (clientRequestId !== undefined && clientRequestId !== null) { + httpRequest.headers['clientRequestId'] = clientRequestId; + } + 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 !== 404) { + 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['SoftwareUpdateConfigurationListResult']().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 SoftwareUpdateConfigurations. */ +class SoftwareUpdateConfigurations { + /** + * Create a SoftwareUpdateConfigurations. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._create = _create; + this._getByName = _getByName; + this._deleteMethod = _deleteMethod; + this._list = _list; + } + + /** + * Create a new software update configuration with the name given in the URI. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} softwareUpdateConfigurationName The name of the software + * update configuration to be created. + * + * @param {object} parameters Request body. + * + * @param {object} parameters.updateConfiguration update specific properties + * for the Software update configuration + * + * @param {string} parameters.updateConfiguration.operatingSystem operating + * system of target machines. Possible values include: 'Windows', 'Linux' + * + * @param {object} [parameters.updateConfiguration.windows] Windows specific + * update configuration. + * + * @param {string} + * [parameters.updateConfiguration.windows.includedUpdateClassifications] + * Update classification included in the software update configuration. A comma + * separated string with required values. Possible values include: + * 'Unclassified', 'Critical', 'Security', 'UpdateRollup', 'FeaturePack', + * 'ServicePack', 'Definition', 'Tools', 'Updates' + * + * @param {array} [parameters.updateConfiguration.windows.excludedKbNumbers] KB + * numbers excluded from the software update configuration. + * + * @param {object} [parameters.updateConfiguration.linux] Linux specific update + * configuration. + * + * @param {string} + * [parameters.updateConfiguration.linux.includedPackageClassifications] Update + * classifications included in the software update configuration. Possible + * values include: 'Unclassified', 'Critical', 'Security', 'Other' + * + * @param {array} + * [parameters.updateConfiguration.linux.excludedPackageNameMasks] packages + * excluded from the software update configuration. + * + * @param {moment.duration} [parameters.updateConfiguration.duration] Maximum + * time allowed for the software update configuration run. Duration needs to be + * specified using the format PT[n]H[n]M[n]S as per ISO8601 + * + * @param {array} [parameters.updateConfiguration.azureVirtualMachines] List of + * azure resource Ids for azure virtual machines targeted by the software + * update configuration. + * + * @param {array} [parameters.updateConfiguration.nonAzureComputerNames] List + * of names of non-azure machines targeted by the software update + * configuration. + * + * @param {object} parameters.scheduleInfo Schedule information for the + * Software update configuration + * + * @param {date} [parameters.scheduleInfo.startTime] Gets or sets the start + * time of the schedule. + * + * @param {date} [parameters.scheduleInfo.expiryTime] Gets or sets the end time + * of the schedule. + * + * @param {number} [parameters.scheduleInfo.expiryTimeOffsetMinutes] Gets or + * sets the expiry time's offset in minutes. + * + * @param {boolean} [parameters.scheduleInfo.isEnabled] Gets or sets a value + * indicating whether this schedule is enabled. + * + * @param {date} [parameters.scheduleInfo.nextRun] Gets or sets the next run + * time of the schedule. + * + * @param {number} [parameters.scheduleInfo.nextRunOffsetMinutes] Gets or sets + * the next run time's offset in minutes. + * + * @param {number} [parameters.scheduleInfo.interval] Gets or sets the interval + * of the schedule. + * + * @param {string} [parameters.scheduleInfo.frequency] Gets or sets the + * frequency of the schedule. Possible values include: 'OneTime', 'Day', + * 'Hour', 'Week', 'Month' + * + * @param {string} [parameters.scheduleInfo.timeZone] Gets or sets the time + * zone of the schedule. + * + * @param {object} [parameters.scheduleInfo.advancedSchedule] Gets or sets the + * advanced schedule. + * + * @param {array} [parameters.scheduleInfo.advancedSchedule.weekDays] Days of + * the week that the job should execute on. + * + * @param {array} [parameters.scheduleInfo.advancedSchedule.monthDays] Days of + * the month that the job should execute on. Must be between 1 and 31. + * + * @param {array} [parameters.scheduleInfo.advancedSchedule.monthlyOccurrences] + * Occurrences of days within a month. + * + * @param {date} [parameters.scheduleInfo.creationTime] Gets or sets the + * creation time. + * + * @param {date} [parameters.scheduleInfo.lastModifiedTime] Gets or sets the + * last modified time. + * + * @param {string} [parameters.scheduleInfo.description] Gets or sets the + * description. + * + * @param {object} [parameters.error] detailes of provisioning error + * + * @param {string} [parameters.error.code] Error code + * + * @param {string} [parameters.error.message] Error message indicating why the + * operation failed. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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, automationAccountName, softwareUpdateConfigurationName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._create(resourceGroupName, automationAccountName, softwareUpdateConfigurationName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create a new software update configuration with the name given in the URI. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} softwareUpdateConfigurationName The name of the software + * update configuration to be created. + * + * @param {object} parameters Request body. + * + * @param {object} parameters.updateConfiguration update specific properties + * for the Software update configuration + * + * @param {string} parameters.updateConfiguration.operatingSystem operating + * system of target machines. Possible values include: 'Windows', 'Linux' + * + * @param {object} [parameters.updateConfiguration.windows] Windows specific + * update configuration. + * + * @param {string} + * [parameters.updateConfiguration.windows.includedUpdateClassifications] + * Update classification included in the software update configuration. A comma + * separated string with required values. Possible values include: + * 'Unclassified', 'Critical', 'Security', 'UpdateRollup', 'FeaturePack', + * 'ServicePack', 'Definition', 'Tools', 'Updates' + * + * @param {array} [parameters.updateConfiguration.windows.excludedKbNumbers] KB + * numbers excluded from the software update configuration. + * + * @param {object} [parameters.updateConfiguration.linux] Linux specific update + * configuration. + * + * @param {string} + * [parameters.updateConfiguration.linux.includedPackageClassifications] Update + * classifications included in the software update configuration. Possible + * values include: 'Unclassified', 'Critical', 'Security', 'Other' + * + * @param {array} + * [parameters.updateConfiguration.linux.excludedPackageNameMasks] packages + * excluded from the software update configuration. + * + * @param {moment.duration} [parameters.updateConfiguration.duration] Maximum + * time allowed for the software update configuration run. Duration needs to be + * specified using the format PT[n]H[n]M[n]S as per ISO8601 + * + * @param {array} [parameters.updateConfiguration.azureVirtualMachines] List of + * azure resource Ids for azure virtual machines targeted by the software + * update configuration. + * + * @param {array} [parameters.updateConfiguration.nonAzureComputerNames] List + * of names of non-azure machines targeted by the software update + * configuration. + * + * @param {object} parameters.scheduleInfo Schedule information for the + * Software update configuration + * + * @param {date} [parameters.scheduleInfo.startTime] Gets or sets the start + * time of the schedule. + * + * @param {date} [parameters.scheduleInfo.expiryTime] Gets or sets the end time + * of the schedule. + * + * @param {number} [parameters.scheduleInfo.expiryTimeOffsetMinutes] Gets or + * sets the expiry time's offset in minutes. + * + * @param {boolean} [parameters.scheduleInfo.isEnabled] Gets or sets a value + * indicating whether this schedule is enabled. + * + * @param {date} [parameters.scheduleInfo.nextRun] Gets or sets the next run + * time of the schedule. + * + * @param {number} [parameters.scheduleInfo.nextRunOffsetMinutes] Gets or sets + * the next run time's offset in minutes. + * + * @param {number} [parameters.scheduleInfo.interval] Gets or sets the interval + * of the schedule. + * + * @param {string} [parameters.scheduleInfo.frequency] Gets or sets the + * frequency of the schedule. Possible values include: 'OneTime', 'Day', + * 'Hour', 'Week', 'Month' + * + * @param {string} [parameters.scheduleInfo.timeZone] Gets or sets the time + * zone of the schedule. + * + * @param {object} [parameters.scheduleInfo.advancedSchedule] Gets or sets the + * advanced schedule. + * + * @param {array} [parameters.scheduleInfo.advancedSchedule.weekDays] Days of + * the week that the job should execute on. + * + * @param {array} [parameters.scheduleInfo.advancedSchedule.monthDays] Days of + * the month that the job should execute on. Must be between 1 and 31. + * + * @param {array} [parameters.scheduleInfo.advancedSchedule.monthlyOccurrences] + * Occurrences of days within a month. + * + * @param {date} [parameters.scheduleInfo.creationTime] Gets or sets the + * creation time. + * + * @param {date} [parameters.scheduleInfo.lastModifiedTime] Gets or sets the + * last modified time. + * + * @param {string} [parameters.scheduleInfo.description] Gets or sets the + * description. + * + * @param {object} [parameters.error] detailes of provisioning error + * + * @param {string} [parameters.error.code] Error code + * + * @param {string} [parameters.error.message] Error message indicating why the + * operation failed. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 {SoftwareUpdateConfiguration} - 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 SoftwareUpdateConfiguration} 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, automationAccountName, softwareUpdateConfigurationName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._create(resourceGroupName, automationAccountName, softwareUpdateConfigurationName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(resourceGroupName, automationAccountName, softwareUpdateConfigurationName, parameters, options, optionalCallback); + } + } + + /** + * Get a single software update configuration by name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} softwareUpdateConfigurationName The name of the software + * update configuration to be created. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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. + */ + getByNameWithHttpOperationResponse(resourceGroupName, automationAccountName, softwareUpdateConfigurationName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getByName(resourceGroupName, automationAccountName, softwareUpdateConfigurationName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get a single software update configuration by name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} softwareUpdateConfigurationName The name of the software + * update configuration to be created. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 {SoftwareUpdateConfiguration} - 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 SoftwareUpdateConfiguration} 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. + */ + getByName(resourceGroupName, automationAccountName, softwareUpdateConfigurationName, 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._getByName(resourceGroupName, automationAccountName, softwareUpdateConfigurationName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getByName(resourceGroupName, automationAccountName, softwareUpdateConfigurationName, options, optionalCallback); + } + } + + /** + * delete a specific software update configuration. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} softwareUpdateConfigurationName The name of the software + * update configuration to be created. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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, automationAccountName, softwareUpdateConfigurationName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, automationAccountName, softwareUpdateConfigurationName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * delete a specific software update configuration. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} softwareUpdateConfigurationName The name of the software + * update configuration to be created. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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, automationAccountName, softwareUpdateConfigurationName, 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, automationAccountName, softwareUpdateConfigurationName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, automationAccountName, softwareUpdateConfigurationName, options, optionalCallback); + } + } + + /** + * Get all software update configurations for the account. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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(resourceGroupName, automationAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get all software update configurations for the account. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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 {SoftwareUpdateConfigurationListResult} - 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 SoftwareUpdateConfigurationListResult} 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(resourceGroupName, automationAccountName, 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(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, automationAccountName, options, optionalCallback); + } + } + +} + +module.exports = SoftwareUpdateConfigurations; diff --git a/lib/services/automationManagement/lib/lib/operations/sourceControlOperations.js b/lib/services/automationManagement/lib/lib/operations/sourceControlOperations.js new file mode 100644 index 0000000000..8e34846c2e --- /dev/null +++ b/lib/services/automationManagement/lib/lib/operations/sourceControlOperations.js @@ -0,0 +1,1703 @@ +/* + * 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; + +/** + * Create a source control. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {object} parameters The parameters supplied to the create or update + * source control operation. + * + * @param {string} [parameters.repoUrl] Gets or sets the repo url of the source + * control. + * + * @param {string} [parameters.branch] Gets or sets the repo branch of the + * source control. Include branch as empty string for VsoTfvc. + * + * @param {string} [parameters.folderPath] Gets or sets the folder path of the + * source control. Path must be relative. + * + * @param {boolean} [parameters.autoSync] Gets or sets auto async of the source + * control. Default is false. + * + * @param {boolean} [parameters.publishRunbook] Gets or sets the auto publish + * of the source control. Default is true. + * + * @param {string} [parameters.sourceType] The source type. Must be one of + * VsoGit, VsoTfvc, GitHub, case sensitive. Possible values include: 'VsoGit', + * 'VsoTfvc', 'GitHub' + * + * @param {string} [parameters.securityToken] Gets or sets the authorization + * token for the repo of the source control. + * + * @param {string} [parameters.description] Gets or sets the user description + * of the source control. + * + * @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 SourceControl} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, automationAccountName, sourceControlName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2017-05-15-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (sourceControlName === null || sourceControlName === undefined || typeof sourceControlName.valueOf() !== 'string') { + throw new Error('sourceControlName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{sourceControlName}', encodeURIComponent(sourceControlName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['SourceControlCreateOrUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['SourceControl']().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['SourceControl']().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); + }); +} + +/** + * Update a source control. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {object} parameters The parameters supplied to the update source + * control operation. + * + * @param {string} [parameters.branch] Gets or sets the repo branch of the + * source control. + * + * @param {string} [parameters.folderPath] Gets or sets the folder path of the + * source control. Path must be relative. + * + * @param {boolean} [parameters.autoSync] Gets or sets auto async of the source + * control. Default is false. + * + * @param {boolean} [parameters.publishRunbook] Gets or sets the auto publish + * of the source control. Default is true. + * + * @param {string} [parameters.securityToken] Gets or sets the authorization + * token for the repo of the source control. + * + * @param {string} [parameters.description] Gets or sets the user description + * of the source control. + * + * @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 SourceControl} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, automationAccountName, sourceControlName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2017-05-15-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (sourceControlName === null || sourceControlName === undefined || typeof sourceControlName.valueOf() !== 'string') { + throw new Error('sourceControlName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{sourceControlName}', encodeURIComponent(sourceControlName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['SourceControlUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['SourceControl']().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); + }); +} + +/** + * Delete the source control. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The name of source control. + * + * @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, automationAccountName, sourceControlName, 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 apiVersion = '2017-05-15-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (sourceControlName === null || sourceControlName === undefined || typeof sourceControlName.valueOf() !== 'string') { + throw new Error('sourceControlName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{sourceControlName}', encodeURIComponent(sourceControlName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Retrieve the source control identified by source control name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The name of source control. + * + * @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 SourceControl} 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, automationAccountName, sourceControlName, 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 apiVersion = '2017-05-15-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (sourceControlName === null || sourceControlName === undefined || typeof sourceControlName.valueOf() !== 'string') { + throw new Error('sourceControlName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{sourceControlName}', encodeURIComponent(sourceControlName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['SourceControl']().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); + }); +} + +/** + * Retrieve a list of source controls. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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 SourceControlListResult} 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 _listByAutomationAccount(resourceGroupName, automationAccountName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let apiVersion = '2017-05-15-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['SourceControlListResult']().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); + }); +} + +/** + * Retrieve a list of source controls. + * + * @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 SourceControlListResult} 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 _listByAutomationAccountNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['SourceControlListResult']().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 SourceControlOperations. */ +class SourceControlOperations { + /** + * Create a SourceControlOperations. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._createOrUpdate = _createOrUpdate; + this._update = _update; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._listByAutomationAccount = _listByAutomationAccount; + this._listByAutomationAccountNext = _listByAutomationAccountNext; + } + + /** + * Create a source control. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {object} parameters The parameters supplied to the create or update + * source control operation. + * + * @param {string} [parameters.repoUrl] Gets or sets the repo url of the source + * control. + * + * @param {string} [parameters.branch] Gets or sets the repo branch of the + * source control. Include branch as empty string for VsoTfvc. + * + * @param {string} [parameters.folderPath] Gets or sets the folder path of the + * source control. Path must be relative. + * + * @param {boolean} [parameters.autoSync] Gets or sets auto async of the source + * control. Default is false. + * + * @param {boolean} [parameters.publishRunbook] Gets or sets the auto publish + * of the source control. Default is true. + * + * @param {string} [parameters.sourceType] The source type. Must be one of + * VsoGit, VsoTfvc, GitHub, case sensitive. Possible values include: 'VsoGit', + * 'VsoTfvc', 'GitHub' + * + * @param {string} [parameters.securityToken] Gets or sets the authorization + * token for the repo of the source control. + * + * @param {string} [parameters.description] Gets or sets the user description + * of the source control. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, automationAccountName, sourceControlName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, automationAccountName, sourceControlName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create a source control. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {object} parameters The parameters supplied to the create or update + * source control operation. + * + * @param {string} [parameters.repoUrl] Gets or sets the repo url of the source + * control. + * + * @param {string} [parameters.branch] Gets or sets the repo branch of the + * source control. Include branch as empty string for VsoTfvc. + * + * @param {string} [parameters.folderPath] Gets or sets the folder path of the + * source control. Path must be relative. + * + * @param {boolean} [parameters.autoSync] Gets or sets auto async of the source + * control. Default is false. + * + * @param {boolean} [parameters.publishRunbook] Gets or sets the auto publish + * of the source control. Default is true. + * + * @param {string} [parameters.sourceType] The source type. Must be one of + * VsoGit, VsoTfvc, GitHub, case sensitive. Possible values include: 'VsoGit', + * 'VsoTfvc', 'GitHub' + * + * @param {string} [parameters.securityToken] Gets or sets the authorization + * token for the repo of the source control. + * + * @param {string} [parameters.description] Gets or sets the user description + * of the source control. + * + * @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 {SourceControl} - 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 SourceControl} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, automationAccountName, sourceControlName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, automationAccountName, sourceControlName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, automationAccountName, sourceControlName, parameters, options, optionalCallback); + } + } + + /** + * Update a source control. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {object} parameters The parameters supplied to the update source + * control operation. + * + * @param {string} [parameters.branch] Gets or sets the repo branch of the + * source control. + * + * @param {string} [parameters.folderPath] Gets or sets the folder path of the + * source control. Path must be relative. + * + * @param {boolean} [parameters.autoSync] Gets or sets auto async of the source + * control. Default is false. + * + * @param {boolean} [parameters.publishRunbook] Gets or sets the auto publish + * of the source control. Default is true. + * + * @param {string} [parameters.securityToken] Gets or sets the authorization + * token for the repo of the source control. + * + * @param {string} [parameters.description] Gets or sets the user description + * of the source control. + * + * @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. + */ + updateWithHttpOperationResponse(resourceGroupName, automationAccountName, sourceControlName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, automationAccountName, sourceControlName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Update a source control. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {object} parameters The parameters supplied to the update source + * control operation. + * + * @param {string} [parameters.branch] Gets or sets the repo branch of the + * source control. + * + * @param {string} [parameters.folderPath] Gets or sets the folder path of the + * source control. Path must be relative. + * + * @param {boolean} [parameters.autoSync] Gets or sets auto async of the source + * control. Default is false. + * + * @param {boolean} [parameters.publishRunbook] Gets or sets the auto publish + * of the source control. Default is true. + * + * @param {string} [parameters.securityToken] Gets or sets the authorization + * token for the repo of the source control. + * + * @param {string} [parameters.description] Gets or sets the user description + * of the source control. + * + * @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 {SourceControl} - 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 SourceControl} 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. + */ + update(resourceGroupName, automationAccountName, sourceControlName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, automationAccountName, sourceControlName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, automationAccountName, sourceControlName, parameters, options, optionalCallback); + } + } + + /** + * Delete the source control. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The name of source control. + * + * @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, automationAccountName, sourceControlName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, automationAccountName, sourceControlName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete the source control. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The name of source control. + * + * @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, automationAccountName, sourceControlName, 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, automationAccountName, sourceControlName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, automationAccountName, sourceControlName, options, optionalCallback); + } + } + + /** + * Retrieve the source control identified by source control name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The name of source control. + * + * @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, automationAccountName, sourceControlName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, automationAccountName, sourceControlName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the source control identified by source control name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The name of source control. + * + * @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 {SourceControl} - 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 SourceControl} 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, automationAccountName, sourceControlName, 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, automationAccountName, sourceControlName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, automationAccountName, sourceControlName, options, optionalCallback); + } + } + + /** + * Retrieve a list of source controls. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName, automationAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of source controls. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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 {SourceControlListResult} - 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 SourceControlListResult} 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. + */ + listByAutomationAccount(resourceGroupName, automationAccountName, 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._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccount(resourceGroupName, automationAccountName, options, optionalCallback); + } + } + + /** + * Retrieve a list of source controls. + * + * @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. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccountNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of source controls. + * + * @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 {SourceControlListResult} - 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 SourceControlListResult} 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. + */ + listByAutomationAccountNext(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._listByAutomationAccountNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccountNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = SourceControlOperations; diff --git a/lib/services/automationManagement/lib/lib/operations/sourceControlSyncJobOperations.js b/lib/services/automationManagement/lib/lib/operations/sourceControlSyncJobOperations.js new file mode 100644 index 0000000000..a3c6ac5ef3 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/operations/sourceControlSyncJobOperations.js @@ -0,0 +1,1046 @@ +/* + * 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; + +/** + * Creates the sync job for a source control. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {uuid} sourceControlSyncJobId The source control sync job id. + * + * @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 SourceControlSyncJob} 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, automationAccountName, sourceControlName, sourceControlSyncJobId, 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 apiVersion = '2017-05-15-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (sourceControlName === null || sourceControlName === undefined || typeof sourceControlName.valueOf() !== 'string') { + throw new Error('sourceControlName cannot be null or undefined and it must be of type string.'); + } + if (sourceControlSyncJobId === null || sourceControlSyncJobId === undefined || typeof sourceControlSyncJobId.valueOf() !== 'string' || !msRest.isValidUuid(sourceControlSyncJobId)) { + throw new Error('sourceControlSyncJobId cannot be null or undefined and it must be of type string and must be a valid uuid.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs/{sourceControlSyncJobId}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{sourceControlName}', encodeURIComponent(sourceControlName)); + requestUrl = requestUrl.replace('{sourceControlSyncJobId}', encodeURIComponent(sourceControlSyncJobId.toString())); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['SourceControlSyncJob']().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); + }); +} + +/** + * Retrieve the source control sync job identified by job id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {uuid} sourceControlSyncJobId The source control sync job id. + * + * @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 SourceControlSyncJobById} 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, automationAccountName, sourceControlName, sourceControlSyncJobId, 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 apiVersion = '2017-05-15-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (sourceControlName === null || sourceControlName === undefined || typeof sourceControlName.valueOf() !== 'string') { + throw new Error('sourceControlName cannot be null or undefined and it must be of type string.'); + } + if (sourceControlSyncJobId === null || sourceControlSyncJobId === undefined || typeof sourceControlSyncJobId.valueOf() !== 'string' || !msRest.isValidUuid(sourceControlSyncJobId)) { + throw new Error('sourceControlSyncJobId cannot be null or undefined and it must be of type string and must be a valid uuid.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs/{sourceControlSyncJobId}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{sourceControlName}', encodeURIComponent(sourceControlName)); + requestUrl = requestUrl.replace('{sourceControlSyncJobId}', encodeURIComponent(sourceControlSyncJobId.toString())); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['SourceControlSyncJobById']().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); + }); +} + +/** + * Retrieve a list of source control sync jobs. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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 SourceControlSyncJobListResult} 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 _listByAutomationAccount(resourceGroupName, automationAccountName, sourceControlName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let apiVersion = '2017-05-15-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (sourceControlName === null || sourceControlName === undefined || typeof sourceControlName.valueOf() !== 'string') { + throw new Error('sourceControlName cannot be null or undefined and it must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{sourceControlName}', encodeURIComponent(sourceControlName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['SourceControlSyncJobListResult']().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); + }); +} + +/** + * Retrieve a list of source control sync jobs. + * + * @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 SourceControlSyncJobListResult} 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 _listByAutomationAccountNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['SourceControlSyncJobListResult']().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 SourceControlSyncJobOperations. */ +class SourceControlSyncJobOperations { + /** + * Create a SourceControlSyncJobOperations. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._create = _create; + this._get = _get; + this._listByAutomationAccount = _listByAutomationAccount; + this._listByAutomationAccountNext = _listByAutomationAccountNext; + } + + /** + * Creates the sync job for a source control. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {uuid} sourceControlSyncJobId The source control sync job id. + * + * @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, automationAccountName, sourceControlName, sourceControlSyncJobId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._create(resourceGroupName, automationAccountName, sourceControlName, sourceControlSyncJobId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates the sync job for a source control. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {uuid} sourceControlSyncJobId The source control sync job id. + * + * @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 {SourceControlSyncJob} - 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 SourceControlSyncJob} 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, automationAccountName, sourceControlName, sourceControlSyncJobId, 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, automationAccountName, sourceControlName, sourceControlSyncJobId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(resourceGroupName, automationAccountName, sourceControlName, sourceControlSyncJobId, options, optionalCallback); + } + } + + /** + * Retrieve the source control sync job identified by job id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {uuid} sourceControlSyncJobId The source control sync job id. + * + * @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, automationAccountName, sourceControlName, sourceControlSyncJobId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, automationAccountName, sourceControlName, sourceControlSyncJobId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the source control sync job identified by job id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {uuid} sourceControlSyncJobId The source control sync job id. + * + * @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 {SourceControlSyncJobById} - 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 SourceControlSyncJobById} 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, automationAccountName, sourceControlName, sourceControlSyncJobId, 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, automationAccountName, sourceControlName, sourceControlSyncJobId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, automationAccountName, sourceControlName, sourceControlSyncJobId, options, optionalCallback); + } + } + + /** + * Retrieve a list of source control sync jobs. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName, automationAccountName, sourceControlName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccount(resourceGroupName, automationAccountName, sourceControlName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of source control sync jobs. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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 {SourceControlSyncJobListResult} - 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 SourceControlSyncJobListResult} 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. + */ + listByAutomationAccount(resourceGroupName, automationAccountName, sourceControlName, 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._listByAutomationAccount(resourceGroupName, automationAccountName, sourceControlName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccount(resourceGroupName, automationAccountName, sourceControlName, options, optionalCallback); + } + } + + /** + * Retrieve a list of source control sync jobs. + * + * @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. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccountNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of source control sync jobs. + * + * @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 {SourceControlSyncJobListResult} - 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 SourceControlSyncJobListResult} 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. + */ + listByAutomationAccountNext(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._listByAutomationAccountNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccountNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = SourceControlSyncJobOperations; diff --git a/lib/services/automationManagement/lib/lib/operations/statisticsOperations.js b/lib/services/automationManagement/lib/lib/operations/statisticsOperations.js new file mode 100644 index 0000000000..2d55cd9c03 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/operations/statisticsOperations.js @@ -0,0 +1,279 @@ +/* + * 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; + +/** + * Retrieve the statistics for the account. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} automationAccountName The automation account name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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 StatisticsListResult} 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 _listByAutomationAccount(resourceGroupName, automationAccountName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/statistics'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['StatisticsListResult']().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 StatisticsOperations. */ +class StatisticsOperations { + /** + * Create a StatisticsOperations. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listByAutomationAccount = _listByAutomationAccount; + } + + /** + * Retrieve the statistics for the account. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} automationAccountName The automation account name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName, automationAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the statistics for the account. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} automationAccountName The automation account name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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 {StatisticsListResult} - 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 StatisticsListResult} 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. + */ + listByAutomationAccount(resourceGroupName, automationAccountName, 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._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccount(resourceGroupName, automationAccountName, options, optionalCallback); + } + } + +} + +module.exports = StatisticsOperations; diff --git a/lib/services/automationManagement/lib/lib/operations/testJobOperations.js b/lib/services/automationManagement/lib/lib/operations/testJobOperations.js new file mode 100644 index 0000000000..ec509a1344 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/operations/testJobOperations.js @@ -0,0 +1,1294 @@ +/* + * 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; + +/** + * Create a test job of the runbook. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The parameters supplied to the create test job + * operation. + * + * @param {object} parameters The parameters supplied to the create test job + * operation. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * test job. + * + * @param {string} [parameters.runOn] Gets or sets the runOn which specifies + * the group name where the job is to be executed. + * + * @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 TestJob} 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, automationAccountName, runbookName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2015-10-31'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (runbookName === null || runbookName === undefined || typeof runbookName.valueOf() !== 'string') { + throw new Error('runbookName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters 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.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{runbookName}', encodeURIComponent(runbookName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['TestJobCreateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['TestJob']().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); + }); +} + +/** + * Retrieve the test job for the specified runbook. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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 TestJob} 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, automationAccountName, runbookName, 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 apiVersion = '2015-10-31'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (runbookName === null || runbookName === undefined || typeof runbookName.valueOf() !== 'string') { + throw new Error('runbookName 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.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{runbookName}', encodeURIComponent(runbookName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['TestJob']().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); + }); +} + +/** + * Resume the test job. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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. + * + * {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 _resume(resourceGroupName, automationAccountName, runbookName, 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 apiVersion = '2015-10-31'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (runbookName === null || runbookName === undefined || typeof runbookName.valueOf() !== 'string') { + throw new Error('runbookName 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.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/resume'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{runbookName}', encodeURIComponent(runbookName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Stop the test job. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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. + * + * {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 _stop(resourceGroupName, automationAccountName, runbookName, 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 apiVersion = '2015-10-31'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (runbookName === null || runbookName === undefined || typeof runbookName.valueOf() !== 'string') { + throw new Error('runbookName 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.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/stop'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{runbookName}', encodeURIComponent(runbookName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Suspend the test job. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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. + * + * {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 _suspend(resourceGroupName, automationAccountName, runbookName, 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 apiVersion = '2015-10-31'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (runbookName === null || runbookName === undefined || typeof runbookName.valueOf() !== 'string') { + throw new Error('runbookName 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.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/suspend'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{runbookName}', encodeURIComponent(runbookName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a TestJobOperations. */ +class TestJobOperations { + /** + * Create a TestJobOperations. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._create = _create; + this._get = _get; + this._resume = _resume; + this._stop = _stop; + this._suspend = _suspend; + } + + /** + * Create a test job of the runbook. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The parameters supplied to the create test job + * operation. + * + * @param {object} parameters The parameters supplied to the create test job + * operation. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * test job. + * + * @param {string} [parameters.runOn] Gets or sets the runOn which specifies + * the group name where the job is to be executed. + * + * @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, automationAccountName, runbookName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._create(resourceGroupName, automationAccountName, runbookName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create a test job of the runbook. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The parameters supplied to the create test job + * operation. + * + * @param {object} parameters The parameters supplied to the create test job + * operation. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * test job. + * + * @param {string} [parameters.runOn] Gets or sets the runOn which specifies + * the group name where the job is to be executed. + * + * @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 {TestJob} - 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 TestJob} 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, automationAccountName, runbookName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._create(resourceGroupName, automationAccountName, runbookName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(resourceGroupName, automationAccountName, runbookName, parameters, options, optionalCallback); + } + } + + /** + * Retrieve the test job for the specified runbook. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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. + */ + getWithHttpOperationResponse(resourceGroupName, automationAccountName, runbookName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, automationAccountName, runbookName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the test job for the specified runbook. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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 {TestJob} - 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 TestJob} 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, automationAccountName, runbookName, 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, automationAccountName, runbookName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, automationAccountName, runbookName, options, optionalCallback); + } + } + + /** + * Resume the test job. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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. + */ + resumeWithHttpOperationResponse(resourceGroupName, automationAccountName, runbookName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._resume(resourceGroupName, automationAccountName, runbookName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Resume the test job. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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 {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. + */ + resume(resourceGroupName, automationAccountName, runbookName, 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._resume(resourceGroupName, automationAccountName, runbookName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._resume(resourceGroupName, automationAccountName, runbookName, options, optionalCallback); + } + } + + /** + * Stop the test job. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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. + */ + stopWithHttpOperationResponse(resourceGroupName, automationAccountName, runbookName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._stop(resourceGroupName, automationAccountName, runbookName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Stop the test job. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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 {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. + */ + stop(resourceGroupName, automationAccountName, runbookName, 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._stop(resourceGroupName, automationAccountName, runbookName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._stop(resourceGroupName, automationAccountName, runbookName, options, optionalCallback); + } + } + + /** + * Suspend the test job. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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. + */ + suspendWithHttpOperationResponse(resourceGroupName, automationAccountName, runbookName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._suspend(resourceGroupName, automationAccountName, runbookName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Suspend the test job. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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 {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. + */ + suspend(resourceGroupName, automationAccountName, runbookName, 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._suspend(resourceGroupName, automationAccountName, runbookName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._suspend(resourceGroupName, automationAccountName, runbookName, options, optionalCallback); + } + } + +} + +module.exports = TestJobOperations; diff --git a/lib/services/automationManagement/lib/lib/operations/testJobStreams.js b/lib/services/automationManagement/lib/lib/operations/testJobStreams.js new file mode 100644 index 0000000000..944809e85b --- /dev/null +++ b/lib/services/automationManagement/lib/lib/operations/testJobStreams.js @@ -0,0 +1,778 @@ +/* + * 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; + +/** + * Retrieve a test job stream of the test job identified by runbook name and + * stream id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook name. + * + * @param {string} jobStreamId The job stream id. + * + * @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 JobStream} 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, automationAccountName, runbookName, jobStreamId, 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 apiVersion = '2015-10-31'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (runbookName === null || runbookName === undefined || typeof runbookName.valueOf() !== 'string') { + throw new Error('runbookName cannot be null or undefined and it must be of type string.'); + } + if (jobStreamId === null || jobStreamId === undefined || typeof jobStreamId.valueOf() !== 'string') { + throw new Error('jobStreamId 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.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/streams/{jobStreamId}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{runbookName}', encodeURIComponent(runbookName)); + requestUrl = requestUrl.replace('{jobStreamId}', encodeURIComponent(jobStreamId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['JobStream']().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); + }); +} + +/** + * Retrieve a list of test job streams identified by runbook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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 JobStreamListResult} 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 _listByTestJob(resourceGroupName, automationAccountName, runbookName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let apiVersion = '2015-10-31'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (runbookName === null || runbookName === undefined || typeof runbookName.valueOf() !== 'string') { + throw new Error('runbookName cannot be null or undefined and it must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (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.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/streams'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{runbookName}', encodeURIComponent(runbookName)); + let queryParameters = []; + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['JobStreamListResult']().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); + }); +} + +/** + * Retrieve a list of test job streams identified by runbook name. + * + * @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 JobStreamListResult} 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 _listByTestJobNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['JobStreamListResult']().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 TestJobStreams. */ +class TestJobStreams { + /** + * Create a TestJobStreams. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._listByTestJob = _listByTestJob; + this._listByTestJobNext = _listByTestJobNext; + } + + /** + * Retrieve a test job stream of the test job identified by runbook name and + * stream id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook name. + * + * @param {string} jobStreamId The job stream id. + * + * @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, automationAccountName, runbookName, jobStreamId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, automationAccountName, runbookName, jobStreamId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a test job stream of the test job identified by runbook name and + * stream id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook name. + * + * @param {string} jobStreamId The job stream id. + * + * @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 {JobStream} - 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 JobStream} 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, automationAccountName, runbookName, jobStreamId, 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, automationAccountName, runbookName, jobStreamId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, automationAccountName, runbookName, jobStreamId, options, optionalCallback); + } + } + + /** + * Retrieve a list of test job streams identified by runbook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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. + */ + listByTestJobWithHttpOperationResponse(resourceGroupName, automationAccountName, runbookName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByTestJob(resourceGroupName, automationAccountName, runbookName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of test job streams identified by runbook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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 {JobStreamListResult} - 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 JobStreamListResult} 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. + */ + listByTestJob(resourceGroupName, automationAccountName, runbookName, 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._listByTestJob(resourceGroupName, automationAccountName, runbookName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByTestJob(resourceGroupName, automationAccountName, runbookName, options, optionalCallback); + } + } + + /** + * Retrieve a list of test job streams identified by runbook name. + * + * @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. + */ + listByTestJobNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByTestJobNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of test job streams identified by runbook name. + * + * @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 {JobStreamListResult} - 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 JobStreamListResult} 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. + */ + listByTestJobNext(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._listByTestJobNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByTestJobNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = TestJobStreams; diff --git a/lib/services/automationManagement/lib/lib/operations/usages.js b/lib/services/automationManagement/lib/lib/operations/usages.js new file mode 100644 index 0000000000..b68cfaf78b --- /dev/null +++ b/lib/services/automationManagement/lib/lib/operations/usages.js @@ -0,0 +1,266 @@ +/* + * 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; + +/** + * Retrieve the usage for the account id. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} automationAccountName The automation account 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 UsageListResult} 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 _listByAutomationAccount(resourceGroupName, automationAccountName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/usages'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['UsageListResult']().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 Usages. */ +class Usages { + /** + * Create a Usages. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listByAutomationAccount = _listByAutomationAccount; + } + + /** + * Retrieve the usage for the account id. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} automationAccountName The automation account 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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName, automationAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the usage for the account id. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} automationAccountName The automation account 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 {UsageListResult} - 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 UsageListResult} 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. + */ + listByAutomationAccount(resourceGroupName, automationAccountName, 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._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccount(resourceGroupName, automationAccountName, options, optionalCallback); + } + } + +} + +module.exports = Usages; diff --git a/lib/services/automationManagement/lib/lib/operations/variableOperations.js b/lib/services/automationManagement/lib/lib/operations/variableOperations.js new file mode 100644 index 0000000000..02e2b78ede --- /dev/null +++ b/lib/services/automationManagement/lib/lib/operations/variableOperations.js @@ -0,0 +1,1608 @@ +/* + * 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; + +/** + * Create a variable. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} variableName The variable name. + * + * @param {object} parameters The parameters supplied to the create or update + * variable operation. + * + * @param {string} parameters.name Gets or sets the name of the variable. + * + * @param {string} [parameters.value] Gets or sets the value of the variable. + * + * @param {string} [parameters.description] Gets or sets the description of the + * variable. + * + * @param {boolean} [parameters.isEncrypted] Gets or sets the encrypted flag of + * the variable. + * + * @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 Variable} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, automationAccountName, variableName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (variableName === null || variableName === undefined || typeof variableName.valueOf() !== 'string') { + throw new Error('variableName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables/{variableName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{variableName}', encodeURIComponent(variableName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['VariableCreateOrUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Variable']().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['Variable']().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); + }); +} + +/** + * Update a variable. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} variableName The variable name. + * + * @param {object} parameters The parameters supplied to the update variable + * operation. + * + * @param {string} [parameters.name] Gets or sets the name of the variable. + * + * @param {string} [parameters.value] Gets or sets the value of the variable. + * + * @param {string} [parameters.description] Gets or sets the description of the + * variable. + * + * @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 Variable} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, automationAccountName, variableName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (variableName === null || variableName === undefined || typeof variableName.valueOf() !== 'string') { + throw new Error('variableName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables/{variableName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{variableName}', encodeURIComponent(variableName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['VariableUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Variable']().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); + }); +} + +/** + * Delete the variable. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} variableName The name of variable. + * + * @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, automationAccountName, variableName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (variableName === null || variableName === undefined || typeof variableName.valueOf() !== 'string') { + throw new Error('variableName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables/{variableName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{variableName}', encodeURIComponent(variableName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Retrieve the variable identified by variable name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} variableName The name of variable. + * + * @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 Variable} 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, automationAccountName, variableName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (variableName === null || variableName === undefined || typeof variableName.valueOf() !== 'string') { + throw new Error('variableName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables/{variableName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{variableName}', encodeURIComponent(variableName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Variable']().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); + }); +} + +/** + * Retrieve a list of variables. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 VariableListResult} 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 _listByAutomationAccount(resourceGroupName, automationAccountName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VariableListResult']().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); + }); +} + +/** + * Retrieve a list of variables. + * + * @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 VariableListResult} 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 _listByAutomationAccountNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VariableListResult']().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 VariableOperations. */ +class VariableOperations { + /** + * Create a VariableOperations. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._createOrUpdate = _createOrUpdate; + this._update = _update; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._listByAutomationAccount = _listByAutomationAccount; + this._listByAutomationAccountNext = _listByAutomationAccountNext; + } + + /** + * Create a variable. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} variableName The variable name. + * + * @param {object} parameters The parameters supplied to the create or update + * variable operation. + * + * @param {string} parameters.name Gets or sets the name of the variable. + * + * @param {string} [parameters.value] Gets or sets the value of the variable. + * + * @param {string} [parameters.description] Gets or sets the description of the + * variable. + * + * @param {boolean} [parameters.isEncrypted] Gets or sets the encrypted flag of + * the variable. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, automationAccountName, variableName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, automationAccountName, variableName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create a variable. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} variableName The variable name. + * + * @param {object} parameters The parameters supplied to the create or update + * variable operation. + * + * @param {string} parameters.name Gets or sets the name of the variable. + * + * @param {string} [parameters.value] Gets or sets the value of the variable. + * + * @param {string} [parameters.description] Gets or sets the description of the + * variable. + * + * @param {boolean} [parameters.isEncrypted] Gets or sets the encrypted flag of + * the variable. + * + * @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 {Variable} - 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 Variable} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, automationAccountName, variableName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, automationAccountName, variableName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, automationAccountName, variableName, parameters, options, optionalCallback); + } + } + + /** + * Update a variable. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} variableName The variable name. + * + * @param {object} parameters The parameters supplied to the update variable + * operation. + * + * @param {string} [parameters.name] Gets or sets the name of the variable. + * + * @param {string} [parameters.value] Gets or sets the value of the variable. + * + * @param {string} [parameters.description] Gets or sets the description of the + * variable. + * + * @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. + */ + updateWithHttpOperationResponse(resourceGroupName, automationAccountName, variableName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, automationAccountName, variableName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Update a variable. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} variableName The variable name. + * + * @param {object} parameters The parameters supplied to the update variable + * operation. + * + * @param {string} [parameters.name] Gets or sets the name of the variable. + * + * @param {string} [parameters.value] Gets or sets the value of the variable. + * + * @param {string} [parameters.description] Gets or sets the description of the + * variable. + * + * @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 {Variable} - 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 Variable} 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. + */ + update(resourceGroupName, automationAccountName, variableName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, automationAccountName, variableName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, automationAccountName, variableName, parameters, options, optionalCallback); + } + } + + /** + * Delete the variable. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} variableName The name of variable. + * + * @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, automationAccountName, variableName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, automationAccountName, variableName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete the variable. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} variableName The name of variable. + * + * @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, automationAccountName, variableName, 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, automationAccountName, variableName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, automationAccountName, variableName, options, optionalCallback); + } + } + + /** + * Retrieve the variable identified by variable name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} variableName The name of variable. + * + * @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, automationAccountName, variableName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, automationAccountName, variableName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the variable identified by variable name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} variableName The name of variable. + * + * @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 {Variable} - 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 Variable} 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, automationAccountName, variableName, 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, automationAccountName, variableName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, automationAccountName, variableName, options, optionalCallback); + } + } + + /** + * Retrieve a list of variables. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName, automationAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of variables. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 {VariableListResult} - 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 VariableListResult} 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. + */ + listByAutomationAccount(resourceGroupName, automationAccountName, 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._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccount(resourceGroupName, automationAccountName, options, optionalCallback); + } + } + + /** + * Retrieve a list of variables. + * + * @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. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccountNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of variables. + * + * @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 {VariableListResult} - 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 VariableListResult} 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. + */ + listByAutomationAccountNext(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._listByAutomationAccountNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccountNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = VariableOperations; diff --git a/lib/services/automationManagement/lib/lib/operations/webhookOperations.js b/lib/services/automationManagement/lib/lib/operations/webhookOperations.js new file mode 100644 index 0000000000..d80da18620 --- /dev/null +++ b/lib/services/automationManagement/lib/lib/operations/webhookOperations.js @@ -0,0 +1,1915 @@ +/* + * 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; + +/** + * Generates a Uri for use in creating a webhook. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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. + * + * {string} [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 _generateUri(resourceGroupName, automationAccountName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/generateUri'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = { + required: false, + serializedName: 'parsedResponse', + type: { + name: 'String' + } + }; + 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); + }); +} + +/** + * Delete the webhook by name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} webhookName The webhook 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. + * + * {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, automationAccountName, webhookName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (webhookName === null || webhookName === undefined || typeof webhookName.valueOf() !== 'string') { + throw new Error('webhookName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{webhookName}', encodeURIComponent(webhookName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Retrieve the webhook identified by webhook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} webhookName The webhook 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 Webhook} 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, automationAccountName, webhookName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (webhookName === null || webhookName === undefined || typeof webhookName.valueOf() !== 'string') { + throw new Error('webhookName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{webhookName}', encodeURIComponent(webhookName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Webhook']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Create the webhook identified by webhook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} webhookName The webhook name. + * + * @param {object} parameters The create or update parameters for webhook. + * + * @param {string} parameters.name Gets or sets the name of the webhook. + * + * @param {boolean} [parameters.isEnabled] Gets or sets the value of the + * enabled flag of webhook. + * + * @param {string} [parameters.uri] Gets or sets the uri. + * + * @param {date} [parameters.expiryTime] Gets or sets the expiry time. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * job. + * + * @param {object} [parameters.runbook] Gets or sets the runbook. + * + * @param {string} [parameters.runbook.name] Gets or sets the name of the + * runbook. + * + * @param {string} [parameters.runOn] Gets or sets the name of the hybrid + * worker group the webhook job will run on. + * + * @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 Webhook} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, automationAccountName, webhookName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (webhookName === null || webhookName === undefined || typeof webhookName.valueOf() !== 'string') { + throw new Error('webhookName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{webhookName}', encodeURIComponent(webhookName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['WebhookCreateOrUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Webhook']().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['Webhook']().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); + }); +} + +/** + * Update the webhook identified by webhook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} webhookName The webhook name. + * + * @param {object} parameters The update parameters for webhook. + * + * @param {string} [parameters.name] Gets or sets the name of the webhook. + * + * @param {boolean} [parameters.isEnabled] Gets or sets the value of the + * enabled flag of webhook. + * + * @param {string} [parameters.runOn] Gets or sets the name of the hybrid + * worker group the webhook job will run on. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * job. + * + * @param {string} [parameters.description] Gets or sets the description of the + * webhook. + * + * @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 Webhook} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, automationAccountName, webhookName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (webhookName === null || webhookName === undefined || typeof webhookName.valueOf() !== 'string') { + throw new Error('webhookName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{webhookName}', encodeURIComponent(webhookName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['WebhookUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Webhook']().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); + }); +} + +/** + * Retrieve a list of webhooks. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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 WebhookListResult} 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 _listByAutomationAccount(resourceGroupName, automationAccountName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['WebhookListResult']().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); + }); +} + +/** + * Retrieve a list of webhooks. + * + * @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 WebhookListResult} 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 _listByAutomationAccountNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['WebhookListResult']().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 WebhookOperations. */ +class WebhookOperations { + /** + * Create a WebhookOperations. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._generateUri = _generateUri; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._update = _update; + this._listByAutomationAccount = _listByAutomationAccount; + this._listByAutomationAccountNext = _listByAutomationAccountNext; + } + + /** + * Generates a Uri for use in creating a webhook. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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. + */ + generateUriWithHttpOperationResponse(resourceGroupName, automationAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._generateUri(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Generates a Uri for use in creating a webhook. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 {String} - 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. + * + * {string} [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. + */ + generateUri(resourceGroupName, automationAccountName, 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._generateUri(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._generateUri(resourceGroupName, automationAccountName, options, optionalCallback); + } + } + + /** + * Delete the webhook by name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} webhookName The webhook 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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, automationAccountName, webhookName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, automationAccountName, webhookName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete the webhook by name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} webhookName The webhook 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 {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, automationAccountName, webhookName, 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, automationAccountName, webhookName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, automationAccountName, webhookName, options, optionalCallback); + } + } + + /** + * Retrieve the webhook identified by webhook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} webhookName The webhook 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. + */ + getWithHttpOperationResponse(resourceGroupName, automationAccountName, webhookName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, automationAccountName, webhookName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the webhook identified by webhook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} webhookName The webhook 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 {Webhook} - 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 Webhook} 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, automationAccountName, webhookName, 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, automationAccountName, webhookName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, automationAccountName, webhookName, options, optionalCallback); + } + } + + /** + * Create the webhook identified by webhook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} webhookName The webhook name. + * + * @param {object} parameters The create or update parameters for webhook. + * + * @param {string} parameters.name Gets or sets the name of the webhook. + * + * @param {boolean} [parameters.isEnabled] Gets or sets the value of the + * enabled flag of webhook. + * + * @param {string} [parameters.uri] Gets or sets the uri. + * + * @param {date} [parameters.expiryTime] Gets or sets the expiry time. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * job. + * + * @param {object} [parameters.runbook] Gets or sets the runbook. + * + * @param {string} [parameters.runbook.name] Gets or sets the name of the + * runbook. + * + * @param {string} [parameters.runOn] Gets or sets the name of the hybrid + * worker group the webhook job will run on. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, automationAccountName, webhookName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, automationAccountName, webhookName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create the webhook identified by webhook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} webhookName The webhook name. + * + * @param {object} parameters The create or update parameters for webhook. + * + * @param {string} parameters.name Gets or sets the name of the webhook. + * + * @param {boolean} [parameters.isEnabled] Gets or sets the value of the + * enabled flag of webhook. + * + * @param {string} [parameters.uri] Gets or sets the uri. + * + * @param {date} [parameters.expiryTime] Gets or sets the expiry time. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * job. + * + * @param {object} [parameters.runbook] Gets or sets the runbook. + * + * @param {string} [parameters.runbook.name] Gets or sets the name of the + * runbook. + * + * @param {string} [parameters.runOn] Gets or sets the name of the hybrid + * worker group the webhook job will run on. + * + * @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 {Webhook} - 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 Webhook} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, automationAccountName, webhookName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, automationAccountName, webhookName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, automationAccountName, webhookName, parameters, options, optionalCallback); + } + } + + /** + * Update the webhook identified by webhook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} webhookName The webhook name. + * + * @param {object} parameters The update parameters for webhook. + * + * @param {string} [parameters.name] Gets or sets the name of the webhook. + * + * @param {boolean} [parameters.isEnabled] Gets or sets the value of the + * enabled flag of webhook. + * + * @param {string} [parameters.runOn] Gets or sets the name of the hybrid + * worker group the webhook job will run on. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * job. + * + * @param {string} [parameters.description] Gets or sets the description of the + * webhook. + * + * @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. + */ + updateWithHttpOperationResponse(resourceGroupName, automationAccountName, webhookName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, automationAccountName, webhookName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Update the webhook identified by webhook name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} webhookName The webhook name. + * + * @param {object} parameters The update parameters for webhook. + * + * @param {string} [parameters.name] Gets or sets the name of the webhook. + * + * @param {boolean} [parameters.isEnabled] Gets or sets the value of the + * enabled flag of webhook. + * + * @param {string} [parameters.runOn] Gets or sets the name of the hybrid + * worker group the webhook job will run on. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * job. + * + * @param {string} [parameters.description] Gets or sets the description of the + * webhook. + * + * @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 {Webhook} - 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 Webhook} 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. + */ + update(resourceGroupName, automationAccountName, webhookName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, automationAccountName, webhookName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, automationAccountName, webhookName, parameters, options, optionalCallback); + } + } + + /** + * Retrieve a list of webhooks. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName, automationAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of webhooks. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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 {WebhookListResult} - 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 WebhookListResult} 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. + */ + listByAutomationAccount(resourceGroupName, automationAccountName, 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._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccount(resourceGroupName, automationAccountName, options, optionalCallback); + } + } + + /** + * Retrieve a list of webhooks. + * + * @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. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccountNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of webhooks. + * + * @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 {WebhookListResult} - 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 WebhookListResult} 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. + */ + listByAutomationAccountNext(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._listByAutomationAccountNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccountNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = WebhookOperations; diff --git a/lib/services/automationManagement/lib/models/advancedScheduleMonthlyOccurrence.js b/lib/services/automationManagement/lib/models/advancedScheduleMonthlyOccurrence.js index 6608202bb0..b35d9611bb 100644 --- a/lib/services/automationManagement/lib/models/advancedScheduleMonthlyOccurrence.js +++ b/lib/services/automationManagement/lib/models/advancedScheduleMonthlyOccurrence.js @@ -20,7 +20,7 @@ class AdvancedScheduleMonthlyOccurrence { * @member {number} [occurrence] Occurrence of the week within the month. * Must be between 1 and 5 * @member {string} [day] Day of the occurrence. Must be one of monday, - * tuesday, wednesday,thursday, friday, saturday, sunday. Possible values + * tuesday, wednesday, thursday, friday, saturday, sunday. Possible values * include: 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', * 'Saturday', 'Sunday' */ diff --git a/lib/services/automationManagement/lib/models/agentRegistrationRegenerateKeyParameter.js b/lib/services/automationManagement/lib/models/agentRegistrationRegenerateKeyParameter.js index 43d8621cb9..4c7e0e4f9c 100644 --- a/lib/services/automationManagement/lib/models/agentRegistrationRegenerateKeyParameter.js +++ b/lib/services/automationManagement/lib/models/agentRegistrationRegenerateKeyParameter.js @@ -18,7 +18,7 @@ class AgentRegistrationRegenerateKeyParameter { /** * Create a AgentRegistrationRegenerateKeyParameter. * @member {string} keyName Gets or sets the agent registration key name - - * Primary or Secondary. Possible values include: 'Primary', 'Secondary' + * primary or secondary. Possible values include: 'primary', 'secondary' * @member {string} [name] Gets or sets the name of the resource. * @member {string} [location] Gets or sets the location of the resource. * @member {object} [tags] Gets or sets the tags attached to the resource. diff --git a/lib/services/automationManagement/lib/models/automationAccount.js b/lib/services/automationManagement/lib/models/automationAccount.js index 1b2a011a14..41d7d1ecf3 100644 --- a/lib/services/automationManagement/lib/models/automationAccount.js +++ b/lib/services/automationManagement/lib/models/automationAccount.js @@ -15,9 +15,9 @@ const models = require('./index'); /** * Definition of the automation account type. * - * @extends models['Resource'] + * @extends models['TrackedResource'] */ -class AutomationAccount extends models['Resource'] { +class AutomationAccount extends models['TrackedResource'] { /** * Create a AutomationAccount. * @member {object} [sku] Gets or sets the SKU of account. @@ -75,13 +75,6 @@ class AutomationAccount extends models['Resource'] { name: 'String' } }, - location: { - required: true, - serializedName: 'location', - type: { - name: 'String' - } - }, tags: { required: false, serializedName: 'tags', @@ -96,6 +89,13 @@ class AutomationAccount extends models['Resource'] { } } }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, sku: { required: false, serializedName: 'properties.sku', diff --git a/lib/services/automationManagement/lib/models/certificate.js b/lib/services/automationManagement/lib/models/certificate.js index 24571371bd..040fb31a01 100644 --- a/lib/services/automationManagement/lib/models/certificate.js +++ b/lib/services/automationManagement/lib/models/certificate.js @@ -10,15 +10,16 @@ 'use strict'; +const models = require('./index'); + /** * Definition of the certificate. * + * @extends models['ProxyResource'] */ -class Certificate { +class Certificate extends models['ProxyResource'] { /** * Create a Certificate. - * @member {string} [id] Gets the id of the resource. - * @member {string} [name] Gets the name of the certificate. * @member {string} [thumbprint] Gets the thumbprint of the certificate. * @member {date} [expiryTime] Gets the expiry time of the certificate. * @member {boolean} [isExportable] Gets the is exportable flag of the @@ -28,6 +29,7 @@ class Certificate { * @member {string} [description] Gets or sets the description. */ constructor() { + super(); } /** @@ -60,6 +62,14 @@ class Certificate { name: 'String' } }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, thumbprint: { required: false, readOnly: true, diff --git a/lib/services/automationManagement/lib/models/certificateUpdateParameters.js b/lib/services/automationManagement/lib/models/certificateUpdateParameters.js index bc375f8fdc..11e6061763 100644 --- a/lib/services/automationManagement/lib/models/certificateUpdateParameters.js +++ b/lib/services/automationManagement/lib/models/certificateUpdateParameters.js @@ -17,7 +17,7 @@ class CertificateUpdateParameters { /** * Create a CertificateUpdateParameters. - * @member {string} name Gets or sets the name of the certificate. + * @member {string} [name] Gets or sets the name of the certificate. * @member {string} [description] Gets or sets the description of the * certificate. */ @@ -39,7 +39,7 @@ class CertificateUpdateParameters { className: 'CertificateUpdateParameters', modelProperties: { name: { - required: true, + required: false, serializedName: 'name', type: { name: 'String' diff --git a/lib/services/automationManagement/lib/models/collectionItemUpdateConfiguration.js b/lib/services/automationManagement/lib/models/collectionItemUpdateConfiguration.js new file mode 100644 index 0000000000..f74f815c18 --- /dev/null +++ b/lib/services/automationManagement/lib/models/collectionItemUpdateConfiguration.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'; + +/** + * object returned when requesting a collection of software update + * configuration + * + */ +class CollectionItemUpdateConfiguration { + /** + * Create a CollectionItemUpdateConfiguration. + * @member {array} [azureVirtualMachines] List of azure resource Ids for + * azure virtual machines targeted by the software update configuration. + * @member {moment.duration} [duration] Maximum time allowed for the software + * update configuration run. Duration needs to be specified using the format + * PT[n]H[n]M[n]S as per ISO8601 + */ + constructor() { + } + + /** + * Defines the metadata of CollectionItemUpdateConfiguration + * + * @returns {object} metadata of CollectionItemUpdateConfiguration + * + */ + mapper() { + return { + required: false, + serializedName: 'collectionItemUpdateConfiguration', + type: { + name: 'Composite', + className: 'CollectionItemUpdateConfiguration', + modelProperties: { + azureVirtualMachines: { + required: false, + serializedName: 'azureVirtualMachines', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + duration: { + required: false, + serializedName: 'duration', + type: { + name: 'TimeSpan' + } + } + } + } + }; + } +} + +module.exports = CollectionItemUpdateConfiguration; diff --git a/lib/services/automationManagement/lib/models/connection.js b/lib/services/automationManagement/lib/models/connection.js index 57a618e20d..3a41e356d4 100644 --- a/lib/services/automationManagement/lib/models/connection.js +++ b/lib/services/automationManagement/lib/models/connection.js @@ -15,12 +15,11 @@ const models = require('./index'); /** * Definition of the connection. * + * @extends models['ProxyResource'] */ -class Connection { +class Connection extends models['ProxyResource'] { /** * Create a Connection. - * @member {string} [id] Gets the id of the resource. - * @member {string} [name] Gets the name of the connection. * @member {object} [connectionType] Gets or sets the connectionType of the * connection. * @member {string} [connectionType.name] Gets or sets the name of the @@ -32,6 +31,7 @@ class Connection { * @member {string} [description] Gets or sets the description. */ constructor() { + super(); } /** @@ -64,6 +64,14 @@ class Connection { name: 'String' } }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, connectionType: { required: false, serializedName: 'properties.connectionType', diff --git a/lib/services/automationManagement/lib/models/connectionType.js b/lib/services/automationManagement/lib/models/connectionType.js index 42cf615909..d5d7e8848d 100644 --- a/lib/services/automationManagement/lib/models/connectionType.js +++ b/lib/services/automationManagement/lib/models/connectionType.js @@ -21,6 +21,7 @@ class ConnectionType { * Create a ConnectionType. * @member {string} [id] Gets the id of the resource. * @member {string} [name] Gets the name of the connection type. + * @member {string} [type] Resource type * @member {boolean} [isGlobal] Gets or sets a Boolean value to indicate if * the connection type is global. * @member {object} [fieldDefinitions] Gets the field definitions of the @@ -62,6 +63,14 @@ class ConnectionType { name: 'String' } }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, isGlobal: { required: false, serializedName: 'properties.isGlobal', diff --git a/lib/services/automationManagement/lib/models/credential.js b/lib/services/automationManagement/lib/models/credential.js index 0100729a6b..a84920edca 100644 --- a/lib/services/automationManagement/lib/models/credential.js +++ b/lib/services/automationManagement/lib/models/credential.js @@ -10,21 +10,23 @@ 'use strict'; +const models = require('./index'); + /** * Definition of the credential. * + * @extends models['ProxyResource'] */ -class Credential { +class Credential extends models['ProxyResource'] { /** * Create a Credential. - * @member {string} [id] Gets the id of the resource. - * @member {string} [name] Gets the name of the credential. * @member {string} [userName] Gets the user name of the credential. * @member {date} [creationTime] Gets the creation time. * @member {date} [lastModifiedTime] Gets the last modified time. * @member {string} [description] Gets or sets the description. */ constructor() { + super(); } /** @@ -51,11 +53,20 @@ class Credential { }, name: { required: false, + readOnly: true, serializedName: 'name', type: { name: 'String' } }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, userName: { required: false, readOnly: true, diff --git a/lib/services/automationManagement/lib/models/credentialUpdateParameters.js b/lib/services/automationManagement/lib/models/credentialUpdateParameters.js index a165812849..44760f420b 100644 --- a/lib/services/automationManagement/lib/models/credentialUpdateParameters.js +++ b/lib/services/automationManagement/lib/models/credentialUpdateParameters.js @@ -17,7 +17,7 @@ class CredentialUpdateParameters { /** * Create a CredentialUpdateParameters. - * @member {string} name Gets or sets the name of the credential. + * @member {string} [name] Gets or sets the name of the credential. * @member {string} [userName] Gets or sets the user name of the credential. * @member {string} [password] Gets or sets the password of the credential. * @member {string} [description] Gets or sets the description of the @@ -41,7 +41,7 @@ class CredentialUpdateParameters { className: 'CredentialUpdateParameters', modelProperties: { name: { - required: true, + required: false, serializedName: 'name', type: { name: 'String' diff --git a/lib/services/automationManagement/lib/models/dscCompilationJob.js b/lib/services/automationManagement/lib/models/dscCompilationJob.js index 856b9560b1..e33fe69c1f 100644 --- a/lib/services/automationManagement/lib/models/dscCompilationJob.js +++ b/lib/services/automationManagement/lib/models/dscCompilationJob.js @@ -15,17 +15,24 @@ const models = require('./index'); /** * Definition of the Dsc Compilation job. * + * @extends models['ProxyResource'] */ -class DscCompilationJob { +class DscCompilationJob extends models['ProxyResource'] { /** * Create a DscCompilationJob. - * @member {string} [id] Gets the id of the resource. * @member {object} [configuration] Gets or sets the configuration. * @member {string} [configuration.name] Gets or sets the name of the Dsc * configuration. * @member {string} [startedBy] Gets the compilation job started by. * @member {uuid} [jobId] Gets the id of the job. * @member {date} [creationTime] Gets the creation time of the job. + * @member {object} [provisioningState] The current provisioning state of the + * job. + * @member {string} [provisioningState.provisioningState] The provisioning + * state of the resource. Possible values include: 'Failed', 'Succeeded', + * 'Suspended', 'Processing' + * @member {string} [runOn] Gets or sets the runOn which specifies the group + * name where the job is to be executed. * @member {string} [status] Gets or sets the status of the job. Possible * values include: 'New', 'Activating', 'Running', 'Completed', 'Failed', * 'Stopped', 'Blocked', 'Suspended', 'Disconnected', 'Suspending', @@ -41,6 +48,7 @@ class DscCompilationJob { * @member {object} [parameters] Gets or sets the parameters of the job. */ constructor() { + super(); } /** @@ -65,6 +73,22 @@ class DscCompilationJob { name: 'String' } }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, configuration: { required: false, serializedName: 'properties.configuration', @@ -97,6 +121,21 @@ class DscCompilationJob { name: 'DateTime' } }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'Composite', + className: 'JobProvisioningStateProperty' + } + }, + runOn: { + required: false, + serializedName: 'properties.runOn', + type: { + name: 'String' + } + }, status: { required: false, serializedName: 'properties.status', diff --git a/lib/services/automationManagement/lib/models/dscCompilationJobCreateParameters.js b/lib/services/automationManagement/lib/models/dscCompilationJobCreateParameters.js index ec7660a646..364f2c99a6 100644 --- a/lib/services/automationManagement/lib/models/dscCompilationJobCreateParameters.js +++ b/lib/services/automationManagement/lib/models/dscCompilationJobCreateParameters.js @@ -23,6 +23,8 @@ class DscCompilationJobCreateParameters { * @member {string} [configuration.name] Gets or sets the name of the Dsc * configuration. * @member {object} [parameters] Gets or sets the parameters of the job. + * @member {boolean} [newNodeConfigurationBuildVersionRequired] If a new + * build version of NodeConfiguration is required. * @member {string} [name] Gets or sets name of the resource. * @member {string} [location] Gets or sets the location of the resource. * @member {object} [tags] Gets or sets the tags attached to the resource. @@ -66,6 +68,13 @@ class DscCompilationJobCreateParameters { } } }, + newNodeConfigurationBuildVersionRequired: { + required: false, + serializedName: 'properties.newNodeConfigurationBuildVersionRequired', + type: { + name: 'Boolean' + } + }, name: { required: false, serializedName: 'name', diff --git a/lib/services/automationManagement/lib/models/dscConfiguration.js b/lib/services/automationManagement/lib/models/dscConfiguration.js index 056fbdc947..99f3b9ceef 100644 --- a/lib/services/automationManagement/lib/models/dscConfiguration.js +++ b/lib/services/automationManagement/lib/models/dscConfiguration.js @@ -15,9 +15,9 @@ const models = require('./index'); /** * Definition of the configuration type. * - * @extends models['Resource'] + * @extends models['TrackedResource'] */ -class DscConfiguration extends models['Resource'] { +class DscConfiguration extends models['TrackedResource'] { /** * Create a DscConfiguration. * @member {string} [provisioningState] Gets or sets the provisioning state @@ -86,13 +86,6 @@ class DscConfiguration extends models['Resource'] { name: 'String' } }, - location: { - required: true, - serializedName: 'location', - type: { - name: 'String' - } - }, tags: { required: false, serializedName: 'tags', @@ -107,6 +100,13 @@ class DscConfiguration extends models['Resource'] { } } }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, provisioningState: { required: false, serializedName: 'properties.provisioningState', diff --git a/lib/services/automationManagement/lib/models/dscConfigurationUpdateParameters.js b/lib/services/automationManagement/lib/models/dscConfigurationUpdateParameters.js new file mode 100644 index 0000000000..a0fcd3d36d --- /dev/null +++ b/lib/services/automationManagement/lib/models/dscConfigurationUpdateParameters.js @@ -0,0 +1,129 @@ +/* + * 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 parameters supplied to the create or update configuration operation. + * + */ +class DscConfigurationUpdateParameters { + /** + * Create a DscConfigurationUpdateParameters. + * @member {boolean} [logVerbose] Gets or sets verbose log option. + * @member {boolean} [logProgress] Gets or sets progress log option. + * @member {object} source Gets or sets the source. + * @member {object} [source.hash] Gets or sets the hash. + * @member {string} [source.hash.algorithm] Gets or sets the content hash + * algorithm used to hash the content. + * @member {string} [source.hash.value] Gets or sets expected hash value of + * the content. + * @member {string} [source.type] Gets or sets the content source type. + * Possible values include: 'embeddedContent', 'uri' + * @member {string} [source.value] Gets or sets the value of the content. + * This is based on the content source type. + * @member {string} [source.version] Gets or sets the version of the content. + * @member {object} [parameters] Gets or sets the configuration parameters. + * @member {string} [description] Gets or sets the description of the + * configuration. + * @member {string} [name] Gets or sets name of the resource. + * @member {object} [tags] Gets or sets the tags attached to the resource. + */ + constructor() { + } + + /** + * Defines the metadata of DscConfigurationUpdateParameters + * + * @returns {object} metadata of DscConfigurationUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'DscConfigurationUpdateParameters', + type: { + name: 'Composite', + className: 'DscConfigurationUpdateParameters', + modelProperties: { + logVerbose: { + required: false, + serializedName: 'properties.logVerbose', + type: { + name: 'Boolean' + } + }, + logProgress: { + required: false, + serializedName: 'properties.logProgress', + type: { + name: 'Boolean' + } + }, + source: { + required: true, + serializedName: 'properties.source', + type: { + name: 'Composite', + className: 'ContentSource' + } + }, + parameters: { + required: false, + serializedName: 'properties.parameters', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'DscConfigurationParameterElementType', + type: { + name: 'Composite', + className: 'DscConfigurationParameter' + } + } + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = DscConfigurationUpdateParameters; diff --git a/lib/services/automationManagement/lib/models/dscNode.js b/lib/services/automationManagement/lib/models/dscNode.js index 16f6bdfd47..94a9a48fee 100644 --- a/lib/services/automationManagement/lib/models/dscNode.js +++ b/lib/services/automationManagement/lib/models/dscNode.js @@ -13,11 +13,11 @@ const models = require('./index'); /** - * Definition of the dsc node type. + * Definition of a DscNode * - * @extends models['Resource'] + * @extends models['ProxyResource'] */ -class DscNode extends models['Resource'] { +class DscNode extends models['ProxyResource'] { /** * Create a DscNode. * @member {date} [lastSeen] Gets or sets the last seen time of the node. @@ -25,13 +25,13 @@ class DscNode extends models['Resource'] { * the node. * @member {string} [ip] Gets or sets the ip of the node. * @member {string} [accountId] Gets or sets the account id of the node. - * @member {object} [nodeConfiguration] Gets or sets the configuration of the - * node. - * @member {string} [nodeConfiguration.name] Gets or sets the name of the dsc + * @member {string} [dscNodeName] Gets or sets the name of the dsc * nodeconfiguration. * @member {string} [status] Gets or sets the status of the node. * @member {string} [nodeId] Gets or sets the node id. * @member {string} [etag] Gets or sets the etag of the resource. + * @member {array} [extensionHandler] Gets or sets the list of + * extensionHandler properties for a Node. */ constructor() { super(); @@ -75,83 +75,76 @@ class DscNode extends models['Resource'] { name: 'String' } }, - location: { - required: true, - serializedName: 'location', - type: { - name: 'String' - } - }, - tags: { - required: false, - serializedName: 'tags', - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } - }, lastSeen: { required: false, - serializedName: 'lastSeen', + serializedName: 'properties.lastSeen', type: { name: 'DateTime' } }, registrationTime: { required: false, - serializedName: 'registrationTime', + serializedName: 'properties.registrationTime', type: { name: 'DateTime' } }, ip: { required: false, - serializedName: 'ip', + serializedName: 'properties.ip', type: { name: 'String' } }, accountId: { required: false, - serializedName: 'accountId', + serializedName: 'properties.accountId', type: { name: 'String' } }, - nodeConfiguration: { + dscNodeName: { required: false, - serializedName: 'nodeConfiguration', + serializedName: 'properties.nodeConfiguration.name', type: { - name: 'Composite', - className: 'DscNodeConfigurationAssociationProperty' + name: 'String' } }, status: { required: false, - serializedName: 'status', + serializedName: 'properties.status', type: { name: 'String' } }, nodeId: { required: false, - serializedName: 'nodeId', + serializedName: 'properties.nodeId', type: { name: 'String' } }, etag: { required: false, - serializedName: 'etag', + serializedName: 'properties.etag', type: { name: 'String' } + }, + extensionHandler: { + required: false, + serializedName: 'properties.extensionHandler', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DscNodeExtensionHandlerAssociationPropertyElementType', + type: { + name: 'Composite', + className: 'DscNodeExtensionHandlerAssociationProperty' + } + } + } } } } diff --git a/lib/services/automationManagement/lib/models/dscNodeConfiguration.js b/lib/services/automationManagement/lib/models/dscNodeConfiguration.js index bad654714c..82ce02c8ec 100644 --- a/lib/services/automationManagement/lib/models/dscNodeConfiguration.js +++ b/lib/services/automationManagement/lib/models/dscNodeConfiguration.js @@ -15,20 +15,25 @@ const models = require('./index'); /** * Definition of the dsc node configuration. * + * @extends models['ProxyResource'] */ -class DscNodeConfiguration { +class DscNodeConfiguration extends models['ProxyResource'] { /** * Create a DscNodeConfiguration. - * @member {string} [name] Gets or sets the node configuration name. * @member {date} [lastModifiedTime] Gets or sets the last modified time. * @member {date} [creationTime] Gets or sets creation time. * @member {object} [configuration] Gets or sets the configuration of the * node. * @member {string} [configuration.name] Gets or sets the name of the Dsc * configuration. - * @member {string} [id] Gets or sets the id of the resource. + * @member {string} [source] Source of node configuration. + * @member {number} [nodeCount] Number of nodes with this nodeconfiguration + * assigned + * @member {boolean} [incrementNodeConfigurationBuild] If a new build version + * of NodeConfiguration is required. */ constructor() { + super(); } /** @@ -45,41 +50,72 @@ class DscNodeConfiguration { name: 'Composite', className: 'DscNodeConfiguration', 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' + } + }, lastModifiedTime: { required: false, - serializedName: 'lastModifiedTime', + serializedName: 'properties.lastModifiedTime', type: { name: 'DateTime' } }, creationTime: { required: false, - serializedName: 'creationTime', + serializedName: 'properties.creationTime', type: { name: 'DateTime' } }, configuration: { required: false, - serializedName: 'configuration', + serializedName: 'properties.configuration', type: { name: 'Composite', className: 'DscConfigurationAssociationProperty' } }, - id: { + source: { required: false, - serializedName: 'id', + serializedName: 'properties.source', type: { name: 'String' } + }, + nodeCount: { + required: false, + serializedName: 'properties.nodeCount', + type: { + name: 'Number' + } + }, + incrementNodeConfigurationBuild: { + required: false, + serializedName: 'properties.incrementNodeConfigurationBuild', + type: { + name: 'Boolean' + } } } } diff --git a/lib/services/automationManagement/lib/models/dscNodeConfigurationCreateOrUpdateParameters.js b/lib/services/automationManagement/lib/models/dscNodeConfigurationCreateOrUpdateParameters.js index c16598b833..35c2d9a93e 100644 --- a/lib/services/automationManagement/lib/models/dscNodeConfigurationCreateOrUpdateParameters.js +++ b/lib/services/automationManagement/lib/models/dscNodeConfigurationCreateOrUpdateParameters.js @@ -35,6 +35,8 @@ class DscNodeConfigurationCreateOrUpdateParameters { * @member {object} configuration Gets or sets the configuration of the node. * @member {string} [configuration.name] Gets or sets the name of the Dsc * configuration. + * @member {boolean} [newNodeConfigurationBuildVersionRequired] If a new + * build version of NodeConfiguration is required. */ constructor() { } @@ -75,6 +77,13 @@ class DscNodeConfigurationCreateOrUpdateParameters { name: 'Composite', className: 'DscConfigurationAssociationProperty' } + }, + newNodeConfigurationBuildVersionRequired: { + required: false, + serializedName: 'newNodeConfigurationBuildVersionRequired', + type: { + name: 'Boolean' + } } } } diff --git a/lib/services/automationManagement/lib/models/dscNodeConfigurationCreateOrUpdateParametersProperties.js b/lib/services/automationManagement/lib/models/dscNodeConfigurationCreateOrUpdateParametersProperties.js new file mode 100644 index 0000000000..077e9bb237 --- /dev/null +++ b/lib/services/automationManagement/lib/models/dscNodeConfigurationCreateOrUpdateParametersProperties.js @@ -0,0 +1,94 @@ +/* + * 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 parameters supplied to the create or update node configuration + * operation. + * + */ +class DscNodeConfigurationCreateOrUpdateParametersProperties { + /** + * Create a DscNodeConfigurationCreateOrUpdateParametersProperties. + * @member {object} source Gets or sets the source. + * @member {object} [source.hash] Gets or sets the hash. + * @member {string} [source.hash.algorithm] Gets or sets the content hash + * algorithm used to hash the content. + * @member {string} [source.hash.value] Gets or sets expected hash value of + * the content. + * @member {string} [source.type] Gets or sets the content source type. + * Possible values include: 'embeddedContent', 'uri' + * @member {string} [source.value] Gets or sets the value of the content. + * This is based on the content source type. + * @member {string} [source.version] Gets or sets the version of the content. + * @member {string} name Gets or sets the type of the parameter. + * @member {object} configuration Gets or sets the configuration of the node. + * @member {string} [configuration.name] Gets or sets the name of the Dsc + * configuration. + * @member {boolean} [incrementNodeConfigurationBuild] If a new build version + * of NodeConfiguration is required. + */ + constructor() { + } + + /** + * Defines the metadata of DscNodeConfigurationCreateOrUpdateParametersProperties + * + * @returns {object} metadata of DscNodeConfigurationCreateOrUpdateParametersProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'DscNodeConfigurationCreateOrUpdateParametersProperties', + type: { + name: 'Composite', + className: 'DscNodeConfigurationCreateOrUpdateParametersProperties', + modelProperties: { + source: { + required: true, + serializedName: 'source', + type: { + name: 'Composite', + className: 'ContentSource' + } + }, + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + configuration: { + required: true, + serializedName: 'configuration', + type: { + name: 'Composite', + className: 'DscConfigurationAssociationProperty' + } + }, + incrementNodeConfigurationBuild: { + required: false, + serializedName: 'incrementNodeConfigurationBuild', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = DscNodeConfigurationCreateOrUpdateParametersProperties; diff --git a/lib/services/automationManagement/lib/models/dscNodeExtensionHandlerAssociationProperty.js b/lib/services/automationManagement/lib/models/dscNodeExtensionHandlerAssociationProperty.js new file mode 100644 index 0000000000..1f97fc4e80 --- /dev/null +++ b/lib/services/automationManagement/lib/models/dscNodeExtensionHandlerAssociationProperty.js @@ -0,0 +1,61 @@ +/* + * 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 dsc extensionHandler property associated with the node + * + */ +class DscNodeExtensionHandlerAssociationProperty { + /** + * Create a DscNodeExtensionHandlerAssociationProperty. + * @member {string} [name] Gets or sets the name of the extension handler. + * @member {string} [version] Gets or sets the version of the extension + * handler. + */ + constructor() { + } + + /** + * Defines the metadata of DscNodeExtensionHandlerAssociationProperty + * + * @returns {object} metadata of DscNodeExtensionHandlerAssociationProperty + * + */ + mapper() { + return { + required: false, + serializedName: 'DscNodeExtensionHandlerAssociationProperty', + type: { + name: 'Composite', + className: 'DscNodeExtensionHandlerAssociationProperty', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + version: { + required: false, + serializedName: 'version', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DscNodeExtensionHandlerAssociationProperty; diff --git a/lib/services/automationManagement/lib/models/dscNodeUpdateParameters.js b/lib/services/automationManagement/lib/models/dscNodeUpdateParameters.js index 6561bcb849..b5bb93583d 100644 --- a/lib/services/automationManagement/lib/models/dscNodeUpdateParameters.js +++ b/lib/services/automationManagement/lib/models/dscNodeUpdateParameters.js @@ -24,6 +24,9 @@ class DscNodeUpdateParameters { * node. * @member {string} [nodeConfiguration.name] Gets or sets the name of the dsc * nodeconfiguration. + * @member {object} [properties] + * @member {string} [properties.name] Gets or sets the name of the dsc + * nodeconfiguration. */ constructor() { } @@ -56,6 +59,14 @@ class DscNodeUpdateParameters { name: 'Composite', className: 'DscNodeConfigurationAssociationProperty' } + }, + properties: { + required: false, + serializedName: 'properties', + type: { + name: 'Composite', + className: 'DscNodeUpdateParametersProperties' + } } } } diff --git a/lib/services/automationManagement/lib/models/dscNodeUpdateParametersProperties.js b/lib/services/automationManagement/lib/models/dscNodeUpdateParametersProperties.js new file mode 100644 index 0000000000..98c1f8dc94 --- /dev/null +++ b/lib/services/automationManagement/lib/models/dscNodeUpdateParametersProperties.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'; + +/** + * Class representing a DscNodeUpdateParametersProperties. + */ +class DscNodeUpdateParametersProperties { + /** + * Create a DscNodeUpdateParametersProperties. + * @member {string} [name] Gets or sets the name of the dsc + * nodeconfiguration. + */ + constructor() { + } + + /** + * Defines the metadata of DscNodeUpdateParametersProperties + * + * @returns {object} metadata of DscNodeUpdateParametersProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'DscNodeUpdateParameters_properties', + type: { + name: 'Composite', + className: 'DscNodeUpdateParametersProperties', + modelProperties: { + name: { + required: false, + serializedName: 'nodeConfiguration.name', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DscNodeUpdateParametersProperties; diff --git a/lib/services/automationManagement/lib/models/index.d.ts b/lib/services/automationManagement/lib/models/index.d.ts index acee0f8488..6c24f4b0f5 100644 --- a/lib/services/automationManagement/lib/models/index.d.ts +++ b/lib/services/automationManagement/lib/models/index.d.ts @@ -31,6 +31,24 @@ export interface ErrorResponse { message?: string; } +/** + * @class + * Initializes a new instance of the Key class. + * @constructor + * Automation key which is used to register a DSC Node + * + * @member {string} [keyName] Automation key name. Possible values include: + * 'primary', 'secondary' + * @member {string} [permissions] Automation key permissions. Possible values + * include: 'Full' + * @member {string} [value] Value of the Automation Key used for registration. + */ +export interface Key { + keyName?: string; + permissions?: string; + value?: string; +} + /** * @class * Initializes a new instance of the UsageCounterName class. @@ -91,6 +109,252 @@ export interface Statistics { readonly id?: string; } +/** + * @class + * Initializes a new instance of the RunbookAssociationProperty class. + * @constructor + * The runbook property associated with the entity. + * + * @member {string} [name] Gets or sets the name of the runbook. + */ +export interface RunbookAssociationProperty { + name?: string; +} + +/** + * @class + * Initializes a new instance of the Resource class. + * @constructor + * The core properties of ARM resources + * + * @member {string} [id] Fully qualified resource Id for the resource + * @member {string} [name] The name of the resource + * @member {string} [type] The type of the resource. + */ +export interface Resource extends BaseResource { + readonly id?: string; + readonly name?: string; + readonly type?: string; +} + +/** + * @class + * Initializes a new instance of the ProxyResource class. + * @constructor + * The resource model definition for a ARM proxy resource. It will have + * everything other than required location and tags + * + */ +export interface ProxyResource extends Resource { +} + +/** + * @class + * Initializes a new instance of the Webhook class. + * @constructor + * Definition of the webhook type. + * + * @member {boolean} [isEnabled] Gets or sets the value of the enabled flag of + * the webhook. Default value: false . + * @member {string} [uri] Gets or sets the webhook uri. + * @member {date} [expiryTime] Gets or sets the expiry time. + * @member {date} [lastInvokedTime] Gets or sets the last invoked time. + * @member {object} [parameters] Gets or sets the parameters of the job that is + * created when the webhook calls the runbook it is associated with. + * @member {object} [runbook] Gets or sets the runbook the webhook is + * associated with. + * @member {string} [runbook.name] Gets or sets the name of the runbook. + * @member {string} [runOn] Gets or sets the name of the hybrid worker group + * the webhook job will run on. + * @member {date} [creationTime] Gets or sets the creation time. + * @member {date} [lastModifiedTime] Gets or sets the last modified time. + * @member {string} [description] Gets or sets the description. + */ +export interface Webhook extends ProxyResource { + isEnabled?: boolean; + uri?: string; + expiryTime?: Date; + lastInvokedTime?: Date; + parameters?: { [propertyName: string]: string }; + runbook?: RunbookAssociationProperty; + runOn?: string; + creationTime?: Date; + lastModifiedTime?: Date; + description?: string; +} + +/** + * @class + * Initializes a new instance of the Variable class. + * @constructor + * Definition of the varible. + * + * @member {string} [value] Gets or sets the value of the variable. + * @member {boolean} [isEncrypted] Gets or sets the encrypted flag of the + * variable. + * @member {date} [creationTime] Gets or sets the creation time. + * @member {date} [lastModifiedTime] Gets or sets the last modified time. + * @member {string} [description] Gets or sets the description. + */ +export interface Variable extends ProxyResource { + value?: string; + isEncrypted?: boolean; + creationTime?: Date; + lastModifiedTime?: Date; + description?: string; +} + +/** + * @class + * Initializes a new instance of the JobProvisioningStateProperty class. + * @constructor + * The provisioning state property. + * + * @member {string} [provisioningState] The provisioning state of the resource. + * Possible values include: 'Failed', 'Succeeded', 'Suspended', 'Processing' + */ +export interface JobProvisioningStateProperty { + readonly provisioningState?: string; +} + +/** + * @class + * Initializes a new instance of the DscConfigurationAssociationProperty class. + * @constructor + * The Dsc configuration property associated with the entity. + * + * @member {string} [name] Gets or sets the name of the Dsc configuration. + */ +export interface DscConfigurationAssociationProperty { + name?: string; +} + +/** + * @class + * Initializes a new instance of the DscCompilationJob class. + * @constructor + * Definition of the Dsc Compilation job. + * + * @member {object} [configuration] Gets or sets the configuration. + * @member {string} [configuration.name] Gets or sets the name of the Dsc + * configuration. + * @member {string} [startedBy] Gets the compilation job started by. + * @member {uuid} [jobId] Gets the id of the job. + * @member {date} [creationTime] Gets the creation time of the job. + * @member {object} [provisioningState] The current provisioning state of the + * job. + * @member {string} [provisioningState.provisioningState] The provisioning + * state of the resource. Possible values include: 'Failed', 'Succeeded', + * 'Suspended', 'Processing' + * @member {string} [runOn] Gets or sets the runOn which specifies the group + * name where the job is to be executed. + * @member {string} [status] Gets or sets the status of the job. Possible + * values include: 'New', 'Activating', 'Running', 'Completed', 'Failed', + * 'Stopped', 'Blocked', 'Suspended', 'Disconnected', 'Suspending', 'Stopping', + * 'Resuming', 'Removing' + * @member {string} [statusDetails] Gets or sets the status details of the job. + * @member {date} [startTime] Gets the start time of the job. + * @member {date} [endTime] Gets the end time of the job. + * @member {string} [exception] Gets the exception of the job. + * @member {date} [lastModifiedTime] Gets the last modified time of the job. + * @member {date} [lastStatusModifiedTime] Gets the last status modified time + * of the job. + * @member {object} [parameters] Gets or sets the parameters of the job. + */ +export interface DscCompilationJob extends ProxyResource { + configuration?: DscConfigurationAssociationProperty; + readonly startedBy?: string; + readonly jobId?: string; + readonly creationTime?: Date; + provisioningState?: JobProvisioningStateProperty; + runOn?: string; + status?: string; + statusDetails?: string; + readonly startTime?: Date; + readonly endTime?: Date; + readonly exception?: string; + readonly lastModifiedTime?: Date; + readonly lastStatusModifiedTime?: Date; + parameters?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the Credential class. + * @constructor + * Definition of the credential. + * + * @member {string} [userName] Gets the user name of the credential. + * @member {date} [creationTime] Gets the creation time. + * @member {date} [lastModifiedTime] Gets the last modified time. + * @member {string} [description] Gets or sets the description. + */ +export interface Credential extends ProxyResource { + readonly userName?: string; + readonly creationTime?: Date; + readonly lastModifiedTime?: Date; + description?: string; +} + +/** + * @class + * Initializes a new instance of the ConnectionTypeAssociationProperty class. + * @constructor + * The connection type property associated with the entity. + * + * @member {string} [name] Gets or sets the name of the connection type. + */ +export interface ConnectionTypeAssociationProperty { + name?: string; +} + +/** + * @class + * Initializes a new instance of the Connection class. + * @constructor + * Definition of the connection. + * + * @member {object} [connectionType] Gets or sets the connectionType of the + * connection. + * @member {string} [connectionType.name] Gets or sets the name of the + * connection type. + * @member {object} [fieldDefinitionValues] Gets the field definition values of + * the connection. + * @member {date} [creationTime] Gets the creation time. + * @member {date} [lastModifiedTime] Gets the last modified time. + * @member {string} [description] Gets or sets the description. + */ +export interface Connection extends ProxyResource { + connectionType?: ConnectionTypeAssociationProperty; + readonly fieldDefinitionValues?: { [propertyName: string]: string }; + readonly creationTime?: Date; + readonly lastModifiedTime?: Date; + description?: string; +} + +/** + * @class + * Initializes a new instance of the Certificate class. + * @constructor + * Definition of the certificate. + * + * @member {string} [thumbprint] Gets the thumbprint of the certificate. + * @member {date} [expiryTime] Gets the expiry time of the certificate. + * @member {boolean} [isExportable] Gets the is exportable flag of the + * certificate. + * @member {date} [creationTime] Gets the creation time. + * @member {date} [lastModifiedTime] Gets the last modified time. + * @member {string} [description] Gets or sets the description. + */ +export interface Certificate extends ProxyResource { + readonly thumbprint?: string; + readonly expiryTime?: Date; + readonly isExportable?: boolean; + readonly creationTime?: Date; + readonly lastModifiedTime?: Date; + description?: string; +} + /** * @class * Initializes a new instance of the RunbookParameter class. @@ -181,22 +445,16 @@ export interface RunbookDraft { /** * @class - * Initializes a new instance of the Resource class. + * Initializes a new instance of the TrackedResource class. * @constructor - * The Resource definition. + * The resource model definition for a ARM tracked top level resource * - * @member {string} [id] Resource Id - * @member {string} [name] Resource name - * @member {string} [type] Resource type - * @member {string} location Resource location - * @member {object} [tags] Resource tags + * @member {object} [tags] Resource tags. + * @member {string} [location] The Azure Region where the resource lives */ -export interface Resource extends BaseResource { - readonly id?: string; - readonly name?: string; - readonly type?: string; - location: string; +export interface TrackedResource extends Resource { tags?: { [propertyName: string]: string }; + location?: string; } /** @@ -257,7 +515,7 @@ export interface Resource extends BaseResource { * @member {string} [description] Gets or sets the description. * @member {string} [etag] Gets or sets the etag of the resource. */ -export interface Runbook extends Resource { +export interface Runbook extends TrackedResource { runbookType?: string; publishContentLink?: ContentLink; state?: string; @@ -326,7 +584,7 @@ export interface ModuleErrorInfo { * @member {string} [description] Gets or sets the description. * @member {string} [etag] Gets or sets the etag of the resource. */ -export interface Module extends Resource { +export interface Module extends TrackedResource { isGlobal?: boolean; version?: string; sizeInBytes?: number; @@ -342,62 +600,20 @@ export interface Module extends Resource { /** * @class - * Initializes a new instance of the DscNodeConfigurationAssociationProperty class. + * Initializes a new instance of the ContentSource class. * @constructor - * The dsc nodeconfiguration property associated with the entity. + * Definition of the content source. * - * @member {string} [name] Gets or sets the name of the dsc nodeconfiguration. - */ -export interface DscNodeConfigurationAssociationProperty { - name?: string; -} - -/** - * @class - * Initializes a new instance of the DscNode class. - * @constructor - * Definition of the dsc node type. - * - * @member {date} [lastSeen] Gets or sets the last seen time of the node. - * @member {date} [registrationTime] Gets or sets the registration time of the - * node. - * @member {string} [ip] Gets or sets the ip of the node. - * @member {string} [accountId] Gets or sets the account id of the node. - * @member {object} [nodeConfiguration] Gets or sets the configuration of the - * node. - * @member {string} [nodeConfiguration.name] Gets or sets the name of the dsc - * nodeconfiguration. - * @member {string} [status] Gets or sets the status of the node. - * @member {string} [nodeId] Gets or sets the node id. - * @member {string} [etag] Gets or sets the etag of the resource. - */ -export interface DscNode extends Resource { - lastSeen?: Date; - registrationTime?: Date; - ip?: string; - accountId?: string; - nodeConfiguration?: DscNodeConfigurationAssociationProperty; - status?: string; - nodeId?: string; - etag?: string; -} - -/** - * @class - * Initializes a new instance of the ContentSource class. - * @constructor - * Definition of the content source. - * - * @member {object} [hash] Gets or sets the hash. - * @member {string} [hash.algorithm] Gets or sets the content hash algorithm - * used to hash the content. - * @member {string} [hash.value] Gets or sets expected hash value of the - * content. - * @member {string} [type] Gets or sets the content source type. Possible - * values include: 'embeddedContent', 'uri' - * @member {string} [value] Gets or sets the value of the content. This is - * based on the content source type. - * @member {string} [version] Gets or sets the version of the content. + * @member {object} [hash] Gets or sets the hash. + * @member {string} [hash.algorithm] Gets or sets the content hash algorithm + * used to hash the content. + * @member {string} [hash.value] Gets or sets expected hash value of the + * content. + * @member {string} [type] Gets or sets the content source type. Possible + * values include: 'embeddedContent', 'uri' + * @member {string} [value] Gets or sets the value of the content. This is + * based on the content source type. + * @member {string} [version] Gets or sets the version of the content. */ export interface ContentSource { hash?: ContentHash; @@ -454,7 +670,7 @@ export interface DscConfigurationParameter { * @member {string} [description] Gets or sets the description. * @member {string} [etag] Gets or sets the etag of the resource. */ -export interface DscConfiguration extends Resource { +export interface DscConfiguration extends TrackedResource { provisioningState?: string; jobCount?: number; parameters?: { [propertyName: string]: DscConfigurationParameter }; @@ -503,7 +719,7 @@ export interface Sku { * @member {string} [description] Gets or sets the description. * @member {string} [etag] Gets or sets the etag of the resource. */ -export interface AutomationAccount extends Resource { +export interface AutomationAccount extends TrackedResource { sku?: Sku; lastModifiedBy?: string; readonly state?: string; @@ -594,45 +810,18 @@ export interface AutomationAccountUpdateParameters { tags?: { [propertyName: string]: string }; } -/** - * @class - * Initializes a new instance of the Certificate class. - * @constructor - * Definition of the certificate. - * - * @member {string} [id] Gets the id of the resource. - * @member {string} [name] Gets the name of the certificate. - * @member {string} [thumbprint] Gets the thumbprint of the certificate. - * @member {date} [expiryTime] Gets the expiry time of the certificate. - * @member {boolean} [isExportable] Gets the is exportable flag of the - * certificate. - * @member {date} [creationTime] Gets the creation time. - * @member {date} [lastModifiedTime] Gets the last modified time. - * @member {string} [description] Gets or sets the description. - */ -export interface Certificate { - readonly id?: string; - readonly name?: string; - readonly thumbprint?: string; - readonly expiryTime?: Date; - readonly isExportable?: boolean; - readonly creationTime?: Date; - readonly lastModifiedTime?: Date; - description?: string; -} - /** * @class * Initializes a new instance of the CertificateUpdateParameters class. * @constructor * The parameters supplied to the update certificate operation. * - * @member {string} name Gets or sets the name of the certificate. + * @member {string} [name] Gets or sets the name of the certificate. * @member {string} [description] Gets or sets the description of the * certificate. */ export interface CertificateUpdateParameters { - name: string; + name?: string; description?: string; } @@ -661,46 +850,6 @@ export interface CertificateCreateOrUpdateParameters { isExportable?: boolean; } -/** - * @class - * Initializes a new instance of the ConnectionTypeAssociationProperty class. - * @constructor - * The connection type property associated with the entity. - * - * @member {string} [name] Gets or sets the name of the connection type. - */ -export interface ConnectionTypeAssociationProperty { - name?: string; -} - -/** - * @class - * Initializes a new instance of the Connection class. - * @constructor - * Definition of the connection. - * - * @member {string} [id] Gets the id of the resource. - * @member {string} [name] Gets the name of the connection. - * @member {object} [connectionType] Gets or sets the connectionType of the - * connection. - * @member {string} [connectionType.name] Gets or sets the name of the - * connection type. - * @member {object} [fieldDefinitionValues] Gets the field definition values of - * the connection. - * @member {date} [creationTime] Gets the creation time. - * @member {date} [lastModifiedTime] Gets the last modified time. - * @member {string} [description] Gets or sets the description. - */ -export interface Connection { - readonly id?: string; - readonly name?: string; - connectionType?: ConnectionTypeAssociationProperty; - readonly fieldDefinitionValues?: { [propertyName: string]: string }; - readonly creationTime?: Date; - readonly lastModifiedTime?: Date; - description?: string; -} - /** * @class * Initializes a new instance of the ConnectionUpdateParameters class. @@ -769,6 +918,7 @@ export interface FieldDefinition { * * @member {string} [id] Gets the id of the resource. * @member {string} [name] Gets the name of the connection type. + * @member {string} [type] Resource type * @member {boolean} [isGlobal] Gets or sets a Boolean value to indicate if the * connection type is global. * @member {object} [fieldDefinitions] Gets the field definitions of the @@ -780,6 +930,7 @@ export interface FieldDefinition { export interface ConnectionType { readonly id?: string; readonly name?: string; + readonly type?: string; isGlobal?: boolean; readonly fieldDefinitions?: { [propertyName: string]: FieldDefinition }; readonly creationTime?: Date; @@ -805,42 +956,20 @@ export interface ConnectionTypeCreateOrUpdateParameters { fieldDefinitions: { [propertyName: string]: FieldDefinition }; } -/** - * @class - * Initializes a new instance of the Credential class. - * @constructor - * Definition of the credential. - * - * @member {string} [id] Gets the id of the resource. - * @member {string} [name] Gets the name of the credential. - * @member {string} [userName] Gets the user name of the credential. - * @member {date} [creationTime] Gets the creation time. - * @member {date} [lastModifiedTime] Gets the last modified time. - * @member {string} [description] Gets or sets the description. - */ -export interface Credential { - readonly id?: string; - name?: string; - readonly userName?: string; - readonly creationTime?: Date; - readonly lastModifiedTime?: Date; - description?: string; -} - /** * @class * Initializes a new instance of the CredentialUpdateParameters class. * @constructor * The parameters supplied to the Update credential operation. * - * @member {string} name Gets or sets the name of the credential. + * @member {string} [name] Gets or sets the name of the credential. * @member {string} [userName] Gets or sets the user name of the credential. * @member {string} [password] Gets or sets the password of the credential. * @member {string} [description] Gets or sets the description of the * credential. */ export interface CredentialUpdateParameters { - name: string; + name?: string; userName?: string; password?: string; description?: string; @@ -972,7 +1101,7 @@ export interface Activity { * @member {number} [occurrence] Occurrence of the week within the month. Must * be between 1 and 5 * @member {string} [day] Day of the occurrence. Must be one of monday, - * tuesday, wednesday,thursday, friday, saturday, sunday. Possible values + * tuesday, wednesday, thursday, friday, saturday, sunday. Possible values * include: 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', * 'Sunday' */ @@ -1040,7 +1169,7 @@ export interface AgentRegistration { * The parameters supplied to the regenerate keys operation. * * @member {string} keyName Gets or sets the agent registration key name - - * Primary or Secondary. Possible values include: 'Primary', 'Secondary' + * primary or secondary. Possible values include: 'primary', 'secondary' * @member {string} [name] Gets or sets the name of the resource. * @member {string} [location] Gets or sets the location of the resource. * @member {object} [tags] Gets or sets the tags attached to the resource. @@ -1052,18 +1181,6 @@ export interface AgentRegistrationRegenerateKeyParameter { tags?: { [propertyName: string]: string }; } -/** - * @class - * Initializes a new instance of the DscConfigurationAssociationProperty class. - * @constructor - * The Dsc configuration property associated with the entity. - * - * @member {string} [name] Gets or sets the name of the Dsc configuration. - */ -export interface DscConfigurationAssociationProperty { - name?: string; -} - /** * @class * Initializes a new instance of the DscCompilationJobCreateParameters class. @@ -1074,6 +1191,8 @@ export interface DscConfigurationAssociationProperty { * @member {string} [configuration.name] Gets or sets the name of the Dsc * configuration. * @member {object} [parameters] Gets or sets the parameters of the job. + * @member {boolean} [newNodeConfigurationBuildVersionRequired] If a new build + * version of NodeConfiguration is required. * @member {string} [name] Gets or sets name of the resource. * @member {string} [location] Gets or sets the location of the resource. * @member {object} [tags] Gets or sets the tags attached to the resource. @@ -1081,6 +1200,7 @@ export interface DscConfigurationAssociationProperty { export interface DscCompilationJobCreateParameters { configuration: DscConfigurationAssociationProperty; parameters?: { [propertyName: string]: string }; + newNodeConfigurationBuildVersionRequired?: boolean; name?: string; location?: string; tags?: { [propertyName: string]: string }; @@ -1088,49 +1208,44 @@ export interface DscCompilationJobCreateParameters { /** * @class - * Initializes a new instance of the DscCompilationJob class. + * Initializes a new instance of the DscConfigurationCreateOrUpdateParameters class. * @constructor - * Definition of the Dsc Compilation job. + * The parameters supplied to the create or update configuration operation. * - * @member {string} [id] Gets the id of the resource. - * @member {object} [configuration] Gets or sets the configuration. - * @member {string} [configuration.name] Gets or sets the name of the Dsc + * @member {boolean} [logVerbose] Gets or sets verbose log option. + * @member {boolean} [logProgress] Gets or sets progress log option. + * @member {object} source Gets or sets the source. + * @member {object} [source.hash] Gets or sets the hash. + * @member {string} [source.hash.algorithm] Gets or sets the content hash + * algorithm used to hash the content. + * @member {string} [source.hash.value] Gets or sets expected hash value of the + * content. + * @member {string} [source.type] Gets or sets the content source type. + * Possible values include: 'embeddedContent', 'uri' + * @member {string} [source.value] Gets or sets the value of the content. This + * is based on the content source type. + * @member {string} [source.version] Gets or sets the version of the content. + * @member {object} [parameters] Gets or sets the configuration parameters. + * @member {string} [description] Gets or sets the description of the * configuration. - * @member {string} [startedBy] Gets the compilation job started by. - * @member {uuid} [jobId] Gets the id of the job. - * @member {date} [creationTime] Gets the creation time of the job. - * @member {string} [status] Gets or sets the status of the job. Possible - * values include: 'New', 'Activating', 'Running', 'Completed', 'Failed', - * 'Stopped', 'Blocked', 'Suspended', 'Disconnected', 'Suspending', 'Stopping', - * 'Resuming', 'Removing' - * @member {string} [statusDetails] Gets or sets the status details of the job. - * @member {date} [startTime] Gets the start time of the job. - * @member {date} [endTime] Gets the end time of the job. - * @member {string} [exception] Gets the exception of the job. - * @member {date} [lastModifiedTime] Gets the last modified time of the job. - * @member {date} [lastStatusModifiedTime] Gets the last status modified time - * of the job. - * @member {object} [parameters] Gets or sets the parameters of the job. + * @member {string} [name] Gets or sets name of the resource. + * @member {string} [location] Gets or sets the location of the resource. + * @member {object} [tags] Gets or sets the tags attached to the resource. */ -export interface DscCompilationJob { - readonly id?: string; - configuration?: DscConfigurationAssociationProperty; - readonly startedBy?: string; - readonly jobId?: string; - readonly creationTime?: Date; - status?: string; - statusDetails?: string; - readonly startTime?: Date; - readonly endTime?: Date; - readonly exception?: string; - readonly lastModifiedTime?: Date; - readonly lastStatusModifiedTime?: Date; - parameters?: { [propertyName: string]: string }; +export interface DscConfigurationCreateOrUpdateParameters { + logVerbose?: boolean; + logProgress?: boolean; + source: ContentSource; + parameters?: { [propertyName: string]: DscConfigurationParameter }; + description?: string; + name?: string; + location?: string; + tags?: { [propertyName: string]: string }; } /** * @class - * Initializes a new instance of the DscConfigurationCreateOrUpdateParameters class. + * Initializes a new instance of the DscConfigurationUpdateParameters class. * @constructor * The parameters supplied to the create or update configuration operation. * @@ -1151,17 +1266,15 @@ export interface DscCompilationJob { * @member {string} [description] Gets or sets the description of the * configuration. * @member {string} [name] Gets or sets name of the resource. - * @member {string} [location] Gets or sets the location of the resource. * @member {object} [tags] Gets or sets the tags attached to the resource. */ -export interface DscConfigurationCreateOrUpdateParameters { +export interface DscConfigurationUpdateParameters { logVerbose?: boolean; logProgress?: boolean; source: ContentSource; parameters?: { [propertyName: string]: DscConfigurationParameter }; description?: string; name?: string; - location?: string; tags?: { [propertyName: string]: string }; } @@ -1218,33 +1331,51 @@ export interface DscMetaConfiguration { * @member {object} configuration Gets or sets the configuration of the node. * @member {string} [configuration.name] Gets or sets the name of the Dsc * configuration. + * @member {boolean} [newNodeConfigurationBuildVersionRequired] If a new build + * version of NodeConfiguration is required. */ export interface DscNodeConfigurationCreateOrUpdateParameters { source: ContentSource; name: string; configuration: DscConfigurationAssociationProperty; + newNodeConfigurationBuildVersionRequired?: boolean; } /** * @class - * Initializes a new instance of the DscNodeConfiguration class. + * Initializes a new instance of the DscNodeConfigurationAssociationProperty class. * @constructor - * Definition of the dsc node configuration. + * The dsc nodeconfiguration property associated with the entity. * - * @member {string} [name] Gets or sets the node configuration name. - * @member {date} [lastModifiedTime] Gets or sets the last modified time. - * @member {date} [creationTime] Gets or sets creation time. - * @member {object} [configuration] Gets or sets the configuration of the node. - * @member {string} [configuration.name] Gets or sets the name of the Dsc - * configuration. - * @member {string} [id] Gets or sets the id of the resource. + * @member {string} [name] Gets or sets the name of the dsc nodeconfiguration. */ -export interface DscNodeConfiguration { +export interface DscNodeConfigurationAssociationProperty { + name?: string; +} + +/** + * @class + * Initializes a new instance of the DscNodeExtensionHandlerAssociationProperty class. + * @constructor + * The dsc extensionHandler property associated with the node + * + * @member {string} [name] Gets or sets the name of the extension handler. + * @member {string} [version] Gets or sets the version of the extension + * handler. + */ +export interface DscNodeExtensionHandlerAssociationProperty { + name?: string; + version?: string; +} + +/** + * @class + * Initializes a new instance of the DscNodeUpdateParametersProperties class. + * @constructor + * @member {string} [name] Gets or sets the name of the dsc nodeconfiguration. + */ +export interface DscNodeUpdateParametersProperties { name?: string; - lastModifiedTime?: Date; - creationTime?: Date; - configuration?: DscConfigurationAssociationProperty; - id?: string; } /** @@ -1258,10 +1389,14 @@ export interface DscNodeConfiguration { * node. * @member {string} [nodeConfiguration.name] Gets or sets the name of the dsc * nodeconfiguration. + * @member {object} [properties] + * @member {string} [properties.name] Gets or sets the name of the dsc + * nodeconfiguration. */ export interface DscNodeUpdateParameters { nodeId?: string; nodeConfiguration?: DscNodeConfigurationAssociationProperty; + properties?: DscNodeUpdateParametersProperties; } /** @@ -1470,23 +1605,10 @@ export interface HybridRunbookWorkerGroupUpdateParameters { /** * @class - * Initializes a new instance of the RunbookAssociationProperty class. + * Initializes a new instance of the Job class. * @constructor - * The runbook property associated with the entity. + * Definition of the job. * - * @member {string} [name] Gets or sets the name of the runbook. - */ -export interface RunbookAssociationProperty { - name?: string; -} - -/** - * @class - * Initializes a new instance of the Job class. - * @constructor - * Definition of the job. - * - * @member {string} [id] Gets or sets the id of the resource. * @member {object} [runbook] Gets or sets the runbook. * @member {string} [runbook.name] Gets or sets the name of the runbook. * @member {string} [startedBy] Gets or sets the job started by. @@ -1507,9 +1629,12 @@ export interface RunbookAssociationProperty { * @member {date} [lastStatusModifiedTime] Gets or sets the last status * modified time of the job. * @member {object} [parameters] Gets or sets the parameters of the job. + * @member {object} [provisioningState] The provisioning state of a resource. + * @member {string} [provisioningState.provisioningState] The provisioning + * state of the resource. Possible values include: 'Failed', 'Succeeded', + * 'Suspended', 'Processing' */ -export interface Job { - id?: string; +export interface Job extends ProxyResource { runbook?: RunbookAssociationProperty; startedBy?: string; runOn?: string; @@ -1523,6 +1648,7 @@ export interface Job { lastModifiedTime?: Date; lastStatusModifiedTime?: Date; parameters?: { [propertyName: string]: string }; + provisioningState?: JobProvisioningStateProperty; } /** @@ -1536,17 +1662,25 @@ export interface Job { * @member {object} [parameters] Gets or sets the parameters of the job. * @member {string} [runOn] Gets or sets the runOn which specifies the group * name where the job is to be executed. - * @member {string} [name] Gets or sets name of the resource. - * @member {string} [location] Gets or sets the location of the resource. - * @member {object} [tags] Gets or sets the tags attached to the resource. */ export interface JobCreateParameters { runbook: RunbookAssociationProperty; parameters?: { [propertyName: string]: string }; runOn?: string; - name?: string; - location?: string; - tags?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the JobListResult class. + * @constructor + * The response model for the list job operation. + * + * @member {array} [value] Gets or sets a list of jobs. + * @member {string} [nextLink] Gets or sets the next link. + */ +export interface JobListResult { + value?: Job[]; + nextLink?: string; } /** @@ -1588,7 +1722,9 @@ export interface JobScheduleCreateParameters { * @constructor * Definition of the job schedule. * - * @member {string} [id] Gets or sets the id of the resource. + * @member {string} [id] Gets the id of the resource. + * @member {string} [name] Gets the name of the variable. + * @member {string} [type] Resource type * @member {string} [jobScheduleId] Gets or sets the id of job schedule. * @member {object} [schedule] Gets or sets the schedule. * @member {string} [schedule.name] Gets or sets the name of the schedule. @@ -1600,7 +1736,9 @@ export interface JobScheduleCreateParameters { * schedule. */ export interface JobSchedule { - id?: string; + readonly id?: string; + readonly name?: string; + readonly type?: string; jobScheduleId?: string; schedule?: ScheduleAssociationProperty; runbook?: RunbookAssociationProperty; @@ -1633,6 +1771,18 @@ export interface JobStream { value?: { [propertyName: string]: any }; } +/** + * @class + * Initializes a new instance of the LinkedWorkspace class. + * @constructor + * Definition of the linked workspace. + * + * @member {string} [id] Gets the id of the linked workspace. + */ +export interface LinkedWorkspace { + readonly id?: string; +} + /** * @class * Initializes a new instance of the ModuleCreateOrUpdateParameters class. @@ -1869,8 +2019,8 @@ export interface RunbookUpdateParameters { * @member {date} startTime Gets or sets the start time of the schedule. * @member {date} [expiryTime] Gets or sets the end time of the schedule. * @member {object} [interval] Gets or sets the interval of the schedule. - * @member {string} frequency Gets or sets the frequency of the schedule. - * Possible values include: 'OneTime', 'Day', 'Hour', 'Week', 'Month' + * @member {string} frequency Possible values include: 'OneTime', 'Day', + * 'Hour', 'Week', 'Month' * @member {string} [timeZone] Gets or sets the time zone of the schedule. * @member {object} [advancedSchedule] Gets or sets the AdvancedSchedule. * @member {array} [advancedSchedule.weekDays] Days of the week that the job @@ -1891,14 +2041,64 @@ export interface ScheduleCreateOrUpdateParameters { advancedSchedule?: AdvancedSchedule; } +/** + * @class + * Initializes a new instance of the ScheduleProperties class. + * @constructor + * Definition of schedule parameters. + * + * @member {date} [startTime] Gets or sets the start time of the schedule. + * @member {number} [startTimeOffsetMinutes] Gets the start time's offset in + * minutes. + * @member {date} [expiryTime] Gets or sets the end time of the schedule. + * @member {number} [expiryTimeOffsetMinutes] Gets or sets the expiry time's + * offset in minutes. + * @member {boolean} [isEnabled] Gets or sets a value indicating whether this + * schedule is enabled. Default value: false . + * @member {date} [nextRun] Gets or sets the next run time of the schedule. + * @member {number} [nextRunOffsetMinutes] Gets or sets the next run time's + * offset in minutes. + * @member {number} [interval] Gets or sets the interval of the schedule. + * @member {string} [frequency] Gets or sets the frequency of the schedule. + * Possible values include: 'OneTime', 'Day', 'Hour', 'Week', 'Month' + * @member {string} [timeZone] Gets or sets the time zone of the schedule. + * @member {object} [advancedSchedule] Gets or sets the advanced schedule. + * @member {array} [advancedSchedule.weekDays] Days of the week that the job + * should execute on. + * @member {array} [advancedSchedule.monthDays] Days of the month that the job + * should execute on. Must be between 1 and 31. + * @member {array} [advancedSchedule.monthlyOccurrences] Occurrences of days + * within a month. + * @member {date} [creationTime] Gets or sets the creation time. + * @member {date} [lastModifiedTime] Gets or sets the last modified time. + * @member {string} [description] Gets or sets the description. + */ +export interface ScheduleProperties { + startTime?: Date; + readonly startTimeOffsetMinutes?: number; + expiryTime?: Date; + expiryTimeOffsetMinutes?: number; + isEnabled?: boolean; + nextRun?: Date; + nextRunOffsetMinutes?: number; + interval?: number; + frequency?: string; + timeZone?: string; + advancedSchedule?: AdvancedSchedule; + creationTime?: Date; + lastModifiedTime?: Date; + description?: string; +} + /** * @class * Initializes a new instance of the Schedule class. * @constructor * Definition of the schedule. * - * @member {string} [id] Gets or sets the id of the resource. - * @member {string} [name] Gets or sets the name of the schedule. + * @member {string} [id] Gets the id of the resource. + * @member {string} [name] Gets name of the schedule. + * @member {string} [type] Resource type * @member {date} [startTime] Gets or sets the start time of the schedule. * @member {number} [startTimeOffsetMinutes] Gets the start time's offset in * minutes. @@ -1910,7 +2110,7 @@ export interface ScheduleCreateOrUpdateParameters { * @member {date} [nextRun] Gets or sets the next run time of the schedule. * @member {number} [nextRunOffsetMinutes] Gets or sets the next run time's * offset in minutes. - * @member {object} [interval] Gets or sets the interval of the schedule. + * @member {number} [interval] Gets or sets the interval of the schedule. * @member {string} [frequency] Gets or sets the frequency of the schedule. * Possible values include: 'OneTime', 'Day', 'Hour', 'Week', 'Month' * @member {string} [timeZone] Gets or sets the time zone of the schedule. @@ -1926,8 +2126,9 @@ export interface ScheduleCreateOrUpdateParameters { * @member {string} [description] Gets or sets the description. */ export interface Schedule { - id?: string; - name?: string; + readonly id?: string; + readonly name?: string; + readonly type?: string; startTime?: Date; readonly startTimeOffsetMinutes?: number; expiryTime?: Date; @@ -1935,7 +2136,7 @@ export interface Schedule { isEnabled?: boolean; nextRun?: Date; nextRunOffsetMinutes?: number; - interval?: any; + interval?: number; frequency?: string; timeZone?: string; advancedSchedule?: AdvancedSchedule; @@ -1950,13 +2151,13 @@ export interface Schedule { * @constructor * The parameters supplied to the update schedule operation. * - * @member {string} name Gets or sets the name of the schedule. + * @member {string} [name] Gets or sets the name of the schedule. * @member {string} [description] Gets or sets the description of the schedule. * @member {boolean} [isEnabled] Gets or sets a value indicating whether this * schedule is enabled. */ export interface ScheduleUpdateParameters { - name: string; + name?: string; description?: string; isEnabled?: boolean; } @@ -1979,13 +2180,11 @@ export interface SubResource extends BaseResource { * @constructor * The parameters supplied to the create test job operation. * - * @member {string} runbookName Gets or sets the runbook name. * @member {object} [parameters] Gets or sets the parameters of the test job. * @member {string} [runOn] Gets or sets the runOn which specifies the group * name where the job is to be executed. */ export interface TestJobCreateParameters { - runbookName: string; parameters?: { [propertyName: string]: string }; runOn?: string; } @@ -2011,6 +2210,8 @@ export interface TestJobCreateParameters { * @member {date} [lastStatusModifiedTime] Gets or sets the last status * modified time of the test job. * @member {object} [parameters] Gets or sets the parameters of the test job. + * @member {number} [logActivityTrace] The activity-level tracing options of + * the runbook. */ export interface TestJob { creationTime?: Date; @@ -2023,6 +2224,7 @@ export interface TestJob { lastModifiedTime?: Date; lastStatusModifiedTime?: Date; parameters?: { [propertyName: string]: string }; + logActivityTrace?: number; } /** @@ -2058,43 +2260,18 @@ export interface VariableCreateOrUpdateParameters { isEncrypted?: boolean; } -/** - * @class - * Initializes a new instance of the Variable class. - * @constructor - * Definition of the varible. - * - * @member {string} [id] Gets or sets the id of the resource. - * @member {string} [name] Gets or sets the name of the variable. - * @member {string} [value] Gets or sets the value of the variable. - * @member {boolean} [isEncrypted] Gets or sets the encrypted flag of the - * variable. - * @member {date} [creationTime] Gets or sets the creation time. - * @member {date} [lastModifiedTime] Gets or sets the last modified time. - * @member {string} [description] Gets or sets the description. - */ -export interface Variable { - id?: string; - name?: string; - value?: string; - isEncrypted?: boolean; - creationTime?: Date; - lastModifiedTime?: Date; - description?: string; -} - /** * @class * Initializes a new instance of the VariableUpdateParameters class. * @constructor * The parameters supplied to the update variable operation. * - * @member {string} name Gets or sets the name of the variable. + * @member {string} [name] Gets or sets the name of the variable. * @member {string} [value] Gets or sets the value of the variable. * @member {string} [description] Gets or sets the description of the variable. */ export interface VariableUpdateParameters { - name: string; + name?: string; value?: string; description?: string; } @@ -2126,52 +2303,13 @@ export interface WebhookCreateOrUpdateParameters { runOn?: string; } -/** - * @class - * Initializes a new instance of the Webhook class. - * @constructor - * Definition of the webhook type. - * - * @member {string} [id] Gets or sets the id of the resource. - * @member {string} [name] Gets or sets the name of the webhook. - * @member {boolean} [isEnabled] Gets or sets the value of the enabled flag of - * the webhook. Default value: false . - * @member {string} [uri] Gets or sets the webhook uri. - * @member {date} [expiryTime] Gets or sets the expiry time. - * @member {date} [lastInvokedTime] Gets or sets the last invoked time. - * @member {object} [parameters] Gets or sets the parameters of the job that is - * created when the webhook calls the runbook it is associated with. - * @member {object} [runbook] Gets or sets the runbook the webhook is - * associated with. - * @member {string} [runbook.name] Gets or sets the name of the runbook. - * @member {string} [runOn] Gets or sets the name of the hybrid worker group - * the webhook job will run on. - * @member {date} [creationTime] Gets or sets the creation time. - * @member {date} [lastModifiedTime] Gets or sets the last modified time. - * @member {string} [description] Gets or sets the description. - */ -export interface Webhook { - id?: string; - name?: string; - isEnabled?: boolean; - uri?: string; - expiryTime?: Date; - lastInvokedTime?: Date; - parameters?: { [propertyName: string]: string }; - runbook?: RunbookAssociationProperty; - runOn?: string; - creationTime?: Date; - lastModifiedTime?: Date; - description?: string; -} - /** * @class * Initializes a new instance of the WebhookUpdateParameters class. * @constructor * The parameters supplied to the update webhook operation. * - * @member {string} name Gets or sets the name of the webhook. + * @member {string} [name] Gets or sets the name of the webhook. * @member {boolean} [isEnabled] Gets or sets the value of the enabled flag of * webhook. * @member {string} [runOn] Gets or sets the name of the hybrid worker group @@ -2180,197 +2318,845 @@ export interface Webhook { * @member {string} [description] Gets or sets the description of the webhook. */ export interface WebhookUpdateParameters { - name: string; + name?: string; isEnabled?: boolean; runOn?: string; parameters?: { [propertyName: string]: string }; description?: string; } - /** * @class - * Initializes a new instance of the AutomationAccountListResult class. + * Initializes a new instance of the JobCollectionItem class. * @constructor - * The response model for the list account operation. + * Job collection item properties. * - * @member {string} [nextLink] Gets or sets the next link. + * @member {object} [runbook] The runbook association. + * @member {string} [runbook.name] Gets or sets the name of the runbook. + * @member {uuid} [jobId] The id of the job. + * @member {date} [creationTime] The creation time of the job. + * @member {string} [status] The status of the job. Possible values include: + * 'New', 'Activating', 'Running', 'Completed', 'Failed', 'Stopped', 'Blocked', + * 'Suspended', 'Disconnected', 'Suspending', 'Stopping', 'Resuming', + * 'Removing' + * @member {date} [startTime] The start time of the job. + * @member {date} [endTime] The end time of the job. + * @member {date} [lastModifiedTime] The last modified time of the job. + * @member {object} [provisioningState] The current provisioning state of the + * job. + * @member {string} [provisioningState.provisioningState] The provisioning + * state of the resource. Possible values include: 'Failed', 'Succeeded', + * 'Suspended', 'Processing' */ -export interface AutomationAccountListResult extends Array { - nextLink?: string; +export interface JobCollectionItem extends ProxyResource { + readonly runbook?: RunbookAssociationProperty; + readonly jobId?: string; + readonly creationTime?: Date; + readonly status?: string; + readonly startTime?: Date; + readonly endTime?: Date; + readonly lastModifiedTime?: Date; + provisioningState?: JobProvisioningStateProperty; } /** * @class - * Initializes a new instance of the OperationListResult class. + * Initializes a new instance of the WindowsProperties class. * @constructor - * The response model for the list of Automation operations + * Windows specific update configuration. * + * @member {string} [includedUpdateClassifications] Update classification + * included in the software update configuration. A comma separated string with + * required values. Possible values include: 'Unclassified', 'Critical', + * 'Security', 'UpdateRollup', 'FeaturePack', 'ServicePack', 'Definition', + * 'Tools', 'Updates' + * @member {array} [excludedKbNumbers] KB numbers excluded from the software + * update configuration. */ -export interface OperationListResult extends Array { +export interface WindowsProperties { + includedUpdateClassifications?: string; + excludedKbNumbers?: string[]; } /** * @class - * Initializes a new instance of the StatisticsListResult class. + * Initializes a new instance of the LinuxProperties class. * @constructor - * The response model for the list statistics operation. + * Linux specific update configuration. * + * @member {string} [includedPackageClassifications] Update classifications + * included in the software update configuration. Possible values include: + * 'Unclassified', 'Critical', 'Security', 'Other' + * @member {array} [excludedPackageNameMasks] packages excluded from the + * software update configuration. */ -export interface StatisticsListResult extends Array { +export interface LinuxProperties { + includedPackageClassifications?: string; + excludedPackageNameMasks?: string[]; } /** * @class - * Initializes a new instance of the UsageListResult class. + * Initializes a new instance of the UpdateConfiguration class. * @constructor - * The response model for the get usage operation. + * Update specifc properties of the software update configuration. * + * @member {string} operatingSystem operating system of target machines. + * Possible values include: 'Windows', 'Linux' + * @member {object} [windows] Windows specific update configuration. + * @member {string} [windows.includedUpdateClassifications] Update + * classification included in the software update configuration. A comma + * separated string with required values. Possible values include: + * 'Unclassified', 'Critical', 'Security', 'UpdateRollup', 'FeaturePack', + * 'ServicePack', 'Definition', 'Tools', 'Updates' + * @member {array} [windows.excludedKbNumbers] KB numbers excluded from the + * software update configuration. + * @member {object} [linux] Linux specific update configuration. + * @member {string} [linux.includedPackageClassifications] Update + * classifications included in the software update configuration. Possible + * values include: 'Unclassified', 'Critical', 'Security', 'Other' + * @member {array} [linux.excludedPackageNameMasks] packages excluded from the + * software update configuration. + * @member {moment.duration} [duration] Maximum time allowed for the software + * update configuration run. Duration needs to be specified using the format + * PT[n]H[n]M[n]S as per ISO8601 + * @member {array} [azureVirtualMachines] List of azure resource Ids for azure + * virtual machines targeted by the software update configuration. + * @member {array} [nonAzureComputerNames] List of names of non-azure machines + * targeted by the software update configuration. */ -export interface UsageListResult extends Array { +export interface UpdateConfiguration { + operatingSystem: string; + windows?: WindowsProperties; + linux?: LinuxProperties; + duration?: moment.Duration; + azureVirtualMachines?: string[]; + nonAzureComputerNames?: string[]; } /** * @class - * Initializes a new instance of the CertificateListResult class. + * Initializes a new instance of the SoftwareUpdateConfiguration class. * @constructor - * The response model for the list certificate operation. + * Software update configuration properties. * - * @member {string} [nextLink] Gets or sets the next link. - */ -export interface CertificateListResult extends Array { - nextLink?: string; + * @member {string} [name] Resource name. + * @member {string} [id] Resource Id. + * @member {string} [type] Resource type + * @member {object} updateConfiguration update specific properties for the + * Software update configuration + * @member {string} [updateConfiguration.operatingSystem] operating system of + * target machines. Possible values include: 'Windows', 'Linux' + * @member {object} [updateConfiguration.windows] Windows specific update + * configuration. + * @member {string} [updateConfiguration.windows.includedUpdateClassifications] + * Update classification included in the software update configuration. A comma + * separated string with required values. Possible values include: + * 'Unclassified', 'Critical', 'Security', 'UpdateRollup', 'FeaturePack', + * 'ServicePack', 'Definition', 'Tools', 'Updates' + * @member {array} [updateConfiguration.windows.excludedKbNumbers] KB numbers + * excluded from the software update configuration. + * @member {object} [updateConfiguration.linux] Linux specific update + * configuration. + * @member {string} [updateConfiguration.linux.includedPackageClassifications] + * Update classifications included in the software update configuration. + * Possible values include: 'Unclassified', 'Critical', 'Security', 'Other' + * @member {array} [updateConfiguration.linux.excludedPackageNameMasks] + * packages excluded from the software update configuration. + * @member {moment.duration} [updateConfiguration.duration] Maximum time + * allowed for the software update configuration run. Duration needs to be + * specified using the format PT[n]H[n]M[n]S as per ISO8601 + * @member {array} [updateConfiguration.azureVirtualMachines] List of azure + * resource Ids for azure virtual machines targeted by the software update + * configuration. + * @member {array} [updateConfiguration.nonAzureComputerNames] List of names of + * non-azure machines targeted by the software update configuration. + * @member {object} scheduleInfo Schedule information for the Software update + * configuration + * @member {date} [scheduleInfo.startTime] Gets or sets the start time of the + * schedule. + * @member {number} [scheduleInfo.startTimeOffsetMinutes] Gets the start time's + * offset in minutes. + * @member {date} [scheduleInfo.expiryTime] Gets or sets the end time of the + * schedule. + * @member {number} [scheduleInfo.expiryTimeOffsetMinutes] Gets or sets the + * expiry time's offset in minutes. + * @member {boolean} [scheduleInfo.isEnabled] Gets or sets a value indicating + * whether this schedule is enabled. + * @member {date} [scheduleInfo.nextRun] Gets or sets the next run time of the + * schedule. + * @member {number} [scheduleInfo.nextRunOffsetMinutes] Gets or sets the next + * run time's offset in minutes. + * @member {number} [scheduleInfo.interval] Gets or sets the interval of the + * schedule. + * @member {string} [scheduleInfo.frequency] Gets or sets the frequency of the + * schedule. Possible values include: 'OneTime', 'Day', 'Hour', 'Week', 'Month' + * @member {string} [scheduleInfo.timeZone] Gets or sets the time zone of the + * schedule. + * @member {object} [scheduleInfo.advancedSchedule] Gets or sets the advanced + * schedule. + * @member {array} [scheduleInfo.advancedSchedule.weekDays] Days of the week + * that the job should execute on. + * @member {array} [scheduleInfo.advancedSchedule.monthDays] Days of the month + * that the job should execute on. Must be between 1 and 31. + * @member {array} [scheduleInfo.advancedSchedule.monthlyOccurrences] + * Occurrences of days within a month. + * @member {date} [scheduleInfo.creationTime] Gets or sets the creation time. + * @member {date} [scheduleInfo.lastModifiedTime] Gets or sets the last + * modified time. + * @member {string} [scheduleInfo.description] Gets or sets the description. + * @member {string} [provisioningState] Provisioning state for the software + * update configuration, which only appears in the response. + * @member {object} [error] detailes of provisioning error + * @member {string} [error.code] Error code + * @member {string} [error.message] Error message indicating why the operation + * failed. + * @member {date} [creationTime] Creation time of theresource, which only + * appears in the response. + * @member {string} [createdBy] createdBy property, which only appears in the + * response. + * @member {date} [lastModifiedTime] Last time resource was modified, which + * only appears in the response. + * @member {string} [lastModifiedBy] lastModifiedBy property, which only + * appears in the response. + */ +export interface SoftwareUpdateConfiguration extends BaseResource { + readonly name?: string; + readonly id?: string; + readonly type?: string; + updateConfiguration: UpdateConfiguration; + scheduleInfo: ScheduleProperties; + readonly provisioningState?: string; + error?: ErrorResponse; + readonly creationTime?: Date; + readonly createdBy?: string; + readonly lastModifiedTime?: Date; + readonly lastModifiedBy?: string; } /** * @class - * Initializes a new instance of the ConnectionListResult class. + * Initializes a new instance of the CollectionItemUpdateConfiguration class. * @constructor - * The response model for the list connection operation. + * object returned when requesting a collection of software update + * configuration * - * @member {string} [nextLink] Gets or sets the next link. + * @member {array} [azureVirtualMachines] List of azure resource Ids for azure + * virtual machines targeted by the software update configuration. + * @member {moment.duration} [duration] Maximum time allowed for the software + * update configuration run. Duration needs to be specified using the format + * PT[n]H[n]M[n]S as per ISO8601 */ -export interface ConnectionListResult extends Array { - nextLink?: string; +export interface CollectionItemUpdateConfiguration { + azureVirtualMachines?: string[]; + duration?: moment.Duration; } /** * @class - * Initializes a new instance of the ConnectionTypeListResult class. + * Initializes a new instance of the SoftwareUpdateConfigurationCollectionItem class. * @constructor - * The response model for the list connection type operation. + * Software update configuration collection item properties. * - * @member {string} [nextLink] Gets or sets the next link. - */ -export interface ConnectionTypeListResult extends Array { - nextLink?: string; + * @member {string} [name] Name of the software update configuration. + * @member {string} [id] Resource Id of the software update configuration + * @member {object} [updateConfiguration] Update specific properties of the + * software update configuration. + * @member {array} [updateConfiguration.azureVirtualMachines] List of azure + * resource Ids for azure virtual machines targeted by the software update + * configuration. + * @member {moment.duration} [updateConfiguration.duration] Maximum time + * allowed for the software update configuration run. Duration needs to be + * specified using the format PT[n]H[n]M[n]S as per ISO8601 + * @member {string} [frequency] execution frequency of the schedule associated + * with the software update configuration. Possible values include: 'OneTime', + * 'Day', 'Hour', 'Week', 'Month' + * @member {date} [startTime] the start time of the update. + * @member {date} [creationTime] Creation time of the software update + * configuration, which only appears in the response. + * @member {date} [lastModifiedTime] Last time software update configuration + * was modified, which only appears in the response. + * @member {string} [provisioningState] Provisioning state for the software + * update configuration, which only appears in the response. + * @member {date} [nextRun] ext run time of the update. + */ +export interface SoftwareUpdateConfigurationCollectionItem { + readonly name?: string; + readonly id?: string; + updateConfiguration?: CollectionItemUpdateConfiguration; + frequency?: string; + startTime?: Date; + readonly creationTime?: Date; + readonly lastModifiedTime?: Date; + readonly provisioningState?: string; + nextRun?: Date; } /** * @class - * Initializes a new instance of the CredentialListResult class. + * Initializes a new instance of the SoftwareUpdateConfigurationListResult class. * @constructor - * The response model for the list credential operation. + * result of listing all software update configuration * - * @member {string} [nextLink] Gets or sets the next link. + * @member {array} [value] outer object returned when listing all software + * update configurations */ -export interface CredentialListResult extends Array { - nextLink?: string; +export interface SoftwareUpdateConfigurationListResult { + value?: SoftwareUpdateConfigurationCollectionItem[]; } /** * @class - * Initializes a new instance of the DscCompilationJobListResult class. + * Initializes a new instance of the UpdateConfigurationNavigation class. * @constructor - * The response model for the list job operation. + * Software update configuration Run Navigation model. * - * @member {string} [nextLink] Gets or sets the next link. + * @member {string} [name] Name of the software update configuration triggered + * the software update configuration run */ -export interface DscCompilationJobListResult extends Array { - nextLink?: string; +export interface UpdateConfigurationNavigation { + readonly name?: string; } /** * @class - * Initializes a new instance of the DscConfigurationListResult class. + * Initializes a new instance of the JobNavigation class. * @constructor - * The response model for the list configuration operation. + * Software update configuration machine run job navigation properties. * - * @member {string} [nextLink] Gets or sets the next link. + * @member {string} [id] Id of the job associated with the software update + * configuration run */ -export interface DscConfigurationListResult extends Array { - nextLink?: string; +export interface JobNavigation { + readonly id?: string; } /** * @class - * Initializes a new instance of the DscNodeListResult class. + * Initializes a new instance of the SoftwareUpdateConfigurationRun class. + * @constructor + * Software update configuration Run properties. + * + * @member {string} [name] Name of the software update configuration run. + * @member {string} [id] Resource Id of the software update configuration run + * @member {object} [softwareUpdateConfiguration] software update configuration + * triggered this run + * @member {string} [softwareUpdateConfiguration.name] Name of the software + * update configuration triggered the software update configuration run + * @member {string} [status] Status of the software update configuration run. + * @member {string} [configuredDuration] configured duration for the software + * update configuration run. + * @member {string} [osType] Operating system target of the software update + * configuration triggered this run + * @member {date} [startTime] Etart time of the software update configuration + * run. + * @member {date} [endTime] End time of the software update configuration run. + * @member {number} [computerCount] Number of computers in the software update + * configuration run. + * @member {number} [failedCount] Number of computers with failed status. + * @member {date} [creationTime] Creation time of theresource, which only + * appears in the response. + * @member {string} [createdBy] createdBy property, which only appears in the + * response. + * @member {date} [lastModifiedTime] Last time resource was modified, which + * only appears in the response. + * @member {string} [lastModifiedBy] lastModifiedBy property, which only + * appears in the response. + */ +export interface SoftwareUpdateConfigurationRun { + readonly name?: string; + readonly id?: string; + softwareUpdateConfiguration?: UpdateConfigurationNavigation; + readonly status?: string; + readonly configuredDuration?: string; + readonly osType?: string; + readonly startTime?: Date; + readonly endTime?: Date; + readonly computerCount?: number; + readonly failedCount?: number; + readonly creationTime?: Date; + readonly createdBy?: string; + readonly lastModifiedTime?: Date; + readonly lastModifiedBy?: string; +} + +/** + * @class + * Initializes a new instance of the SoftwareUpdateConfigurationRunListResult class. * @constructor - * The response model for the list dsc nodes operation. + * result of listing all software update configuration runs + * + * @member {array} [value] outer object returned when listing all software + * update configuration runs + * @member {string} [nextLink] link to next page of results. + */ +export interface SoftwareUpdateConfigurationRunListResult { + value?: SoftwareUpdateConfigurationRun[]; + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the SoftwareUpdateConfigurationMachineRun class. + * @constructor + * Software update configuration machine run model. + * + * @member {string} [name] Name of the software update configuration machine + * run + * @member {string} [id] Resource Id of the software update configuration + * machine run + * @member {string} [targetComputer] name of the updated computer + * @member {string} [targetComputerType] type of the updated computer. + * @member {object} [softwareUpdateConfiguration] software update configuration + * triggered this run + * @member {string} [softwareUpdateConfiguration.name] Name of the software + * update configuration triggered the software update configuration run + * @member {string} [status] Status of the software update configuration + * machine run. + * @member {string} [osType] Operating system target of the software update + * configuration triggered this run + * @member {uuid} [correlationId] correlation id of the software update + * configuration machine run + * @member {uuid} [sourceComputerId] source computer id of the software update + * configuration machine run + * @member {date} [startTime] Start time of the software update configuration + * machine run. + * @member {date} [endTime] End time of the software update configuration + * machine run. + * @member {string} [configuredDuration] configured duration for the software + * update configuration run. + * @member {object} [job] Job associated with the software update configuration + * machine run + * @member {string} [job.id] Id of the job associated with the software update + * configuration run + * @member {date} [creationTime] Creation time of theresource, which only + * appears in the response. + * @member {string} [createdBy] createdBy property, which only appears in the + * response. + * @member {date} [lastModifiedTime] Last time resource was modified, which + * only appears in the response. + * @member {string} [lastModifiedBy] lastModifiedBy property, which only + * appears in the response. + */ +export interface SoftwareUpdateConfigurationMachineRun { + readonly name?: string; + readonly id?: string; + readonly targetComputer?: string; + readonly targetComputerType?: string; + softwareUpdateConfiguration?: UpdateConfigurationNavigation; + readonly status?: string; + readonly osType?: string; + readonly correlationId?: string; + readonly sourceComputerId?: string; + readonly startTime?: Date; + readonly endTime?: Date; + readonly configuredDuration?: string; + job?: JobNavigation; + readonly creationTime?: Date; + readonly createdBy?: string; + readonly lastModifiedTime?: Date; + readonly lastModifiedBy?: string; +} + +/** + * @class + * Initializes a new instance of the SoftwareUpdateConfigurationMachineRunListResult class. + * @constructor + * result of listing all software update configuration machine runs + * + * @member {array} [value] outer object returned when listing all software + * update configuration machine runs + * @member {string} [nextLink] link to next page of results. + */ +export interface SoftwareUpdateConfigurationMachineRunListResult { + value?: SoftwareUpdateConfigurationMachineRun[]; + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the SourceControlCreateOrUpdateParameters class. + * @constructor + * The parameters supplied to the create or update source control operation. + * + * @member {string} [repoUrl] Gets or sets the repo url of the source control. + * @member {string} [branch] Gets or sets the repo branch of the source + * control. Include branch as empty string for VsoTfvc. + * @member {string} [folderPath] Gets or sets the folder path of the source + * control. Path must be relative. + * @member {boolean} [autoSync] Gets or sets auto async of the source control. + * Default is false. + * @member {boolean} [publishRunbook] Gets or sets the auto publish of the + * source control. Default is true. + * @member {string} [sourceType] The source type. Must be one of VsoGit, + * VsoTfvc, GitHub, case sensitive. Possible values include: 'VsoGit', + * 'VsoTfvc', 'GitHub' + * @member {string} [securityToken] Gets or sets the authorization token for + * the repo of the source control. + * @member {string} [description] Gets or sets the user description of the + * source control. + */ +export interface SourceControlCreateOrUpdateParameters { + repoUrl?: string; + branch?: string; + folderPath?: string; + autoSync?: boolean; + publishRunbook?: boolean; + sourceType?: string; + securityToken?: string; + description?: string; +} + +/** + * @class + * Initializes a new instance of the SourceControl class. + * @constructor + * Definition of the source control. + * + * @member {string} [name] Resource name. + * @member {string} [id] Resource Id. + * @member {string} [type] Resource type. + * @member {string} [repoUrl] Gets or sets the repo url of the source control. + * @member {string} [branch] Gets or sets the repo branch of the source + * control. Include branch as empty string for VsoTfvc. + * @member {string} [folderPath] Gets or sets the folder path of the source + * control. + * @member {boolean} [autoSync] Gets or sets auto async of the source control. + * Default is false. + * @member {boolean} [publishRunbook] Gets or sets the auto publish of the + * source control. Default is true. + * @member {string} [sourceType] The source type. Must be one of VsoGit, + * VsoTfvc, GitHub. Possible values include: 'VsoGit', 'VsoTfvc', 'GitHub' + * @member {string} [description] Gets or sets the description. + * @member {date} [creationTime] Gets or sets the creation time. + * @member {date} [lastModifiedTime] Gets or sets the last modified time. + */ +export interface SourceControl extends BaseResource { + readonly name?: string; + readonly id?: string; + readonly type?: string; + repoUrl?: string; + branch?: string; + folderPath?: string; + autoSync?: boolean; + publishRunbook?: boolean; + sourceType?: string; + description?: string; + creationTime?: Date; + lastModifiedTime?: Date; +} + +/** + * @class + * Initializes a new instance of the SourceControlUpdateParameters class. + * @constructor + * The parameters supplied to the update source control operation. + * + * @member {string} [branch] Gets or sets the repo branch of the source + * control. + * @member {string} [folderPath] Gets or sets the folder path of the source + * control. Path must be relative. + * @member {boolean} [autoSync] Gets or sets auto async of the source control. + * Default is false. + * @member {boolean} [publishRunbook] Gets or sets the auto publish of the + * source control. Default is true. + * @member {string} [securityToken] Gets or sets the authorization token for + * the repo of the source control. + * @member {string} [description] Gets or sets the user description of the + * source control. + */ +export interface SourceControlUpdateParameters { + branch?: string; + folderPath?: string; + autoSync?: boolean; + publishRunbook?: boolean; + securityToken?: string; + description?: string; +} + +/** + * @class + * Initializes a new instance of the SourceControlSyncJob class. + * @constructor + * Definition of the source control sync job. + * + * @member {string} [name] Resource name. + * @member {string} [type] Resource type. + * @member {string} [id] Resource id. + * @member {string} [sourceControlSyncJobId] Gets the source control sync job + * id. + * @member {date} [creationTime] Gets the creation time of the job. + * @member {string} [provisioningState] Gets the provisioning state of the job. + * Possible values include: 'Completed', 'Failed', 'Running' + * @member {date} [startTime] Gets the start time of the job. + * @member {date} [endTime] Gets the end time of the job. + * @member {string} [startedBy] Gets the user who started the sync job. + */ +export interface SourceControlSyncJob { + readonly name?: string; + readonly type?: string; + readonly id?: string; + sourceControlSyncJobId?: string; + readonly creationTime?: Date; + provisioningState?: string; + readonly startTime?: Date; + readonly endTime?: Date; + startedBy?: string; +} + +/** + * @class + * Initializes a new instance of the SourceControlSyncJobByIdErrors class. + * @constructor + * Error details of the source control sync job. + * + * @member {string} [code] Gets the error code for the job. + * @member {string} [message] Gets the error message for the job. + */ +export interface SourceControlSyncJobByIdErrors { + code?: string; + message?: string; +} + +/** + * @class + * Initializes a new instance of the SourceControlSyncJobById class. + * @constructor + * Definition of the source control sync job. + * + * @member {string} [id] Gets the id of the job. + * @member {string} [sourceControlSyncJobId] Gets the source control sync job + * id. + * @member {date} [creationTime] Gets the creation time of the job. + * @member {string} [provisioningState] Gets the provisioning state of the job. + * Possible values include: 'Completed', 'Failed', 'Running' + * @member {date} [startTime] Gets the start time of the job. + * @member {date} [endTime] Gets the end time of the job. + * @member {string} [startedBy] Gets the user who started the sync job. + * @member {object} [errors] Error details of the source control sync job. + * @member {string} [errors.code] Gets the error code for the job. + * @member {string} [errors.message] Gets the error message for the job. + */ +export interface SourceControlSyncJobById { + id?: string; + sourceControlSyncJobId?: string; + readonly creationTime?: Date; + provisioningState?: string; + readonly startTime?: Date; + readonly endTime?: Date; + startedBy?: string; + errors?: SourceControlSyncJobByIdErrors; +} + +/** + * @class + * Initializes a new instance of the DscNode class. + * @constructor + * Definition of a DscNode + * + * @member {date} [lastSeen] Gets or sets the last seen time of the node. + * @member {date} [registrationTime] Gets or sets the registration time of the + * node. + * @member {string} [ip] Gets or sets the ip of the node. + * @member {string} [accountId] Gets or sets the account id of the node. + * @member {string} [dscNodeName] Gets or sets the name of the dsc + * nodeconfiguration. + * @member {string} [status] Gets or sets the status of the node. + * @member {string} [nodeId] Gets or sets the node id. + * @member {string} [etag] Gets or sets the etag of the resource. + * @member {array} [extensionHandler] Gets or sets the list of extensionHandler + * properties for a Node. + */ +export interface DscNode extends ProxyResource { + lastSeen?: Date; + registrationTime?: Date; + ip?: string; + accountId?: string; + dscNodeName?: string; + status?: string; + nodeId?: string; + etag?: string; + extensionHandler?: DscNodeExtensionHandlerAssociationProperty[]; +} + +/** + * @class + * Initializes a new instance of the DscNodeConfiguration class. + * @constructor + * Definition of the dsc node configuration. + * + * @member {date} [lastModifiedTime] Gets or sets the last modified time. + * @member {date} [creationTime] Gets or sets creation time. + * @member {object} [configuration] Gets or sets the configuration of the node. + * @member {string} [configuration.name] Gets or sets the name of the Dsc + * configuration. + * @member {string} [source] Source of node configuration. + * @member {number} [nodeCount] Number of nodes with this nodeconfiguration + * assigned + * @member {boolean} [incrementNodeConfigurationBuild] If a new build version + * of NodeConfiguration is required. + */ +export interface DscNodeConfiguration extends ProxyResource { + lastModifiedTime?: Date; + creationTime?: Date; + configuration?: DscConfigurationAssociationProperty; + source?: string; + nodeCount?: number; + incrementNodeConfigurationBuild?: boolean; +} + +/** + * @class + * Initializes a new instance of the DscNodeConfigurationCreateOrUpdateParametersProperties class. + * @constructor + * The parameters supplied to the create or update node configuration + * operation. + * + * @member {object} source Gets or sets the source. + * @member {object} [source.hash] Gets or sets the hash. + * @member {string} [source.hash.algorithm] Gets or sets the content hash + * algorithm used to hash the content. + * @member {string} [source.hash.value] Gets or sets expected hash value of the + * content. + * @member {string} [source.type] Gets or sets the content source type. + * Possible values include: 'embeddedContent', 'uri' + * @member {string} [source.value] Gets or sets the value of the content. This + * is based on the content source type. + * @member {string} [source.version] Gets or sets the version of the content. + * @member {string} name Gets or sets the type of the parameter. + * @member {object} configuration Gets or sets the configuration of the node. + * @member {string} [configuration.name] Gets or sets the name of the Dsc + * configuration. + * @member {boolean} [incrementNodeConfigurationBuild] If a new build version + * of NodeConfiguration is required. + */ +export interface DscNodeConfigurationCreateOrUpdateParametersProperties { + source: ContentSource; + name: string; + configuration: DscConfigurationAssociationProperty; + incrementNodeConfigurationBuild?: boolean; +} + + +/** + * @class + * Initializes a new instance of the AutomationAccountListResult class. + * @constructor + * The response model for the list account operation. * * @member {string} [nextLink] Gets or sets the next link. */ -export interface DscNodeListResult extends Array { +export interface AutomationAccountListResult extends Array { nextLink?: string; } /** * @class - * Initializes a new instance of the DscNodeReportListResult class. + * Initializes a new instance of the OperationListResult class. * @constructor - * The response model for the list dsc nodes operation. + * The response model for the list of Automation operations + * + */ +export interface OperationListResult extends Array { +} + +/** + * @class + * Initializes a new instance of the StatisticsListResult class. + * @constructor + * The response model for the list statistics operation. + * + */ +export interface StatisticsListResult extends Array { +} + +/** + * @class + * Initializes a new instance of the UsageListResult class. + * @constructor + * The response model for the get usage operation. + * + */ +export interface UsageListResult extends Array { +} + +/** + * @class + * Initializes a new instance of the KeyListResult class. + * @constructor + */ +export interface KeyListResult extends Array { +} + +/** + * @class + * Initializes a new instance of the CertificateListResult class. + * @constructor + * The response model for the list certificate operation. * * @member {string} [nextLink] Gets or sets the next link. */ -export interface DscNodeReportListResult extends Array { +export interface CertificateListResult extends Array { nextLink?: string; } /** * @class - * Initializes a new instance of the DscNodeConfigurationListResult class. + * Initializes a new instance of the ConnectionListResult class. * @constructor - * The response model for the list job operation. + * The response model for the list connection operation. * * @member {string} [nextLink] Gets or sets the next link. */ -export interface DscNodeConfigurationListResult extends Array { +export interface ConnectionListResult extends Array { nextLink?: string; } /** * @class - * Initializes a new instance of the HybridRunbookWorkerGroupsListResult class. + * Initializes a new instance of the ConnectionTypeListResult class. * @constructor - * The response model for the list hybrid runbook worker groups. + * The response model for the list connection type operation. * * @member {string} [nextLink] Gets or sets the next link. */ -export interface HybridRunbookWorkerGroupsListResult extends Array { +export interface ConnectionTypeListResult extends Array { nextLink?: string; } /** * @class - * Initializes a new instance of the JobListResult class. + * Initializes a new instance of the CredentialListResult class. * @constructor - * The response model for the list job operation. + * The response model for the list credential operation. * * @member {string} [nextLink] Gets or sets the next link. */ -export interface JobListResult extends Array { +export interface CredentialListResult extends Array { nextLink?: string; } /** * @class - * Initializes a new instance of the JobStreamListResult class. + * Initializes a new instance of the DscConfigurationListResult class. * @constructor - * The response model for the list job stream operation. + * The response model for the list configuration operation. * * @member {string} [nextLink] Gets or sets the next link. */ -export interface JobStreamListResult extends Array { +export interface DscConfigurationListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the HybridRunbookWorkerGroupsListResult class. + * @constructor + * The response model for the list hybrid runbook worker groups. + * + * @member {string} [nextLink] Gets or sets the next link. + */ +export interface HybridRunbookWorkerGroupsListResult extends Array { nextLink?: string; } @@ -2432,6 +3218,18 @@ export interface RunbookListResult extends Array { nextLink?: string; } +/** + * @class + * Initializes a new instance of the JobStreamListResult class. + * @constructor + * The response model for the list job stream operation. + * + * @member {string} [nextLink] Gets or sets the next link. + */ +export interface JobStreamListResult extends Array { + nextLink?: string; +} + /** * @class * Initializes a new instance of the ScheduleListResult class. @@ -2467,3 +3265,87 @@ export interface VariableListResult extends Array { export interface WebhookListResult extends Array { nextLink?: string; } + +/** + * @class + * Initializes a new instance of the SourceControlListResult class. + * @constructor + * The response model for the list source controls operation. + * + * @member {string} [nextLink] Gets or sets the next link. + */ +export interface SourceControlListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the SourceControlSyncJobListResult class. + * @constructor + * The response model for the list source control sync jobs operation. + * + * @member {string} [nextLink] Gets or sets the next link. + */ +export interface SourceControlSyncJobListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the JobListResultV2 class. + * @constructor + * The response model for the list job operation. + * + * @member {string} [nextLink] The link to the next page. + */ +export interface JobListResultV2 extends Array { + readonly nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the DscNodeListResult class. + * @constructor + * The response model for the list dsc nodes operation. + * + * @member {string} [nextLink] Gets or sets the next link. + */ +export interface DscNodeListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the DscNodeReportListResult class. + * @constructor + * The response model for the list dsc nodes operation. + * + * @member {string} [nextLink] Gets or sets the next link. + */ +export interface DscNodeReportListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the DscCompilationJobListResult class. + * @constructor + * The response model for the list job operation. + * + * @member {string} [nextLink] Gets or sets the next link. + */ +export interface DscCompilationJobListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the DscNodeConfigurationListResult class. + * @constructor + * The response model for the list job operation. + * + * @member {string} [nextLink] Gets or sets the next link. + */ +export interface DscNodeConfigurationListResult extends Array { + nextLink?: string; +} diff --git a/lib/services/automationManagement/lib/models/index.js b/lib/services/automationManagement/lib/models/index.js index 8d66af1839..30ffdfbf07 100644 --- a/lib/services/automationManagement/lib/models/index.js +++ b/lib/services/automationManagement/lib/models/index.js @@ -19,19 +19,30 @@ var msRestAzure = require('ms-rest-azure'); exports.BaseResource = msRestAzure.BaseResource; exports.CloudError = msRestAzure.CloudError; exports.ErrorResponse = require('./errorResponse'); +exports.Key = require('./key'); exports.UsageCounterName = require('./usageCounterName'); exports.Usage = require('./usage'); exports.Statistics = require('./statistics'); +exports.RunbookAssociationProperty = require('./runbookAssociationProperty'); +exports.Resource = require('./resource'); +exports.ProxyResource = require('./proxyResource'); +exports.Webhook = require('./webhook'); +exports.Variable = require('./variable'); +exports.JobProvisioningStateProperty = require('./jobProvisioningStateProperty'); +exports.DscConfigurationAssociationProperty = require('./dscConfigurationAssociationProperty'); +exports.DscCompilationJob = require('./dscCompilationJob'); +exports.Credential = require('./credential'); +exports.ConnectionTypeAssociationProperty = require('./connectionTypeAssociationProperty'); +exports.Connection = require('./connection'); +exports.Certificate = require('./certificate'); exports.RunbookParameter = require('./runbookParameter'); exports.ContentHash = require('./contentHash'); exports.ContentLink = require('./contentLink'); exports.RunbookDraft = require('./runbookDraft'); -exports.Resource = require('./resource'); +exports.TrackedResource = require('./trackedResource'); exports.Runbook = require('./runbook'); exports.ModuleErrorInfo = require('./moduleErrorInfo'); exports.Module = require('./module'); -exports.DscNodeConfigurationAssociationProperty = require('./dscNodeConfigurationAssociationProperty'); -exports.DscNode = require('./dscNode'); exports.ContentSource = require('./contentSource'); exports.DscConfigurationParameter = require('./dscConfigurationParameter'); exports.DscConfiguration = require('./dscConfiguration'); @@ -41,17 +52,13 @@ exports.OperationDisplay = require('./operationDisplay'); exports.Operation = require('./operation'); exports.AutomationAccountCreateOrUpdateParameters = require('./automationAccountCreateOrUpdateParameters'); exports.AutomationAccountUpdateParameters = require('./automationAccountUpdateParameters'); -exports.Certificate = require('./certificate'); exports.CertificateUpdateParameters = require('./certificateUpdateParameters'); exports.CertificateCreateOrUpdateParameters = require('./certificateCreateOrUpdateParameters'); -exports.ConnectionTypeAssociationProperty = require('./connectionTypeAssociationProperty'); -exports.Connection = require('./connection'); exports.ConnectionUpdateParameters = require('./connectionUpdateParameters'); exports.ConnectionCreateOrUpdateParameters = require('./connectionCreateOrUpdateParameters'); exports.FieldDefinition = require('./fieldDefinition'); exports.ConnectionType = require('./connectionType'); exports.ConnectionTypeCreateOrUpdateParameters = require('./connectionTypeCreateOrUpdateParameters'); -exports.Credential = require('./credential'); exports.CredentialUpdateParameters = require('./credentialUpdateParameters'); exports.CredentialCreateOrUpdateParameters = require('./credentialCreateOrUpdateParameters'); exports.ActivityParameter = require('./activityParameter'); @@ -63,13 +70,14 @@ exports.AdvancedSchedule = require('./advancedSchedule'); exports.AgentRegistrationKeys = require('./agentRegistrationKeys'); exports.AgentRegistration = require('./agentRegistration'); exports.AgentRegistrationRegenerateKeyParameter = require('./agentRegistrationRegenerateKeyParameter'); -exports.DscConfigurationAssociationProperty = require('./dscConfigurationAssociationProperty'); exports.DscCompilationJobCreateParameters = require('./dscCompilationJobCreateParameters'); -exports.DscCompilationJob = require('./dscCompilationJob'); exports.DscConfigurationCreateOrUpdateParameters = require('./dscConfigurationCreateOrUpdateParameters'); +exports.DscConfigurationUpdateParameters = require('./dscConfigurationUpdateParameters'); exports.DscMetaConfiguration = require('./dscMetaConfiguration'); exports.DscNodeConfigurationCreateOrUpdateParameters = require('./dscNodeConfigurationCreateOrUpdateParameters'); -exports.DscNodeConfiguration = require('./dscNodeConfiguration'); +exports.DscNodeConfigurationAssociationProperty = require('./dscNodeConfigurationAssociationProperty'); +exports.DscNodeExtensionHandlerAssociationProperty = require('./dscNodeExtensionHandlerAssociationProperty'); +exports.DscNodeUpdateParametersProperties = require('./dscNodeUpdateParametersProperties'); exports.DscNodeUpdateParameters = require('./dscNodeUpdateParameters'); exports.DscReportError = require('./dscReportError'); exports.DscReportResourceNavigation = require('./dscReportResourceNavigation'); @@ -79,13 +87,14 @@ exports.HybridRunbookWorker = require('./hybridRunbookWorker'); exports.RunAsCredentialAssociationProperty = require('./runAsCredentialAssociationProperty'); exports.HybridRunbookWorkerGroup = require('./hybridRunbookWorkerGroup'); exports.HybridRunbookWorkerGroupUpdateParameters = require('./hybridRunbookWorkerGroupUpdateParameters'); -exports.RunbookAssociationProperty = require('./runbookAssociationProperty'); exports.Job = require('./job'); exports.JobCreateParameters = require('./jobCreateParameters'); +exports.JobListResult = require('./jobListResult'); exports.ScheduleAssociationProperty = require('./scheduleAssociationProperty'); exports.JobScheduleCreateParameters = require('./jobScheduleCreateParameters'); exports.JobSchedule = require('./jobSchedule'); exports.JobStream = require('./jobStream'); +exports.LinkedWorkspace = require('./linkedWorkspace'); exports.ModuleCreateOrUpdateParameters = require('./moduleCreateOrUpdateParameters'); exports.ModuleUpdateParameters = require('./moduleUpdateParameters'); exports.RunbookDraftUndoEditResult = require('./runbookDraftUndoEditResult'); @@ -94,6 +103,7 @@ exports.RunbookCreateOrUpdateDraftProperties = require('./runbookCreateOrUpdateD exports.RunbookCreateOrUpdateDraftParameters = require('./runbookCreateOrUpdateDraftParameters'); exports.RunbookUpdateParameters = require('./runbookUpdateParameters'); exports.ScheduleCreateOrUpdateParameters = require('./scheduleCreateOrUpdateParameters'); +exports.ScheduleProperties = require('./scheduleProperties'); exports.Schedule = require('./schedule'); exports.ScheduleUpdateParameters = require('./scheduleUpdateParameters'); exports.SubResource = require('./subResource'); @@ -101,32 +111,56 @@ exports.TestJobCreateParameters = require('./testJobCreateParameters'); exports.TestJob = require('./testJob'); exports.TypeField = require('./typeField'); exports.VariableCreateOrUpdateParameters = require('./variableCreateOrUpdateParameters'); -exports.Variable = require('./variable'); exports.VariableUpdateParameters = require('./variableUpdateParameters'); exports.WebhookCreateOrUpdateParameters = require('./webhookCreateOrUpdateParameters'); -exports.Webhook = require('./webhook'); exports.WebhookUpdateParameters = require('./webhookUpdateParameters'); +exports.JobCollectionItem = require('./jobCollectionItem'); +exports.WindowsProperties = require('./windowsProperties'); +exports.LinuxProperties = require('./linuxProperties'); +exports.UpdateConfiguration = require('./updateConfiguration'); +exports.SoftwareUpdateConfiguration = require('./softwareUpdateConfiguration'); +exports.CollectionItemUpdateConfiguration = require('./collectionItemUpdateConfiguration'); +exports.SoftwareUpdateConfigurationCollectionItem = require('./softwareUpdateConfigurationCollectionItem'); +exports.SoftwareUpdateConfigurationListResult = require('./softwareUpdateConfigurationListResult'); +exports.UpdateConfigurationNavigation = require('./updateConfigurationNavigation'); +exports.JobNavigation = require('./jobNavigation'); +exports.SoftwareUpdateConfigurationRun = require('./softwareUpdateConfigurationRun'); +exports.SoftwareUpdateConfigurationRunListResult = require('./softwareUpdateConfigurationRunListResult'); +exports.SoftwareUpdateConfigurationMachineRun = require('./softwareUpdateConfigurationMachineRun'); +exports.SoftwareUpdateConfigurationMachineRunListResult = require('./softwareUpdateConfigurationMachineRunListResult'); +exports.SourceControlCreateOrUpdateParameters = require('./sourceControlCreateOrUpdateParameters'); +exports.SourceControl = require('./sourceControl'); +exports.SourceControlUpdateParameters = require('./sourceControlUpdateParameters'); +exports.SourceControlSyncJob = require('./sourceControlSyncJob'); +exports.SourceControlSyncJobByIdErrors = require('./sourceControlSyncJobByIdErrors'); +exports.SourceControlSyncJobById = require('./sourceControlSyncJobById'); +exports.DscNode = require('./dscNode'); +exports.DscNodeConfiguration = require('./dscNodeConfiguration'); +exports.DscNodeConfigurationCreateOrUpdateParametersProperties = require('./dscNodeConfigurationCreateOrUpdateParametersProperties'); exports.AutomationAccountListResult = require('./automationAccountListResult'); exports.OperationListResult = require('./operationListResult'); exports.StatisticsListResult = require('./statisticsListResult'); exports.UsageListResult = require('./usageListResult'); +exports.KeyListResult = require('./keyListResult'); exports.CertificateListResult = require('./certificateListResult'); exports.ConnectionListResult = require('./connectionListResult'); exports.ConnectionTypeListResult = require('./connectionTypeListResult'); exports.CredentialListResult = require('./credentialListResult'); -exports.DscCompilationJobListResult = require('./dscCompilationJobListResult'); exports.DscConfigurationListResult = require('./dscConfigurationListResult'); -exports.DscNodeListResult = require('./dscNodeListResult'); -exports.DscNodeReportListResult = require('./dscNodeReportListResult'); -exports.DscNodeConfigurationListResult = require('./dscNodeConfigurationListResult'); exports.HybridRunbookWorkerGroupsListResult = require('./hybridRunbookWorkerGroupsListResult'); -exports.JobListResult = require('./jobListResult'); -exports.JobStreamListResult = require('./jobStreamListResult'); exports.JobScheduleListResult = require('./jobScheduleListResult'); exports.ActivityListResult = require('./activityListResult'); exports.ModuleListResult = require('./moduleListResult'); exports.TypeFieldListResult = require('./typeFieldListResult'); exports.RunbookListResult = require('./runbookListResult'); +exports.JobStreamListResult = require('./jobStreamListResult'); exports.ScheduleListResult = require('./scheduleListResult'); exports.VariableListResult = require('./variableListResult'); exports.WebhookListResult = require('./webhookListResult'); +exports.SourceControlListResult = require('./sourceControlListResult'); +exports.SourceControlSyncJobListResult = require('./sourceControlSyncJobListResult'); +exports.JobListResultV2 = require('./jobListResultV2'); +exports.DscNodeListResult = require('./dscNodeListResult'); +exports.DscNodeReportListResult = require('./dscNodeReportListResult'); +exports.DscCompilationJobListResult = require('./dscCompilationJobListResult'); +exports.DscNodeConfigurationListResult = require('./dscNodeConfigurationListResult'); diff --git a/lib/services/automationManagement/lib/models/job.js b/lib/services/automationManagement/lib/models/job.js index 55e6058256..b75467cfad 100644 --- a/lib/services/automationManagement/lib/models/job.js +++ b/lib/services/automationManagement/lib/models/job.js @@ -15,11 +15,11 @@ const models = require('./index'); /** * Definition of the job. * + * @extends models['ProxyResource'] */ -class Job { +class Job extends models['ProxyResource'] { /** * Create a Job. - * @member {string} [id] Gets or sets the id of the resource. * @member {object} [runbook] Gets or sets the runbook. * @member {string} [runbook.name] Gets or sets the name of the runbook. * @member {string} [startedBy] Gets or sets the job started by. @@ -41,8 +41,13 @@ class Job { * @member {date} [lastStatusModifiedTime] Gets or sets the last status * modified time of the job. * @member {object} [parameters] Gets or sets the parameters of the job. + * @member {object} [provisioningState] The provisioning state of a resource. + * @member {string} [provisioningState.provisioningState] The provisioning + * state of the resource. Possible values include: 'Failed', 'Succeeded', + * 'Suspended', 'Processing' */ constructor() { + super(); } /** @@ -61,11 +66,28 @@ class Job { 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' + } + }, runbook: { required: false, serializedName: 'properties.runbook', @@ -164,6 +186,14 @@ class Job { } } } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'Composite', + className: 'JobProvisioningStateProperty' + } } } } diff --git a/lib/services/automationManagement/lib/models/jobCollectionItem.js b/lib/services/automationManagement/lib/models/jobCollectionItem.js new file mode 100644 index 0000000000..cec5e91389 --- /dev/null +++ b/lib/services/automationManagement/lib/models/jobCollectionItem.js @@ -0,0 +1,153 @@ +/* + * 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'); + +/** + * Job collection item properties. + * + * @extends models['ProxyResource'] + */ +class JobCollectionItem extends models['ProxyResource'] { + /** + * Create a JobCollectionItem. + * @member {object} [runbook] The runbook association. + * @member {string} [runbook.name] Gets or sets the name of the runbook. + * @member {uuid} [jobId] The id of the job. + * @member {date} [creationTime] The creation time of the job. + * @member {string} [status] The status of the job. Possible values include: + * 'New', 'Activating', 'Running', 'Completed', 'Failed', 'Stopped', + * 'Blocked', 'Suspended', 'Disconnected', 'Suspending', 'Stopping', + * 'Resuming', 'Removing' + * @member {date} [startTime] The start time of the job. + * @member {date} [endTime] The end time of the job. + * @member {date} [lastModifiedTime] The last modified time of the job. + * @member {object} [provisioningState] The current provisioning state of the + * job. + * @member {string} [provisioningState.provisioningState] The provisioning + * state of the resource. Possible values include: 'Failed', 'Succeeded', + * 'Suspended', 'Processing' + */ + constructor() { + super(); + } + + /** + * Defines the metadata of JobCollectionItem + * + * @returns {object} metadata of JobCollectionItem + * + */ + mapper() { + return { + required: false, + serializedName: 'JobCollectionItem', + type: { + name: 'Composite', + className: 'JobCollectionItem', + 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' + } + }, + runbook: { + required: false, + readOnly: true, + serializedName: 'properties.runbook', + type: { + name: 'Composite', + className: 'RunbookAssociationProperty' + } + }, + jobId: { + required: false, + readOnly: true, + serializedName: 'properties.jobId', + type: { + name: 'String' + } + }, + creationTime: { + required: false, + readOnly: true, + serializedName: 'properties.creationTime', + type: { + name: 'DateTime' + } + }, + status: { + required: false, + readOnly: true, + serializedName: 'properties.status', + type: { + name: 'String' + } + }, + startTime: { + required: false, + readOnly: true, + serializedName: 'properties.startTime', + type: { + name: 'DateTime' + } + }, + endTime: { + required: false, + readOnly: true, + serializedName: 'properties.endTime', + type: { + name: 'DateTime' + } + }, + lastModifiedTime: { + required: false, + readOnly: true, + serializedName: 'properties.lastModifiedTime', + type: { + name: 'DateTime' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'Composite', + className: 'JobProvisioningStateProperty' + } + } + } + } + }; + } +} + +module.exports = JobCollectionItem; diff --git a/lib/services/automationManagement/lib/models/jobCreateParameters.js b/lib/services/automationManagement/lib/models/jobCreateParameters.js index c5d34416d0..b60f054efd 100644 --- a/lib/services/automationManagement/lib/models/jobCreateParameters.js +++ b/lib/services/automationManagement/lib/models/jobCreateParameters.js @@ -24,9 +24,6 @@ class JobCreateParameters { * @member {object} [parameters] Gets or sets the parameters of the job. * @member {string} [runOn] Gets or sets the runOn which specifies the group * name where the job is to be executed. - * @member {string} [name] Gets or sets name of the resource. - * @member {string} [location] Gets or sets the location of the resource. - * @member {object} [tags] Gets or sets the tags attached to the resource. */ constructor() { } @@ -73,34 +70,6 @@ class JobCreateParameters { type: { name: 'String' } - }, - name: { - required: false, - serializedName: 'name', - 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' - } - } - } } } } diff --git a/lib/services/automationManagement/lib/models/jobListResult.js b/lib/services/automationManagement/lib/models/jobListResult.js index 0e47b41d7c..227b185fd5 100644 --- a/lib/services/automationManagement/lib/models/jobListResult.js +++ b/lib/services/automationManagement/lib/models/jobListResult.js @@ -10,16 +10,19 @@ 'use strict'; +const models = require('./index'); + /** * The response model for the list job operation. + * */ -class JobListResult extends Array { +class JobListResult { /** * Create a JobListResult. + * @member {array} [value] Gets or sets a list of jobs. * @member {string} [nextLink] Gets or sets the next link. */ constructor() { - super(); } /** @@ -38,7 +41,7 @@ class JobListResult extends Array { modelProperties: { value: { required: false, - serializedName: '', + serializedName: 'value', type: { name: 'Sequence', element: { diff --git a/lib/services/automationManagement/lib/models/jobListResultV2.js b/lib/services/automationManagement/lib/models/jobListResultV2.js new file mode 100644 index 0000000000..7124a7c22b --- /dev/null +++ b/lib/services/automationManagement/lib/models/jobListResultV2.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'; + +/** + * The response model for the list job operation. + */ +class JobListResultV2 extends Array { + /** + * Create a JobListResultV2. + * @member {string} [nextLink] The link to the next page. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of JobListResultV2 + * + * @returns {object} metadata of JobListResultV2 + * + */ + mapper() { + return { + required: false, + serializedName: 'JobListResultV2', + type: { + name: 'Composite', + className: 'JobListResultV2', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'JobCollectionItemElementType', + type: { + name: 'Composite', + className: 'JobCollectionItem' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = JobListResultV2; diff --git a/lib/services/automationManagement/lib/models/jobNavigation.js b/lib/services/automationManagement/lib/models/jobNavigation.js new file mode 100644 index 0000000000..a2aba8b978 --- /dev/null +++ b/lib/services/automationManagement/lib/models/jobNavigation.js @@ -0,0 +1,54 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Software update configuration machine run job navigation properties. + * + */ +class JobNavigation { + /** + * Create a JobNavigation. + * @member {string} [id] Id of the job associated with the software update + * configuration run + */ + constructor() { + } + + /** + * Defines the metadata of JobNavigation + * + * @returns {object} metadata of JobNavigation + * + */ + mapper() { + return { + required: false, + serializedName: 'jobNavigation', + type: { + name: 'Composite', + className: 'JobNavigation', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = JobNavigation; diff --git a/lib/services/automationManagement/lib/models/jobProvisioningStateProperty.js b/lib/services/automationManagement/lib/models/jobProvisioningStateProperty.js new file mode 100644 index 0000000000..07d50308d4 --- /dev/null +++ b/lib/services/automationManagement/lib/models/jobProvisioningStateProperty.js @@ -0,0 +1,55 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The provisioning state property. + * + */ +class JobProvisioningStateProperty { + /** + * Create a JobProvisioningStateProperty. + * @member {string} [provisioningState] The provisioning state of the + * resource. Possible values include: 'Failed', 'Succeeded', 'Suspended', + * 'Processing' + */ + constructor() { + } + + /** + * Defines the metadata of JobProvisioningStateProperty + * + * @returns {object} metadata of JobProvisioningStateProperty + * + */ + mapper() { + return { + required: false, + serializedName: 'JobProvisioningStateProperty', + type: { + name: 'Composite', + className: 'JobProvisioningStateProperty', + modelProperties: { + provisioningState: { + required: false, + readOnly: true, + serializedName: 'provisioningState', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = JobProvisioningStateProperty; diff --git a/lib/services/automationManagement/lib/models/jobSchedule.js b/lib/services/automationManagement/lib/models/jobSchedule.js index 791544f7da..f608fc5495 100644 --- a/lib/services/automationManagement/lib/models/jobSchedule.js +++ b/lib/services/automationManagement/lib/models/jobSchedule.js @@ -19,7 +19,9 @@ const models = require('./index'); class JobSchedule { /** * Create a JobSchedule. - * @member {string} [id] Gets or sets the id of the resource. + * @member {string} [id] Gets the id of the resource. + * @member {string} [name] Gets the name of the variable. + * @member {string} [type] Resource type * @member {string} [jobScheduleId] Gets or sets the id of job schedule. * @member {object} [schedule] Gets or sets the schedule. * @member {string} [schedule.name] Gets or sets the name of the schedule. @@ -49,11 +51,28 @@ class JobSchedule { 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' + } + }, jobScheduleId: { required: false, serializedName: 'properties.jobScheduleId', diff --git a/lib/services/automationManagement/lib/models/key.js b/lib/services/automationManagement/lib/models/key.js new file mode 100644 index 0000000000..95e57f9318 --- /dev/null +++ b/lib/services/automationManagement/lib/models/key.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'; + +/** + * Automation key which is used to register a DSC Node + * + */ +class Key { + /** + * Create a Key. + * @member {string} [keyName] Automation key name. Possible values include: + * 'primary', 'secondary' + * @member {string} [permissions] Automation key permissions. Possible values + * include: 'Full' + * @member {string} [value] Value of the Automation Key used for + * registration. + */ + constructor() { + } + + /** + * Defines the metadata of Key + * + * @returns {object} metadata of Key + * + */ + mapper() { + return { + required: false, + serializedName: 'Key', + type: { + name: 'Composite', + className: 'Key', + modelProperties: { + keyName: { + required: false, + serializedName: 'keyName', + type: { + name: 'String' + } + }, + permissions: { + required: false, + serializedName: 'permissions', + type: { + name: 'String' + } + }, + value: { + required: false, + serializedName: 'value', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Key; diff --git a/lib/services/automationManagement/lib/models/keyListResult.js b/lib/services/automationManagement/lib/models/keyListResult.js new file mode 100644 index 0000000000..3bacb69713 --- /dev/null +++ b/lib/services/automationManagement/lib/models/keyListResult.js @@ -0,0 +1,59 @@ +/* + * 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'; + +/** + * Class representing a KeyListResult. + */ +class KeyListResult extends Array { + /** + * Create a KeyListResult. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of KeyListResult + * + * @returns {object} metadata of KeyListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'KeyListResult', + type: { + name: 'Composite', + className: 'KeyListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'KeyElementType', + type: { + name: 'Composite', + className: 'Key' + } + } + } + } + } + } + }; + } +} + +module.exports = KeyListResult; diff --git a/lib/services/automationManagement/lib/models/linkedWorkspace.js b/lib/services/automationManagement/lib/models/linkedWorkspace.js new file mode 100644 index 0000000000..5daf95ac28 --- /dev/null +++ b/lib/services/automationManagement/lib/models/linkedWorkspace.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'; + +/** + * Definition of the linked workspace. + * + */ +class LinkedWorkspace { + /** + * Create a LinkedWorkspace. + * @member {string} [id] Gets the id of the linked workspace. + */ + constructor() { + } + + /** + * Defines the metadata of LinkedWorkspace + * + * @returns {object} metadata of LinkedWorkspace + * + */ + mapper() { + return { + required: false, + serializedName: 'LinkedWorkspace', + type: { + name: 'Composite', + className: 'LinkedWorkspace', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = LinkedWorkspace; diff --git a/lib/services/automationManagement/lib/models/linuxProperties.js b/lib/services/automationManagement/lib/models/linuxProperties.js new file mode 100644 index 0000000000..3e25b2be22 --- /dev/null +++ b/lib/services/automationManagement/lib/models/linuxProperties.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'; + +/** + * Linux specific update configuration. + * + */ +class LinuxProperties { + /** + * Create a LinuxProperties. + * @member {string} [includedPackageClassifications] Update classifications + * included in the software update configuration. Possible values include: + * 'Unclassified', 'Critical', 'Security', 'Other' + * @member {array} [excludedPackageNameMasks] packages excluded from the + * software update configuration. + */ + constructor() { + } + + /** + * Defines the metadata of LinuxProperties + * + * @returns {object} metadata of LinuxProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'LinuxProperties', + type: { + name: 'Composite', + className: 'LinuxProperties', + modelProperties: { + includedPackageClassifications: { + required: false, + serializedName: 'includedPackageClassifications', + type: { + name: 'String' + } + }, + excludedPackageNameMasks: { + required: false, + serializedName: 'excludedPackageNameMasks', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = LinuxProperties; diff --git a/lib/services/automationManagement/lib/models/module.js b/lib/services/automationManagement/lib/models/module.js index 10fc0236ac..0aab08f1df 100644 --- a/lib/services/automationManagement/lib/models/module.js +++ b/lib/services/automationManagement/lib/models/module.js @@ -15,9 +15,9 @@ const models = require('./index'); /** * Definition of the module type. * - * @extends models['Resource'] + * @extends models['TrackedResource'] */ -class Module extends models['Resource'] { +class Module extends models['TrackedResource'] { /** * Create a Module. * @member {boolean} [isGlobal] Gets or sets the isGlobal flag of the module. @@ -93,13 +93,6 @@ class Module extends models['Resource'] { name: 'String' } }, - location: { - required: true, - serializedName: 'location', - type: { - name: 'String' - } - }, tags: { required: false, serializedName: 'tags', @@ -114,6 +107,13 @@ class Module extends models['Resource'] { } } }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, isGlobal: { required: false, serializedName: 'properties.isGlobal', diff --git a/lib/services/automationManagement/lib/models/proxyResource.js b/lib/services/automationManagement/lib/models/proxyResource.js new file mode 100644 index 0000000000..43e93ec60e --- /dev/null +++ b/lib/services/automationManagement/lib/models/proxyResource.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'); + +/** + * The resource model definition for a ARM 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' + } + } + } + } + }; + } +} + +module.exports = ProxyResource; diff --git a/lib/services/automationManagement/lib/models/resource.js b/lib/services/automationManagement/lib/models/resource.js index 060a22878d..019725b84e 100644 --- a/lib/services/automationManagement/lib/models/resource.js +++ b/lib/services/automationManagement/lib/models/resource.js @@ -13,18 +13,16 @@ const models = require('./index'); /** - * The Resource definition. + * The core properties of ARM resources * * @extends models['BaseResource'] */ class Resource extends models['BaseResource'] { /** * Create a Resource. - * @member {string} [id] Resource Id - * @member {string} [name] Resource name - * @member {string} [type] Resource type - * @member {string} location Resource location - * @member {object} [tags] Resource tags + * @member {string} [id] Fully qualified resource Id for the resource + * @member {string} [name] The name of the resource + * @member {string} [type] The type of the resource. */ constructor() { super(); @@ -67,27 +65,6 @@ class Resource extends models['BaseResource'] { type: { name: 'String' } - }, - location: { - required: true, - serializedName: 'location', - type: { - name: 'String' - } - }, - tags: { - required: false, - serializedName: 'tags', - type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } - } } } } diff --git a/lib/services/automationManagement/lib/models/runbook.js b/lib/services/automationManagement/lib/models/runbook.js index 5d726996f6..234b38d12d 100644 --- a/lib/services/automationManagement/lib/models/runbook.js +++ b/lib/services/automationManagement/lib/models/runbook.js @@ -15,9 +15,9 @@ const models = require('./index'); /** * Definition of the runbook type. * - * @extends models['Resource'] + * @extends models['TrackedResource'] */ -class Runbook extends models['Resource'] { +class Runbook extends models['TrackedResource'] { /** * Create a Runbook. * @member {string} [runbookType] Gets or sets the type of the runbook. @@ -115,13 +115,6 @@ class Runbook extends models['Resource'] { name: 'String' } }, - location: { - required: true, - serializedName: 'location', - type: { - name: 'String' - } - }, tags: { required: false, serializedName: 'tags', @@ -136,6 +129,13 @@ class Runbook extends models['Resource'] { } } }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, runbookType: { required: false, serializedName: 'properties.runbookType', diff --git a/lib/services/automationManagement/lib/models/schedule.js b/lib/services/automationManagement/lib/models/schedule.js index ccca945bfe..37dbafbc93 100644 --- a/lib/services/automationManagement/lib/models/schedule.js +++ b/lib/services/automationManagement/lib/models/schedule.js @@ -19,8 +19,9 @@ const models = require('./index'); class Schedule { /** * Create a Schedule. - * @member {string} [id] Gets or sets the id of the resource. - * @member {string} [name] Gets or sets the name of the schedule. + * @member {string} [id] Gets the id of the resource. + * @member {string} [name] Gets name of the schedule. + * @member {string} [type] Resource type * @member {date} [startTime] Gets or sets the start time of the schedule. * @member {number} [startTimeOffsetMinutes] Gets the start time's offset in * minutes. @@ -32,7 +33,7 @@ class Schedule { * @member {date} [nextRun] Gets or sets the next run time of the schedule. * @member {number} [nextRunOffsetMinutes] Gets or sets the next run time's * offset in minutes. - * @member {object} [interval] Gets or sets the interval of the schedule. + * @member {number} [interval] Gets or sets the interval of the schedule. * @member {string} [frequency] Gets or sets the frequency of the schedule. * Possible values include: 'OneTime', 'Day', 'Hour', 'Week', 'Month' * @member {string} [timeZone] Gets or sets the time zone of the schedule. @@ -66,6 +67,7 @@ class Schedule { modelProperties: { id: { required: false, + readOnly: true, serializedName: 'id', type: { name: 'String' @@ -73,11 +75,20 @@ class Schedule { }, name: { required: false, + readOnly: true, serializedName: 'name', type: { name: 'String' } }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, startTime: { required: false, serializedName: 'properties.startTime', @@ -133,7 +144,7 @@ class Schedule { required: false, serializedName: 'properties.interval', type: { - name: 'Object' + name: 'Number' } }, frequency: { diff --git a/lib/services/automationManagement/lib/models/scheduleCreateOrUpdateParameters.js b/lib/services/automationManagement/lib/models/scheduleCreateOrUpdateParameters.js index 77c21ffb80..fd14a76bd3 100644 --- a/lib/services/automationManagement/lib/models/scheduleCreateOrUpdateParameters.js +++ b/lib/services/automationManagement/lib/models/scheduleCreateOrUpdateParameters.js @@ -25,8 +25,8 @@ class ScheduleCreateOrUpdateParameters { * @member {date} startTime Gets or sets the start time of the schedule. * @member {date} [expiryTime] Gets or sets the end time of the schedule. * @member {object} [interval] Gets or sets the interval of the schedule. - * @member {string} frequency Gets or sets the frequency of the schedule. - * Possible values include: 'OneTime', 'Day', 'Hour', 'Week', 'Month' + * @member {string} frequency Possible values include: 'OneTime', 'Day', + * 'Hour', 'Week', 'Month' * @member {string} [timeZone] Gets or sets the time zone of the schedule. * @member {object} [advancedSchedule] Gets or sets the AdvancedSchedule. * @member {array} [advancedSchedule.weekDays] Days of the week that the job diff --git a/lib/services/automationManagement/lib/models/scheduleProperties.js b/lib/services/automationManagement/lib/models/scheduleProperties.js new file mode 100644 index 0000000000..8a0efe82d1 --- /dev/null +++ b/lib/services/automationManagement/lib/models/scheduleProperties.js @@ -0,0 +1,172 @@ +/* + * 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'); + +/** + * Definition of schedule parameters. + * + */ +class ScheduleProperties { + /** + * Create a ScheduleProperties. + * @member {date} [startTime] Gets or sets the start time of the schedule. + * @member {number} [startTimeOffsetMinutes] Gets the start time's offset in + * minutes. + * @member {date} [expiryTime] Gets or sets the end time of the schedule. + * @member {number} [expiryTimeOffsetMinutes] Gets or sets the expiry time's + * offset in minutes. + * @member {boolean} [isEnabled] Gets or sets a value indicating whether this + * schedule is enabled. Default value: false . + * @member {date} [nextRun] Gets or sets the next run time of the schedule. + * @member {number} [nextRunOffsetMinutes] Gets or sets the next run time's + * offset in minutes. + * @member {number} [interval] Gets or sets the interval of the schedule. + * @member {string} [frequency] Gets or sets the frequency of the schedule. + * Possible values include: 'OneTime', 'Day', 'Hour', 'Week', 'Month' + * @member {string} [timeZone] Gets or sets the time zone of the schedule. + * @member {object} [advancedSchedule] Gets or sets the advanced schedule. + * @member {array} [advancedSchedule.weekDays] Days of the week that the job + * should execute on. + * @member {array} [advancedSchedule.monthDays] Days of the month that the + * job should execute on. Must be between 1 and 31. + * @member {array} [advancedSchedule.monthlyOccurrences] Occurrences of days + * within a month. + * @member {date} [creationTime] Gets or sets the creation time. + * @member {date} [lastModifiedTime] Gets or sets the last modified time. + * @member {string} [description] Gets or sets the description. + */ + constructor() { + } + + /** + * Defines the metadata of ScheduleProperties + * + * @returns {object} metadata of ScheduleProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'ScheduleProperties', + type: { + name: 'Composite', + className: 'ScheduleProperties', + modelProperties: { + startTime: { + required: false, + serializedName: 'startTime', + type: { + name: 'DateTime' + } + }, + startTimeOffsetMinutes: { + required: false, + readOnly: true, + serializedName: 'startTimeOffsetMinutes', + type: { + name: 'Number' + } + }, + expiryTime: { + required: false, + serializedName: 'expiryTime', + type: { + name: 'DateTime' + } + }, + expiryTimeOffsetMinutes: { + required: false, + serializedName: 'expiryTimeOffsetMinutes', + type: { + name: 'Number' + } + }, + isEnabled: { + required: false, + serializedName: 'isEnabled', + defaultValue: false, + type: { + name: 'Boolean' + } + }, + nextRun: { + required: false, + serializedName: 'nextRun', + type: { + name: 'DateTime' + } + }, + nextRunOffsetMinutes: { + required: false, + serializedName: 'nextRunOffsetMinutes', + type: { + name: 'Number' + } + }, + interval: { + required: false, + serializedName: 'interval', + type: { + name: 'Number' + } + }, + frequency: { + required: false, + serializedName: 'frequency', + type: { + name: 'String' + } + }, + timeZone: { + required: false, + serializedName: 'timeZone', + type: { + name: 'String' + } + }, + advancedSchedule: { + required: false, + serializedName: 'advancedSchedule', + type: { + name: 'Composite', + className: 'AdvancedSchedule' + } + }, + creationTime: { + required: false, + serializedName: 'creationTime', + type: { + name: 'DateTime' + } + }, + lastModifiedTime: { + required: false, + serializedName: 'lastModifiedTime', + type: { + name: 'DateTime' + } + }, + description: { + required: false, + serializedName: 'description', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ScheduleProperties; diff --git a/lib/services/automationManagement/lib/models/scheduleUpdateParameters.js b/lib/services/automationManagement/lib/models/scheduleUpdateParameters.js index 70c4a02539..26bd642bec 100644 --- a/lib/services/automationManagement/lib/models/scheduleUpdateParameters.js +++ b/lib/services/automationManagement/lib/models/scheduleUpdateParameters.js @@ -17,7 +17,7 @@ class ScheduleUpdateParameters { /** * Create a ScheduleUpdateParameters. - * @member {string} name Gets or sets the name of the schedule. + * @member {string} [name] Gets or sets the name of the schedule. * @member {string} [description] Gets or sets the description of the * schedule. * @member {boolean} [isEnabled] Gets or sets a value indicating whether this @@ -41,7 +41,7 @@ class ScheduleUpdateParameters { className: 'ScheduleUpdateParameters', modelProperties: { name: { - required: true, + required: false, serializedName: 'name', type: { name: 'String' diff --git a/lib/services/automationManagement/lib/models/softwareUpdateConfiguration.js b/lib/services/automationManagement/lib/models/softwareUpdateConfiguration.js new file mode 100644 index 0000000000..a93fc66152 --- /dev/null +++ b/lib/services/automationManagement/lib/models/softwareUpdateConfiguration.js @@ -0,0 +1,218 @@ +/* + * 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'); + +/** + * Software update configuration properties. + * + * @extends models['BaseResource'] + */ +class SoftwareUpdateConfiguration extends models['BaseResource'] { + /** + * Create a SoftwareUpdateConfiguration. + * @member {string} [name] Resource name. + * @member {string} [id] Resource Id. + * @member {string} [type] Resource type + * @member {object} updateConfiguration update specific properties for the + * Software update configuration + * @member {string} [updateConfiguration.operatingSystem] operating system of + * target machines. Possible values include: 'Windows', 'Linux' + * @member {object} [updateConfiguration.windows] Windows specific update + * configuration. + * @member {string} + * [updateConfiguration.windows.includedUpdateClassifications] Update + * classification included in the software update configuration. A comma + * separated string with required values. Possible values include: + * 'Unclassified', 'Critical', 'Security', 'UpdateRollup', 'FeaturePack', + * 'ServicePack', 'Definition', 'Tools', 'Updates' + * @member {array} [updateConfiguration.windows.excludedKbNumbers] KB numbers + * excluded from the software update configuration. + * @member {object} [updateConfiguration.linux] Linux specific update + * configuration. + * @member {string} + * [updateConfiguration.linux.includedPackageClassifications] Update + * classifications included in the software update configuration. Possible + * values include: 'Unclassified', 'Critical', 'Security', 'Other' + * @member {array} [updateConfiguration.linux.excludedPackageNameMasks] + * packages excluded from the software update configuration. + * @member {moment.duration} [updateConfiguration.duration] Maximum time + * allowed for the software update configuration run. Duration needs to be + * specified using the format PT[n]H[n]M[n]S as per ISO8601 + * @member {array} [updateConfiguration.azureVirtualMachines] List of azure + * resource Ids for azure virtual machines targeted by the software update + * configuration. + * @member {array} [updateConfiguration.nonAzureComputerNames] List of names + * of non-azure machines targeted by the software update configuration. + * @member {object} scheduleInfo Schedule information for the Software update + * configuration + * @member {date} [scheduleInfo.startTime] Gets or sets the start time of the + * schedule. + * @member {number} [scheduleInfo.startTimeOffsetMinutes] Gets the start + * time's offset in minutes. + * @member {date} [scheduleInfo.expiryTime] Gets or sets the end time of the + * schedule. + * @member {number} [scheduleInfo.expiryTimeOffsetMinutes] Gets or sets the + * expiry time's offset in minutes. + * @member {boolean} [scheduleInfo.isEnabled] Gets or sets a value indicating + * whether this schedule is enabled. + * @member {date} [scheduleInfo.nextRun] Gets or sets the next run time of + * the schedule. + * @member {number} [scheduleInfo.nextRunOffsetMinutes] Gets or sets the next + * run time's offset in minutes. + * @member {number} [scheduleInfo.interval] Gets or sets the interval of the + * schedule. + * @member {string} [scheduleInfo.frequency] Gets or sets the frequency of + * the schedule. Possible values include: 'OneTime', 'Day', 'Hour', 'Week', + * 'Month' + * @member {string} [scheduleInfo.timeZone] Gets or sets the time zone of the + * schedule. + * @member {object} [scheduleInfo.advancedSchedule] Gets or sets the advanced + * schedule. + * @member {array} [scheduleInfo.advancedSchedule.weekDays] Days of the week + * that the job should execute on. + * @member {array} [scheduleInfo.advancedSchedule.monthDays] Days of the + * month that the job should execute on. Must be between 1 and 31. + * @member {array} [scheduleInfo.advancedSchedule.monthlyOccurrences] + * Occurrences of days within a month. + * @member {date} [scheduleInfo.creationTime] Gets or sets the creation time. + * @member {date} [scheduleInfo.lastModifiedTime] Gets or sets the last + * modified time. + * @member {string} [scheduleInfo.description] Gets or sets the description. + * @member {string} [provisioningState] Provisioning state for the software + * update configuration, which only appears in the response. + * @member {object} [error] detailes of provisioning error + * @member {string} [error.code] Error code + * @member {string} [error.message] Error message indicating why the + * operation failed. + * @member {date} [creationTime] Creation time of theresource, which only + * appears in the response. + * @member {string} [createdBy] createdBy property, which only appears in the + * response. + * @member {date} [lastModifiedTime] Last time resource was modified, which + * only appears in the response. + * @member {string} [lastModifiedBy] lastModifiedBy property, which only + * appears in the response. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of SoftwareUpdateConfiguration + * + * @returns {object} metadata of SoftwareUpdateConfiguration + * + */ + mapper() { + return { + required: false, + serializedName: 'softwareUpdateConfiguration', + type: { + name: 'Composite', + className: 'SoftwareUpdateConfiguration', + modelProperties: { + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + updateConfiguration: { + required: true, + serializedName: 'properties.updateConfiguration', + type: { + name: 'Composite', + className: 'UpdateConfiguration' + } + }, + scheduleInfo: { + required: true, + serializedName: 'properties.scheduleInfo', + type: { + name: 'Composite', + className: 'ScheduleProperties' + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + error: { + required: false, + serializedName: 'properties.error', + type: { + name: 'Composite', + className: 'ErrorResponse' + } + }, + creationTime: { + required: false, + readOnly: true, + serializedName: 'properties.creationTime', + type: { + name: 'DateTime' + } + }, + createdBy: { + required: false, + readOnly: true, + serializedName: 'properties.createdBy', + type: { + name: 'String' + } + }, + lastModifiedTime: { + required: false, + readOnly: true, + serializedName: 'properties.lastModifiedTime', + type: { + name: 'DateTime' + } + }, + lastModifiedBy: { + required: false, + readOnly: true, + serializedName: 'properties.lastModifiedBy', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SoftwareUpdateConfiguration; diff --git a/lib/services/automationManagement/lib/models/softwareUpdateConfigurationCollectionItem.js b/lib/services/automationManagement/lib/models/softwareUpdateConfigurationCollectionItem.js new file mode 100644 index 0000000000..3feed65506 --- /dev/null +++ b/lib/services/automationManagement/lib/models/softwareUpdateConfigurationCollectionItem.js @@ -0,0 +1,136 @@ +/* + * 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'); + +/** + * Software update configuration collection item properties. + * + */ +class SoftwareUpdateConfigurationCollectionItem { + /** + * Create a SoftwareUpdateConfigurationCollectionItem. + * @member {string} [name] Name of the software update configuration. + * @member {string} [id] Resource Id of the software update configuration + * @member {object} [updateConfiguration] Update specific properties of the + * software update configuration. + * @member {array} [updateConfiguration.azureVirtualMachines] List of azure + * resource Ids for azure virtual machines targeted by the software update + * configuration. + * @member {moment.duration} [updateConfiguration.duration] Maximum time + * allowed for the software update configuration run. Duration needs to be + * specified using the format PT[n]H[n]M[n]S as per ISO8601 + * @member {string} [frequency] execution frequency of the schedule + * associated with the software update configuration. Possible values + * include: 'OneTime', 'Day', 'Hour', 'Week', 'Month' + * @member {date} [startTime] the start time of the update. + * @member {date} [creationTime] Creation time of the software update + * configuration, which only appears in the response. + * @member {date} [lastModifiedTime] Last time software update configuration + * was modified, which only appears in the response. + * @member {string} [provisioningState] Provisioning state for the software + * update configuration, which only appears in the response. + * @member {date} [nextRun] ext run time of the update. + */ + constructor() { + } + + /** + * Defines the metadata of SoftwareUpdateConfigurationCollectionItem + * + * @returns {object} metadata of SoftwareUpdateConfigurationCollectionItem + * + */ + mapper() { + return { + required: false, + serializedName: 'softwareUpdateConfigurationCollectionItem', + type: { + name: 'Composite', + className: 'SoftwareUpdateConfigurationCollectionItem', + modelProperties: { + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + updateConfiguration: { + required: false, + serializedName: 'properties.updateConfiguration', + type: { + name: 'Composite', + className: 'CollectionItemUpdateConfiguration' + } + }, + frequency: { + required: false, + serializedName: 'properties.frequency', + type: { + name: 'String' + } + }, + startTime: { + required: false, + serializedName: 'properties.startTime', + type: { + name: 'DateTime' + } + }, + creationTime: { + required: false, + readOnly: true, + serializedName: 'properties.creationTime', + type: { + name: 'DateTime' + } + }, + lastModifiedTime: { + required: false, + readOnly: true, + serializedName: 'properties.lastModifiedTime', + type: { + name: 'DateTime' + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + nextRun: { + required: false, + serializedName: 'properties.nextRun', + type: { + name: 'DateTime' + } + } + } + } + }; + } +} + +module.exports = SoftwareUpdateConfigurationCollectionItem; diff --git a/lib/services/automationManagement/lib/models/softwareUpdateConfigurationListResult.js b/lib/services/automationManagement/lib/models/softwareUpdateConfigurationListResult.js new file mode 100644 index 0000000000..74f8890db3 --- /dev/null +++ b/lib/services/automationManagement/lib/models/softwareUpdateConfigurationListResult.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'; + +const models = require('./index'); + +/** + * result of listing all software update configuration + * + */ +class SoftwareUpdateConfigurationListResult { + /** + * Create a SoftwareUpdateConfigurationListResult. + * @member {array} [value] outer object returned when listing all software + * update configurations + */ + constructor() { + } + + /** + * Defines the metadata of SoftwareUpdateConfigurationListResult + * + * @returns {object} metadata of SoftwareUpdateConfigurationListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'softwareUpdateConfigurationListResult', + type: { + name: 'Composite', + className: 'SoftwareUpdateConfigurationListResult', + modelProperties: { + value: { + required: false, + serializedName: 'value', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SoftwareUpdateConfigurationCollectionItemElementType', + type: { + name: 'Composite', + className: 'SoftwareUpdateConfigurationCollectionItem' + } + } + } + } + } + } + }; + } +} + +module.exports = SoftwareUpdateConfigurationListResult; diff --git a/lib/services/automationManagement/lib/models/softwareUpdateConfigurationMachineRun.js b/lib/services/automationManagement/lib/models/softwareUpdateConfigurationMachineRun.js new file mode 100644 index 0000000000..0220b60692 --- /dev/null +++ b/lib/services/automationManagement/lib/models/softwareUpdateConfigurationMachineRun.js @@ -0,0 +1,218 @@ +/* + * 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'); + +/** + * Software update configuration machine run model. + * + */ +class SoftwareUpdateConfigurationMachineRun { + /** + * Create a SoftwareUpdateConfigurationMachineRun. + * @member {string} [name] Name of the software update configuration machine + * run + * @member {string} [id] Resource Id of the software update configuration + * machine run + * @member {string} [targetComputer] name of the updated computer + * @member {string} [targetComputerType] type of the updated computer. + * @member {object} [softwareUpdateConfiguration] software update + * configuration triggered this run + * @member {string} [softwareUpdateConfiguration.name] Name of the software + * update configuration triggered the software update configuration run + * @member {string} [status] Status of the software update configuration + * machine run. + * @member {string} [osType] Operating system target of the software update + * configuration triggered this run + * @member {uuid} [correlationId] correlation id of the software update + * configuration machine run + * @member {uuid} [sourceComputerId] source computer id of the software + * update configuration machine run + * @member {date} [startTime] Start time of the software update configuration + * machine run. + * @member {date} [endTime] End time of the software update configuration + * machine run. + * @member {string} [configuredDuration] configured duration for the software + * update configuration run. + * @member {object} [job] Job associated with the software update + * configuration machine run + * @member {string} [job.id] Id of the job associated with the software + * update configuration run + * @member {date} [creationTime] Creation time of theresource, which only + * appears in the response. + * @member {string} [createdBy] createdBy property, which only appears in the + * response. + * @member {date} [lastModifiedTime] Last time resource was modified, which + * only appears in the response. + * @member {string} [lastModifiedBy] lastModifiedBy property, which only + * appears in the response. + */ + constructor() { + } + + /** + * Defines the metadata of SoftwareUpdateConfigurationMachineRun + * + * @returns {object} metadata of SoftwareUpdateConfigurationMachineRun + * + */ + mapper() { + return { + required: false, + serializedName: 'softwareUpdateConfigurationMachineRun', + type: { + name: 'Composite', + className: 'SoftwareUpdateConfigurationMachineRun', + modelProperties: { + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + targetComputer: { + required: false, + readOnly: true, + serializedName: 'properties.targetComputer', + type: { + name: 'String' + } + }, + targetComputerType: { + required: false, + readOnly: true, + serializedName: 'properties.targetComputerType', + type: { + name: 'String' + } + }, + softwareUpdateConfiguration: { + required: false, + serializedName: 'properties.softwareUpdateConfiguration', + type: { + name: 'Composite', + className: 'UpdateConfigurationNavigation' + } + }, + status: { + required: false, + readOnly: true, + serializedName: 'properties.status', + type: { + name: 'String' + } + }, + osType: { + required: false, + readOnly: true, + serializedName: 'properties.osType', + type: { + name: 'String' + } + }, + correlationId: { + required: false, + readOnly: true, + serializedName: 'properties.correlationId', + type: { + name: 'String' + } + }, + sourceComputerId: { + required: false, + readOnly: true, + serializedName: 'properties.sourceComputerId', + type: { + name: 'String' + } + }, + startTime: { + required: false, + readOnly: true, + serializedName: 'properties.startTime', + type: { + name: 'DateTime' + } + }, + endTime: { + required: false, + readOnly: true, + serializedName: 'properties.endTime', + type: { + name: 'DateTime' + } + }, + configuredDuration: { + required: false, + readOnly: true, + serializedName: 'properties.configuredDuration', + type: { + name: 'String' + } + }, + job: { + required: false, + serializedName: 'properties.job', + type: { + name: 'Composite', + className: 'JobNavigation' + } + }, + creationTime: { + required: false, + readOnly: true, + serializedName: 'properties.creationTime', + type: { + name: 'DateTime' + } + }, + createdBy: { + required: false, + readOnly: true, + serializedName: 'properties.createdBy', + type: { + name: 'String' + } + }, + lastModifiedTime: { + required: false, + readOnly: true, + serializedName: 'properties.lastModifiedTime', + type: { + name: 'DateTime' + } + }, + lastModifiedBy: { + required: false, + readOnly: true, + serializedName: 'properties.lastModifiedBy', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SoftwareUpdateConfigurationMachineRun; diff --git a/lib/services/automationManagement/lib/models/softwareUpdateConfigurationMachineRunListResult.js b/lib/services/automationManagement/lib/models/softwareUpdateConfigurationMachineRunListResult.js new file mode 100644 index 0000000000..e6411a5fec --- /dev/null +++ b/lib/services/automationManagement/lib/models/softwareUpdateConfigurationMachineRunListResult.js @@ -0,0 +1,71 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * result of listing all software update configuration machine runs + * + */ +class SoftwareUpdateConfigurationMachineRunListResult { + /** + * Create a SoftwareUpdateConfigurationMachineRunListResult. + * @member {array} [value] outer object returned when listing all software + * update configuration machine runs + * @member {string} [nextLink] link to next page of results. + */ + constructor() { + } + + /** + * Defines the metadata of SoftwareUpdateConfigurationMachineRunListResult + * + * @returns {object} metadata of SoftwareUpdateConfigurationMachineRunListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'softwareUpdateConfigurationMachineRunListResult', + type: { + name: 'Composite', + className: 'SoftwareUpdateConfigurationMachineRunListResult', + modelProperties: { + value: { + required: false, + serializedName: 'value', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SoftwareUpdateConfigurationMachineRunElementType', + type: { + name: 'Composite', + className: 'SoftwareUpdateConfigurationMachineRun' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SoftwareUpdateConfigurationMachineRunListResult; diff --git a/lib/services/automationManagement/lib/models/softwareUpdateConfigurationRun.js b/lib/services/automationManagement/lib/models/softwareUpdateConfigurationRun.js new file mode 100644 index 0000000000..d7c603ce40 --- /dev/null +++ b/lib/services/automationManagement/lib/models/softwareUpdateConfigurationRun.js @@ -0,0 +1,184 @@ +/* + * 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'); + +/** + * Software update configuration Run properties. + * + */ +class SoftwareUpdateConfigurationRun { + /** + * Create a SoftwareUpdateConfigurationRun. + * @member {string} [name] Name of the software update configuration run. + * @member {string} [id] Resource Id of the software update configuration run + * @member {object} [softwareUpdateConfiguration] software update + * configuration triggered this run + * @member {string} [softwareUpdateConfiguration.name] Name of the software + * update configuration triggered the software update configuration run + * @member {string} [status] Status of the software update configuration run. + * @member {string} [configuredDuration] configured duration for the software + * update configuration run. + * @member {string} [osType] Operating system target of the software update + * configuration triggered this run + * @member {date} [startTime] Etart time of the software update configuration + * run. + * @member {date} [endTime] End time of the software update configuration + * run. + * @member {number} [computerCount] Number of computers in the software + * update configuration run. + * @member {number} [failedCount] Number of computers with failed status. + * @member {date} [creationTime] Creation time of theresource, which only + * appears in the response. + * @member {string} [createdBy] createdBy property, which only appears in the + * response. + * @member {date} [lastModifiedTime] Last time resource was modified, which + * only appears in the response. + * @member {string} [lastModifiedBy] lastModifiedBy property, which only + * appears in the response. + */ + constructor() { + } + + /** + * Defines the metadata of SoftwareUpdateConfigurationRun + * + * @returns {object} metadata of SoftwareUpdateConfigurationRun + * + */ + mapper() { + return { + required: false, + serializedName: 'softwareUpdateConfigurationRun', + type: { + name: 'Composite', + className: 'SoftwareUpdateConfigurationRun', + modelProperties: { + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + softwareUpdateConfiguration: { + required: false, + serializedName: 'properties.softwareUpdateConfiguration', + type: { + name: 'Composite', + className: 'UpdateConfigurationNavigation' + } + }, + status: { + required: false, + readOnly: true, + serializedName: 'properties.status', + type: { + name: 'String' + } + }, + configuredDuration: { + required: false, + readOnly: true, + serializedName: 'properties.configuredDuration', + type: { + name: 'String' + } + }, + osType: { + required: false, + readOnly: true, + serializedName: 'properties.osType', + type: { + name: 'String' + } + }, + startTime: { + required: false, + readOnly: true, + serializedName: 'properties.startTime', + type: { + name: 'DateTime' + } + }, + endTime: { + required: false, + readOnly: true, + serializedName: 'properties.endTime', + type: { + name: 'DateTime' + } + }, + computerCount: { + required: false, + readOnly: true, + serializedName: 'properties.computerCount', + type: { + name: 'Number' + } + }, + failedCount: { + required: false, + readOnly: true, + serializedName: 'properties.failedCount', + type: { + name: 'Number' + } + }, + creationTime: { + required: false, + readOnly: true, + serializedName: 'properties.creationTime', + type: { + name: 'DateTime' + } + }, + createdBy: { + required: false, + readOnly: true, + serializedName: 'properties.createdBy', + type: { + name: 'String' + } + }, + lastModifiedTime: { + required: false, + readOnly: true, + serializedName: 'properties.lastModifiedTime', + type: { + name: 'DateTime' + } + }, + lastModifiedBy: { + required: false, + readOnly: true, + serializedName: 'properties.lastModifiedBy', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SoftwareUpdateConfigurationRun; diff --git a/lib/services/automationManagement/lib/models/softwareUpdateConfigurationRunListResult.js b/lib/services/automationManagement/lib/models/softwareUpdateConfigurationRunListResult.js new file mode 100644 index 0000000000..24ccdc2172 --- /dev/null +++ b/lib/services/automationManagement/lib/models/softwareUpdateConfigurationRunListResult.js @@ -0,0 +1,71 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * result of listing all software update configuration runs + * + */ +class SoftwareUpdateConfigurationRunListResult { + /** + * Create a SoftwareUpdateConfigurationRunListResult. + * @member {array} [value] outer object returned when listing all software + * update configuration runs + * @member {string} [nextLink] link to next page of results. + */ + constructor() { + } + + /** + * Defines the metadata of SoftwareUpdateConfigurationRunListResult + * + * @returns {object} metadata of SoftwareUpdateConfigurationRunListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'softwareUpdateConfigurationRunListResult', + type: { + name: 'Composite', + className: 'SoftwareUpdateConfigurationRunListResult', + modelProperties: { + value: { + required: false, + serializedName: 'value', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SoftwareUpdateConfigurationRunElementType', + type: { + name: 'Composite', + className: 'SoftwareUpdateConfigurationRun' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SoftwareUpdateConfigurationRunListResult; diff --git a/lib/services/automationManagement/lib/models/sourceControl.js b/lib/services/automationManagement/lib/models/sourceControl.js new file mode 100644 index 0000000000..b926558d2e --- /dev/null +++ b/lib/services/automationManagement/lib/models/sourceControl.js @@ -0,0 +1,153 @@ +/* + * 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'); + +/** + * Definition of the source control. + * + * @extends models['BaseResource'] + */ +class SourceControl extends models['BaseResource'] { + /** + * Create a SourceControl. + * @member {string} [name] Resource name. + * @member {string} [id] Resource Id. + * @member {string} [type] Resource type. + * @member {string} [repoUrl] Gets or sets the repo url of the source + * control. + * @member {string} [branch] Gets or sets the repo branch of the source + * control. Include branch as empty string for VsoTfvc. + * @member {string} [folderPath] Gets or sets the folder path of the source + * control. + * @member {boolean} [autoSync] Gets or sets auto async of the source + * control. Default is false. + * @member {boolean} [publishRunbook] Gets or sets the auto publish of the + * source control. Default is true. + * @member {string} [sourceType] The source type. Must be one of VsoGit, + * VsoTfvc, GitHub. Possible values include: 'VsoGit', 'VsoTfvc', 'GitHub' + * @member {string} [description] Gets or sets the description. + * @member {date} [creationTime] Gets or sets the creation time. + * @member {date} [lastModifiedTime] Gets or sets the last modified time. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of SourceControl + * + * @returns {object} metadata of SourceControl + * + */ + mapper() { + return { + required: false, + serializedName: 'SourceControl', + type: { + name: 'Composite', + className: 'SourceControl', + modelProperties: { + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + repoUrl: { + required: false, + serializedName: 'properties.repoUrl', + type: { + name: 'String' + } + }, + branch: { + required: false, + serializedName: 'properties.branch', + type: { + name: 'String' + } + }, + folderPath: { + required: false, + serializedName: 'properties.folderPath', + type: { + name: 'String' + } + }, + autoSync: { + required: false, + serializedName: 'properties.autoSync', + type: { + name: 'Boolean' + } + }, + publishRunbook: { + required: false, + serializedName: 'properties.publishRunbook', + type: { + name: 'Boolean' + } + }, + sourceType: { + required: false, + serializedName: 'properties.sourceType', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + creationTime: { + required: false, + serializedName: 'properties.creationTime', + type: { + name: 'DateTime' + } + }, + lastModifiedTime: { + required: false, + serializedName: 'properties.lastModifiedTime', + type: { + name: 'DateTime' + } + } + } + } + }; + } +} + +module.exports = SourceControl; diff --git a/lib/services/automationManagement/lib/models/sourceControlCreateOrUpdateParameters.js b/lib/services/automationManagement/lib/models/sourceControlCreateOrUpdateParameters.js new file mode 100644 index 0000000000..ebed49622d --- /dev/null +++ b/lib/services/automationManagement/lib/models/sourceControlCreateOrUpdateParameters.js @@ -0,0 +1,132 @@ +/* + * 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 parameters supplied to the create or update source control operation. + * + */ +class SourceControlCreateOrUpdateParameters { + /** + * Create a SourceControlCreateOrUpdateParameters. + * @member {string} [repoUrl] Gets or sets the repo url of the source + * control. + * @member {string} [branch] Gets or sets the repo branch of the source + * control. Include branch as empty string for VsoTfvc. + * @member {string} [folderPath] Gets or sets the folder path of the source + * control. Path must be relative. + * @member {boolean} [autoSync] Gets or sets auto async of the source + * control. Default is false. + * @member {boolean} [publishRunbook] Gets or sets the auto publish of the + * source control. Default is true. + * @member {string} [sourceType] The source type. Must be one of VsoGit, + * VsoTfvc, GitHub, case sensitive. Possible values include: 'VsoGit', + * 'VsoTfvc', 'GitHub' + * @member {string} [securityToken] Gets or sets the authorization token for + * the repo of the source control. + * @member {string} [description] Gets or sets the user description of the + * source control. + */ + constructor() { + } + + /** + * Defines the metadata of SourceControlCreateOrUpdateParameters + * + * @returns {object} metadata of SourceControlCreateOrUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'SourceControlCreateOrUpdateParameters', + type: { + name: 'Composite', + className: 'SourceControlCreateOrUpdateParameters', + modelProperties: { + repoUrl: { + required: false, + serializedName: 'properties.repoUrl', + constraints: { + MaxLength: 2000 + }, + type: { + name: 'String' + } + }, + branch: { + required: false, + serializedName: 'properties.branch', + constraints: { + MaxLength: 255 + }, + type: { + name: 'String' + } + }, + folderPath: { + required: false, + serializedName: 'properties.folderPath', + constraints: { + MaxLength: 255 + }, + type: { + name: 'String' + } + }, + autoSync: { + required: false, + serializedName: 'properties.autoSync', + type: { + name: 'Boolean' + } + }, + publishRunbook: { + required: false, + serializedName: 'properties.publishRunbook', + type: { + name: 'Boolean' + } + }, + sourceType: { + required: false, + serializedName: 'properties.sourceType', + type: { + name: 'String' + } + }, + securityToken: { + required: false, + serializedName: 'properties.securityToken', + constraints: { + MaxLength: 1024 + }, + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'properties.description', + constraints: { + MaxLength: 512 + }, + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SourceControlCreateOrUpdateParameters; diff --git a/lib/services/automationManagement/lib/models/sourceControlListResult.js b/lib/services/automationManagement/lib/models/sourceControlListResult.js new file mode 100644 index 0000000000..18028ab656 --- /dev/null +++ b/lib/services/automationManagement/lib/models/sourceControlListResult.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'; + +/** + * The response model for the list source controls operation. + */ +class SourceControlListResult extends Array { + /** + * Create a SourceControlListResult. + * @member {string} [nextLink] Gets or sets the next link. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of SourceControlListResult + * + * @returns {object} metadata of SourceControlListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'SourceControlListResult', + type: { + name: 'Composite', + className: 'SourceControlListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SourceControlElementType', + type: { + name: 'Composite', + className: 'SourceControl' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SourceControlListResult; diff --git a/lib/services/automationManagement/lib/models/sourceControlSyncJob.js b/lib/services/automationManagement/lib/models/sourceControlSyncJob.js new file mode 100644 index 0000000000..77494ea6a2 --- /dev/null +++ b/lib/services/automationManagement/lib/models/sourceControlSyncJob.js @@ -0,0 +1,124 @@ +/* + * 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'; + +/** + * Definition of the source control sync job. + * + */ +class SourceControlSyncJob { + /** + * Create a SourceControlSyncJob. + * @member {string} [name] Resource name. + * @member {string} [type] Resource type. + * @member {string} [id] Resource id. + * @member {string} [sourceControlSyncJobId] Gets the source control sync job + * id. + * @member {date} [creationTime] Gets the creation time of the job. + * @member {string} [provisioningState] Gets the provisioning state of the + * job. Possible values include: 'Completed', 'Failed', 'Running' + * @member {date} [startTime] Gets the start time of the job. + * @member {date} [endTime] Gets the end time of the job. + * @member {string} [startedBy] Gets the user who started the sync job. + */ + constructor() { + } + + /** + * Defines the metadata of SourceControlSyncJob + * + * @returns {object} metadata of SourceControlSyncJob + * + */ + mapper() { + return { + required: false, + serializedName: 'SourceControlSyncJob', + type: { + name: 'Composite', + className: 'SourceControlSyncJob', + modelProperties: { + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + sourceControlSyncJobId: { + required: false, + serializedName: 'properties.sourceControlSyncJobId', + type: { + name: 'String' + } + }, + creationTime: { + required: false, + readOnly: true, + serializedName: 'properties.creationTime', + type: { + name: 'DateTime' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + startTime: { + required: false, + readOnly: true, + serializedName: 'properties.startTime', + type: { + name: 'DateTime' + } + }, + endTime: { + required: false, + readOnly: true, + serializedName: 'properties.endTime', + type: { + name: 'DateTime' + } + }, + startedBy: { + required: false, + serializedName: 'properties.startedBy', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SourceControlSyncJob; diff --git a/lib/services/automationManagement/lib/models/sourceControlSyncJobById.js b/lib/services/automationManagement/lib/models/sourceControlSyncJobById.js new file mode 100644 index 0000000000..5936289484 --- /dev/null +++ b/lib/services/automationManagement/lib/models/sourceControlSyncJobById.js @@ -0,0 +1,118 @@ +/* + * 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'); + +/** + * Definition of the source control sync job. + * + */ +class SourceControlSyncJobById { + /** + * Create a SourceControlSyncJobById. + * @member {string} [id] Gets the id of the job. + * @member {string} [sourceControlSyncJobId] Gets the source control sync job + * id. + * @member {date} [creationTime] Gets the creation time of the job. + * @member {string} [provisioningState] Gets the provisioning state of the + * job. Possible values include: 'Completed', 'Failed', 'Running' + * @member {date} [startTime] Gets the start time of the job. + * @member {date} [endTime] Gets the end time of the job. + * @member {string} [startedBy] Gets the user who started the sync job. + * @member {object} [errors] Error details of the source control sync job. + * @member {string} [errors.code] Gets the error code for the job. + * @member {string} [errors.message] Gets the error message for the job. + */ + constructor() { + } + + /** + * Defines the metadata of SourceControlSyncJobById + * + * @returns {object} metadata of SourceControlSyncJobById + * + */ + mapper() { + return { + required: false, + serializedName: 'SourceControlSyncJobById', + type: { + name: 'Composite', + className: 'SourceControlSyncJobById', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + sourceControlSyncJobId: { + required: false, + serializedName: 'properties.sourceControlSyncJobId', + type: { + name: 'String' + } + }, + creationTime: { + required: false, + readOnly: true, + serializedName: 'properties.creationTime', + type: { + name: 'DateTime' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + startTime: { + required: false, + readOnly: true, + serializedName: 'properties.startTime', + type: { + name: 'DateTime' + } + }, + endTime: { + required: false, + readOnly: true, + serializedName: 'properties.endTime', + type: { + name: 'DateTime' + } + }, + startedBy: { + required: false, + serializedName: 'properties.startedBy', + type: { + name: 'String' + } + }, + errors: { + required: false, + serializedName: 'properties.errors', + type: { + name: 'Composite', + className: 'SourceControlSyncJobByIdErrors' + } + } + } + } + }; + } +} + +module.exports = SourceControlSyncJobById; diff --git a/lib/services/automationManagement/lib/models/sourceControlSyncJobByIdErrors.js b/lib/services/automationManagement/lib/models/sourceControlSyncJobByIdErrors.js new file mode 100644 index 0000000000..94a8ee52d0 --- /dev/null +++ b/lib/services/automationManagement/lib/models/sourceControlSyncJobByIdErrors.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'; + +/** + * Error details of the source control sync job. + * + */ +class SourceControlSyncJobByIdErrors { + /** + * Create a SourceControlSyncJobByIdErrors. + * @member {string} [code] Gets the error code for the job. + * @member {string} [message] Gets the error message for the job. + */ + constructor() { + } + + /** + * Defines the metadata of SourceControlSyncJobByIdErrors + * + * @returns {object} metadata of SourceControlSyncJobByIdErrors + * + */ + mapper() { + return { + required: false, + serializedName: 'SourceControlSyncJobByIdErrors', + type: { + name: 'Composite', + className: 'SourceControlSyncJobByIdErrors', + modelProperties: { + code: { + required: false, + serializedName: 'code', + type: { + name: 'String' + } + }, + message: { + required: false, + serializedName: 'message', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SourceControlSyncJobByIdErrors; diff --git a/lib/services/automationManagement/lib/models/sourceControlSyncJobListResult.js b/lib/services/automationManagement/lib/models/sourceControlSyncJobListResult.js new file mode 100644 index 0000000000..328361f520 --- /dev/null +++ b/lib/services/automationManagement/lib/models/sourceControlSyncJobListResult.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'; + +/** + * The response model for the list source control sync jobs operation. + */ +class SourceControlSyncJobListResult extends Array { + /** + * Create a SourceControlSyncJobListResult. + * @member {string} [nextLink] Gets or sets the next link. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of SourceControlSyncJobListResult + * + * @returns {object} metadata of SourceControlSyncJobListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'SourceControlSyncJobListResult', + type: { + name: 'Composite', + className: 'SourceControlSyncJobListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SourceControlSyncJobElementType', + type: { + name: 'Composite', + className: 'SourceControlSyncJob' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SourceControlSyncJobListResult; diff --git a/lib/services/automationManagement/lib/models/sourceControlUpdateParameters.js b/lib/services/automationManagement/lib/models/sourceControlUpdateParameters.js new file mode 100644 index 0000000000..bd0062ebd6 --- /dev/null +++ b/lib/services/automationManagement/lib/models/sourceControlUpdateParameters.js @@ -0,0 +1,98 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * The parameters supplied to the update source control operation. + * + */ +class SourceControlUpdateParameters { + /** + * Create a SourceControlUpdateParameters. + * @member {string} [branch] Gets or sets the repo branch of the source + * control. + * @member {string} [folderPath] Gets or sets the folder path of the source + * control. Path must be relative. + * @member {boolean} [autoSync] Gets or sets auto async of the source + * control. Default is false. + * @member {boolean} [publishRunbook] Gets or sets the auto publish of the + * source control. Default is true. + * @member {string} [securityToken] Gets or sets the authorization token for + * the repo of the source control. + * @member {string} [description] Gets or sets the user description of the + * source control. + */ + constructor() { + } + + /** + * Defines the metadata of SourceControlUpdateParameters + * + * @returns {object} metadata of SourceControlUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'SourceControlUpdateParameters', + type: { + name: 'Composite', + className: 'SourceControlUpdateParameters', + modelProperties: { + branch: { + required: false, + serializedName: 'properties.branch', + type: { + name: 'String' + } + }, + folderPath: { + required: false, + serializedName: 'properties.folderPath', + type: { + name: 'String' + } + }, + autoSync: { + required: false, + serializedName: 'properties.autoSync', + type: { + name: 'Boolean' + } + }, + publishRunbook: { + required: false, + serializedName: 'properties.publishRunbook', + type: { + name: 'Boolean' + } + }, + securityToken: { + required: false, + serializedName: 'properties.securityToken', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SourceControlUpdateParameters; diff --git a/lib/services/automationManagement/lib/models/testJob.js b/lib/services/automationManagement/lib/models/testJob.js index ce4b2de4b2..5dfc6c310a 100644 --- a/lib/services/automationManagement/lib/models/testJob.js +++ b/lib/services/automationManagement/lib/models/testJob.js @@ -32,6 +32,8 @@ class TestJob { * @member {date} [lastStatusModifiedTime] Gets or sets the last status * modified time of the test job. * @member {object} [parameters] Gets or sets the parameters of the test job. + * @member {number} [logActivityTrace] The activity-level tracing options of + * the runbook. */ constructor() { } @@ -126,6 +128,13 @@ class TestJob { } } } + }, + logActivityTrace: { + required: false, + serializedName: 'logActivityTrace', + type: { + name: 'Number' + } } } } diff --git a/lib/services/automationManagement/lib/models/testJobCreateParameters.js b/lib/services/automationManagement/lib/models/testJobCreateParameters.js index 82eabcba96..23468ce8fd 100644 --- a/lib/services/automationManagement/lib/models/testJobCreateParameters.js +++ b/lib/services/automationManagement/lib/models/testJobCreateParameters.js @@ -17,7 +17,6 @@ class TestJobCreateParameters { /** * Create a TestJobCreateParameters. - * @member {string} runbookName Gets or sets the runbook name. * @member {object} [parameters] Gets or sets the parameters of the test job. * @member {string} [runOn] Gets or sets the runOn which specifies the group * name where the job is to be executed. @@ -39,13 +38,6 @@ class TestJobCreateParameters { name: 'Composite', className: 'TestJobCreateParameters', modelProperties: { - runbookName: { - required: true, - serializedName: 'runbookName', - type: { - name: 'String' - } - }, parameters: { required: false, serializedName: 'parameters', diff --git a/lib/services/automationManagement/lib/models/trackedResource.js b/lib/services/automationManagement/lib/models/trackedResource.js new file mode 100644 index 0000000000..be5d3b94c0 --- /dev/null +++ b/lib/services/automationManagement/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 a ARM tracked top level resource + * + * @extends models['Resource'] + */ +class TrackedResource extends models['Resource'] { + /** + * Create a TrackedResource. + * @member {object} [tags] Resource tags. + * @member {string} [location] The Azure Region where the resource lives + */ + 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' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = TrackedResource; diff --git a/lib/services/automationManagement/lib/models/updateConfiguration.js b/lib/services/automationManagement/lib/models/updateConfiguration.js new file mode 100644 index 0000000000..49842befcc --- /dev/null +++ b/lib/services/automationManagement/lib/models/updateConfiguration.js @@ -0,0 +1,128 @@ +/* + * 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'); + +/** + * Update specifc properties of the software update configuration. + * + */ +class UpdateConfiguration { + /** + * Create a UpdateConfiguration. + * @member {string} operatingSystem operating system of target machines. + * Possible values include: 'Windows', 'Linux' + * @member {object} [windows] Windows specific update configuration. + * @member {string} [windows.includedUpdateClassifications] Update + * classification included in the software update configuration. A comma + * separated string with required values. Possible values include: + * 'Unclassified', 'Critical', 'Security', 'UpdateRollup', 'FeaturePack', + * 'ServicePack', 'Definition', 'Tools', 'Updates' + * @member {array} [windows.excludedKbNumbers] KB numbers excluded from the + * software update configuration. + * @member {object} [linux] Linux specific update configuration. + * @member {string} [linux.includedPackageClassifications] Update + * classifications included in the software update configuration. Possible + * values include: 'Unclassified', 'Critical', 'Security', 'Other' + * @member {array} [linux.excludedPackageNameMasks] packages excluded from + * the software update configuration. + * @member {moment.duration} [duration] Maximum time allowed for the software + * update configuration run. Duration needs to be specified using the format + * PT[n]H[n]M[n]S as per ISO8601 + * @member {array} [azureVirtualMachines] List of azure resource Ids for + * azure virtual machines targeted by the software update configuration. + * @member {array} [nonAzureComputerNames] List of names of non-azure + * machines targeted by the software update configuration. + */ + constructor() { + } + + /** + * Defines the metadata of UpdateConfiguration + * + * @returns {object} metadata of UpdateConfiguration + * + */ + mapper() { + return { + required: false, + serializedName: 'updateConfiguration', + type: { + name: 'Composite', + className: 'UpdateConfiguration', + modelProperties: { + operatingSystem: { + required: true, + serializedName: 'operatingSystem', + type: { + name: 'Enum', + allowedValues: [ 'Windows', 'Linux' ] + } + }, + windows: { + required: false, + serializedName: 'windows', + type: { + name: 'Composite', + className: 'WindowsProperties' + } + }, + linux: { + required: false, + serializedName: 'linux', + type: { + name: 'Composite', + className: 'LinuxProperties' + } + }, + duration: { + required: false, + serializedName: 'duration', + type: { + name: 'TimeSpan' + } + }, + azureVirtualMachines: { + required: false, + serializedName: 'azureVirtualMachines', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + nonAzureComputerNames: { + required: false, + serializedName: 'nonAzureComputerNames', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = UpdateConfiguration; diff --git a/lib/services/automationManagement/lib/models/updateConfigurationNavigation.js b/lib/services/automationManagement/lib/models/updateConfigurationNavigation.js new file mode 100644 index 0000000000..0b35837171 --- /dev/null +++ b/lib/services/automationManagement/lib/models/updateConfigurationNavigation.js @@ -0,0 +1,54 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Software update configuration Run Navigation model. + * + */ +class UpdateConfigurationNavigation { + /** + * Create a UpdateConfigurationNavigation. + * @member {string} [name] Name of the software update configuration + * triggered the software update configuration run + */ + constructor() { + } + + /** + * Defines the metadata of UpdateConfigurationNavigation + * + * @returns {object} metadata of UpdateConfigurationNavigation + * + */ + mapper() { + return { + required: false, + serializedName: 'updateConfigurationNavigation', + type: { + name: 'Composite', + className: 'UpdateConfigurationNavigation', + modelProperties: { + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = UpdateConfigurationNavigation; diff --git a/lib/services/automationManagement/lib/models/variable.js b/lib/services/automationManagement/lib/models/variable.js index 15cecf4457..96a65bf066 100644 --- a/lib/services/automationManagement/lib/models/variable.js +++ b/lib/services/automationManagement/lib/models/variable.js @@ -10,15 +10,16 @@ 'use strict'; +const models = require('./index'); + /** * Definition of the varible. * + * @extends models['ProxyResource'] */ -class Variable { +class Variable extends models['ProxyResource'] { /** * Create a Variable. - * @member {string} [id] Gets or sets the id of the resource. - * @member {string} [name] Gets or sets the name of the variable. * @member {string} [value] Gets or sets the value of the variable. * @member {boolean} [isEncrypted] Gets or sets the encrypted flag of the * variable. @@ -27,6 +28,7 @@ class Variable { * @member {string} [description] Gets or sets the description. */ constructor() { + super(); } /** @@ -45,6 +47,7 @@ class Variable { modelProperties: { id: { required: false, + readOnly: true, serializedName: 'id', type: { name: 'String' @@ -52,11 +55,20 @@ class Variable { }, name: { required: false, + readOnly: true, serializedName: 'name', type: { name: 'String' } }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, value: { required: false, serializedName: 'properties.value', diff --git a/lib/services/automationManagement/lib/models/variableUpdateParameters.js b/lib/services/automationManagement/lib/models/variableUpdateParameters.js index 14a64e03fa..d81497a7fe 100644 --- a/lib/services/automationManagement/lib/models/variableUpdateParameters.js +++ b/lib/services/automationManagement/lib/models/variableUpdateParameters.js @@ -17,7 +17,7 @@ class VariableUpdateParameters { /** * Create a VariableUpdateParameters. - * @member {string} name Gets or sets the name of the variable. + * @member {string} [name] Gets or sets the name of the variable. * @member {string} [value] Gets or sets the value of the variable. * @member {string} [description] Gets or sets the description of the * variable. @@ -40,7 +40,7 @@ class VariableUpdateParameters { className: 'VariableUpdateParameters', modelProperties: { name: { - required: true, + required: false, serializedName: 'name', type: { name: 'String' diff --git a/lib/services/automationManagement/lib/models/webhook.js b/lib/services/automationManagement/lib/models/webhook.js index 8c67739dfe..871b68b080 100644 --- a/lib/services/automationManagement/lib/models/webhook.js +++ b/lib/services/automationManagement/lib/models/webhook.js @@ -15,12 +15,11 @@ const models = require('./index'); /** * Definition of the webhook type. * + * @extends models['ProxyResource'] */ -class Webhook { +class Webhook extends models['ProxyResource'] { /** * Create a Webhook. - * @member {string} [id] Gets or sets the id of the resource. - * @member {string} [name] Gets or sets the name of the webhook. * @member {boolean} [isEnabled] Gets or sets the value of the enabled flag * of the webhook. Default value: false . * @member {string} [uri] Gets or sets the webhook uri. @@ -38,6 +37,7 @@ class Webhook { * @member {string} [description] Gets or sets the description. */ constructor() { + super(); } /** @@ -56,6 +56,7 @@ class Webhook { modelProperties: { id: { required: false, + readOnly: true, serializedName: 'id', type: { name: 'String' @@ -63,11 +64,20 @@ class Webhook { }, name: { required: false, + readOnly: true, serializedName: 'name', type: { name: 'String' } }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, isEnabled: { required: false, serializedName: 'properties.isEnabled', diff --git a/lib/services/automationManagement/lib/models/webhookUpdateParameters.js b/lib/services/automationManagement/lib/models/webhookUpdateParameters.js index 689df09516..99d7772239 100644 --- a/lib/services/automationManagement/lib/models/webhookUpdateParameters.js +++ b/lib/services/automationManagement/lib/models/webhookUpdateParameters.js @@ -17,7 +17,7 @@ class WebhookUpdateParameters { /** * Create a WebhookUpdateParameters. - * @member {string} name Gets or sets the name of the webhook. + * @member {string} [name] Gets or sets the name of the webhook. * @member {boolean} [isEnabled] Gets or sets the value of the enabled flag * of webhook. * @member {string} [runOn] Gets or sets the name of the hybrid worker group @@ -44,7 +44,7 @@ class WebhookUpdateParameters { className: 'WebhookUpdateParameters', modelProperties: { name: { - required: true, + required: false, serializedName: 'name', type: { name: 'String' diff --git a/lib/services/automationManagement/lib/models/windowsProperties.js b/lib/services/automationManagement/lib/models/windowsProperties.js new file mode 100644 index 0000000000..d58407607d --- /dev/null +++ b/lib/services/automationManagement/lib/models/windowsProperties.js @@ -0,0 +1,72 @@ +/* + * 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'; + +/** + * Windows specific update configuration. + * + */ +class WindowsProperties { + /** + * Create a WindowsProperties. + * @member {string} [includedUpdateClassifications] Update classification + * included in the software update configuration. A comma separated string + * with required values. Possible values include: 'Unclassified', 'Critical', + * 'Security', 'UpdateRollup', 'FeaturePack', 'ServicePack', 'Definition', + * 'Tools', 'Updates' + * @member {array} [excludedKbNumbers] KB numbers excluded from the software + * update configuration. + */ + constructor() { + } + + /** + * Defines the metadata of WindowsProperties + * + * @returns {object} metadata of WindowsProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'WindowsProperties', + type: { + name: 'Composite', + className: 'WindowsProperties', + modelProperties: { + includedUpdateClassifications: { + required: false, + serializedName: 'includedUpdateClassifications', + type: { + name: 'String' + } + }, + excludedKbNumbers: { + required: false, + serializedName: 'excludedKbNumbers', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = WindowsProperties; diff --git a/lib/services/automationManagement/lib/operations/activityOperations.js b/lib/services/automationManagement/lib/operations/activityOperations.js index 7745455e88..e7697d5ced 100644 --- a/lib/services/automationManagement/lib/operations/activityOperations.js +++ b/lib/services/automationManagement/lib/operations/activityOperations.js @@ -18,7 +18,7 @@ const WebResource = msRest.WebResource; * Retrieve the activity in the module identified by module name and activity * name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -54,12 +54,21 @@ function _get(resourceGroupName, automationAccountName, moduleName, activityName if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -77,9 +86,6 @@ function _get(resourceGroupName, automationAccountName, moduleName, activityName 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -96,7 +102,7 @@ function _get(resourceGroupName, automationAccountName, moduleName, activityName requestUrl = requestUrl.replace('{activityName}', encodeURIComponent(activityName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -182,7 +188,7 @@ function _get(resourceGroupName, automationAccountName, moduleName, activityName /** * Retrieve a list of activities in the module identified by module name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -216,12 +222,21 @@ function _listByModule(resourceGroupName, automationAccountName, moduleName, opt if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -236,9 +251,6 @@ function _listByModule(resourceGroupName, automationAccountName, moduleName, opt 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -254,7 +266,7 @@ function _listByModule(resourceGroupName, automationAccountName, moduleName, opt requestUrl = requestUrl.replace('{moduleName}', encodeURIComponent(moduleName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -482,7 +494,7 @@ class ActivityOperations { * Retrieve the activity in the module identified by module name and activity * name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -519,7 +531,7 @@ class ActivityOperations { * Retrieve the activity in the module identified by module name and activity * name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -577,7 +589,7 @@ class ActivityOperations { /** * Retrieve a list of activities in the module identified by module name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -611,7 +623,7 @@ class ActivityOperations { /** * Retrieve a list of activities in the module identified by module name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * diff --git a/lib/services/automationManagement/lib/operations/agentRegistrationInformation.js b/lib/services/automationManagement/lib/operations/agentRegistrationInformation.js index d772297337..87214db0dd 100644 --- a/lib/services/automationManagement/lib/operations/agentRegistrationInformation.js +++ b/lib/services/automationManagement/lib/operations/agentRegistrationInformation.js @@ -17,9 +17,9 @@ const WebResource = msRest.WebResource; /** * Retrieve the automation agent registration information. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {object} [options] Optional Parameters. * @@ -49,12 +49,24 @@ function _get(resourceGroupName, automationAccountName, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2018-01-15'; // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -63,12 +75,6 @@ function _get(resourceGroupName, automationAccountName, options, callback) { if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); } - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -79,11 +85,11 @@ function _get(resourceGroupName, automationAccountName, options, callback) { // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/agentRegistrationInformation'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -169,15 +175,15 @@ function _get(resourceGroupName, automationAccountName, options, callback) { /** * Regenerate a primary or secondary agent registration key * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {object} parameters The name of the agent registration key to be * regenerated * * @param {string} parameters.keyName Gets or sets the agent registration key - * name - Primary or Secondary. Possible values include: 'Primary', 'Secondary' + * name - primary or secondary. Possible values include: 'primary', 'secondary' * * @param {string} [parameters.name] Gets or sets the name of the resource. * @@ -215,12 +221,24 @@ function _regenerateKey(resourceGroupName, automationAccountName, parameters, op if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2018-01-15'; // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -232,12 +250,6 @@ function _regenerateKey(resourceGroupName, automationAccountName, parameters, op if (parameters === null || parameters === undefined) { throw new Error('parameters cannot be null or undefined.'); } - 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -248,11 +260,11 @@ function _regenerateKey(resourceGroupName, automationAccountName, parameters, op // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/agentRegistrationInformation/regenerateKey'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -364,9 +376,9 @@ class AgentRegistrationInformation { /** * Retrieve the automation agent registration information. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {object} [options] Optional Parameters. * @@ -396,9 +408,9 @@ class AgentRegistrationInformation { /** * Retrieve the automation agent registration information. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {object} [options] Optional Parameters. * @@ -450,15 +462,15 @@ class AgentRegistrationInformation { /** * Regenerate a primary or secondary agent registration key * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {object} parameters The name of the agent registration key to be * regenerated * * @param {string} parameters.keyName Gets or sets the agent registration key - * name - Primary or Secondary. Possible values include: 'Primary', 'Secondary' + * name - primary or secondary. Possible values include: 'primary', 'secondary' * * @param {string} [parameters.name] Gets or sets the name of the resource. * @@ -496,15 +508,15 @@ class AgentRegistrationInformation { /** * Regenerate a primary or secondary agent registration key * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {object} parameters The name of the agent registration key to be * regenerated * * @param {string} parameters.keyName Gets or sets the agent registration key - * name - Primary or Secondary. Possible values include: 'Primary', 'Secondary' + * name - primary or secondary. Possible values include: 'primary', 'secondary' * * @param {string} [parameters.name] Gets or sets the name of the resource. * diff --git a/lib/services/automationManagement/lib/operations/automationAccountOperations.js b/lib/services/automationManagement/lib/operations/automationAccountOperations.js index e7b24e4893..a35d725c5a 100644 --- a/lib/services/automationManagement/lib/operations/automationAccountOperations.js +++ b/lib/services/automationManagement/lib/operations/automationAccountOperations.js @@ -69,6 +69,7 @@ function _update(resourceGroupName, automationAccountName, parameters, options, if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -89,9 +90,6 @@ function _update(resourceGroupName, automationAccountName, parameters, options, 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -106,7 +104,7 @@ function _update(resourceGroupName, automationAccountName, parameters, options, requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -259,6 +257,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, parameters, o if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -279,9 +278,6 @@ function _createOrUpdate(resourceGroupName, automationAccountName, parameters, o 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -296,7 +292,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, parameters, o requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -342,7 +338,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, parameters, o return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 201 && statusCode !== 200) { + if (statusCode !== 200 && statusCode !== 201) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -372,7 +368,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, parameters, o let result = null; if (responseBody === '') responseBody = null; // Deserialize Response - if (statusCode === 201) { + if (statusCode === 200) { let parsedResponse = null; try { parsedResponse = JSON.parse(responseBody); @@ -389,7 +385,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, parameters, o } } // Deserialize Response - if (statusCode === 200) { + if (statusCode === 201) { let parsedResponse = null; try { parsedResponse = JSON.parse(responseBody); @@ -444,6 +440,7 @@ function _deleteMethod(resourceGroupName, automationAccountName, options, callba if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -461,9 +458,6 @@ function _deleteMethod(resourceGroupName, automationAccountName, options, callba 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -478,7 +472,7 @@ function _deleteMethod(resourceGroupName, automationAccountName, options, callba requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -579,6 +573,7 @@ function _get(resourceGroupName, automationAccountName, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -596,9 +591,6 @@ function _get(resourceGroupName, automationAccountName, options, callback) { 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -613,7 +605,7 @@ function _get(resourceGroupName, automationAccountName, options, callback) { requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -730,6 +722,7 @@ function _listByResourceGroup(resourceGroupName, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -744,9 +737,6 @@ function _listByResourceGroup(resourceGroupName, options, callback) { 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -760,7 +750,7 @@ function _listByResourceGroup(resourceGroupName, options, callback) { requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -877,14 +867,12 @@ function _list(options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -897,7 +885,7 @@ function _list(options, callback) { let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Automation/automationAccounts'; requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } diff --git a/lib/services/automationManagement/lib/operations/certificateOperations.js b/lib/services/automationManagement/lib/operations/certificateOperations.js index 3023bbdcc3..af935dabdb 100644 --- a/lib/services/automationManagement/lib/operations/certificateOperations.js +++ b/lib/services/automationManagement/lib/operations/certificateOperations.js @@ -17,7 +17,7 @@ const WebResource = msRest.WebResource; /** * Delete the certificate. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -50,12 +50,21 @@ function _deleteMethod(resourceGroupName, automationAccountName, certificateName if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -70,9 +79,6 @@ function _deleteMethod(resourceGroupName, automationAccountName, certificateName 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -88,7 +94,7 @@ function _deleteMethod(resourceGroupName, automationAccountName, certificateName requestUrl = requestUrl.replace('{certificateName}', encodeURIComponent(certificateName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -157,7 +163,7 @@ function _deleteMethod(resourceGroupName, automationAccountName, certificateName /** * Retrieve the certificate identified by certificate name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -191,12 +197,21 @@ function _get(resourceGroupName, automationAccountName, certificateName, options if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -211,9 +226,6 @@ function _get(resourceGroupName, automationAccountName, certificateName, options 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -229,7 +241,7 @@ function _get(resourceGroupName, automationAccountName, certificateName, options requestUrl = requestUrl.replace('{certificateName}', encodeURIComponent(certificateName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -315,7 +327,7 @@ function _get(resourceGroupName, automationAccountName, certificateName, options /** * Create a certificate. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -367,12 +379,21 @@ function _createOrUpdate(resourceGroupName, automationAccountName, certificateNa if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -390,9 +411,6 @@ function _createOrUpdate(resourceGroupName, automationAccountName, certificateNa 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -408,7 +426,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, certificateNa requestUrl = requestUrl.replace('{certificateName}', encodeURIComponent(certificateName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -454,7 +472,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, certificateNa return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 201 && statusCode !== 200) { + if (statusCode !== 200 && statusCode !== 201) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -484,7 +502,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, certificateNa let result = null; if (responseBody === '') responseBody = null; // Deserialize Response - if (statusCode === 201) { + if (statusCode === 200) { let parsedResponse = null; try { parsedResponse = JSON.parse(responseBody); @@ -501,7 +519,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, certificateNa } } // Deserialize Response - if (statusCode === 200) { + if (statusCode === 201) { let parsedResponse = null; try { parsedResponse = JSON.parse(responseBody); @@ -525,7 +543,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, certificateNa /** * Update a certificate. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -535,7 +553,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, certificateNa * @param {object} parameters The parameters supplied to the update certificate * operation. * - * @param {string} parameters.name Gets or sets the name of the certificate. + * @param {string} [parameters.name] Gets or sets the name of the certificate. * * @param {string} [parameters.description] Gets or sets the description of the * certificate. @@ -568,12 +586,21 @@ function _update(resourceGroupName, automationAccountName, certificateName, para if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -591,9 +618,6 @@ function _update(resourceGroupName, automationAccountName, certificateName, para 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -609,7 +633,7 @@ function _update(resourceGroupName, automationAccountName, certificateName, para requestUrl = requestUrl.replace('{certificateName}', encodeURIComponent(certificateName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -709,7 +733,7 @@ function _update(resourceGroupName, automationAccountName, certificateName, para /** * Retrieve a list of certificates. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -741,12 +765,21 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -758,9 +791,6 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -775,7 +805,7 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1005,7 +1035,7 @@ class CertificateOperations { /** * Delete the certificate. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1039,7 +1069,7 @@ class CertificateOperations { /** * Delete the certificate. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1094,7 +1124,7 @@ class CertificateOperations { /** * Retrieve the certificate identified by certificate name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1128,7 +1158,7 @@ class CertificateOperations { /** * Retrieve the certificate identified by certificate name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1184,7 +1214,7 @@ class CertificateOperations { /** * Create a certificate. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1236,7 +1266,7 @@ class CertificateOperations { /** * Create a certificate. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1310,7 +1340,7 @@ class CertificateOperations { /** * Update a certificate. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1320,7 +1350,7 @@ class CertificateOperations { * @param {object} parameters The parameters supplied to the update certificate * operation. * - * @param {string} parameters.name Gets or sets the name of the certificate. + * @param {string} [parameters.name] Gets or sets the name of the certificate. * * @param {string} [parameters.description] Gets or sets the description of the * certificate. @@ -1353,7 +1383,7 @@ class CertificateOperations { /** * Update a certificate. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1363,7 +1393,7 @@ class CertificateOperations { * @param {object} parameters The parameters supplied to the update certificate * operation. * - * @param {string} parameters.name Gets or sets the name of the certificate. + * @param {string} [parameters.name] Gets or sets the name of the certificate. * * @param {string} [parameters.description] Gets or sets the description of the * certificate. @@ -1418,7 +1448,7 @@ class CertificateOperations { /** * Retrieve a list of certificates. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1450,7 +1480,7 @@ class CertificateOperations { /** * Retrieve a list of certificates. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * diff --git a/lib/services/automationManagement/lib/operations/connectionOperations.js b/lib/services/automationManagement/lib/operations/connectionOperations.js index 69a0c90857..b6cdfdb030 100644 --- a/lib/services/automationManagement/lib/operations/connectionOperations.js +++ b/lib/services/automationManagement/lib/operations/connectionOperations.js @@ -17,7 +17,7 @@ const WebResource = msRest.WebResource; /** * Delete the connection. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -51,12 +51,21 @@ function _deleteMethod(resourceGroupName, automationAccountName, connectionName, if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -71,9 +80,6 @@ function _deleteMethod(resourceGroupName, automationAccountName, connectionName, 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -89,7 +95,7 @@ function _deleteMethod(resourceGroupName, automationAccountName, connectionName, requestUrl = requestUrl.replace('{connectionName}', encodeURIComponent(connectionName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -175,7 +181,7 @@ function _deleteMethod(resourceGroupName, automationAccountName, connectionName, /** * Retrieve the connection identified by connection name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -209,12 +215,21 @@ function _get(resourceGroupName, automationAccountName, connectionName, options, if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -229,9 +244,6 @@ function _get(resourceGroupName, automationAccountName, connectionName, options, 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -247,7 +259,7 @@ function _get(resourceGroupName, automationAccountName, connectionName, options, requestUrl = requestUrl.replace('{connectionName}', encodeURIComponent(connectionName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -333,7 +345,7 @@ function _get(resourceGroupName, automationAccountName, connectionName, options, /** * Create or update a connection. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -385,12 +397,21 @@ function _createOrUpdate(resourceGroupName, automationAccountName, connectionNam if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -408,9 +429,6 @@ function _createOrUpdate(resourceGroupName, automationAccountName, connectionNam 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -426,7 +444,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, connectionNam requestUrl = requestUrl.replace('{connectionName}', encodeURIComponent(connectionName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -472,7 +490,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, connectionNam return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 201 && statusCode !== 200) { + if (statusCode !== 200 && statusCode !== 201) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -502,7 +520,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, connectionNam let result = null; if (responseBody === '') responseBody = null; // Deserialize Response - if (statusCode === 201) { + if (statusCode === 200) { let parsedResponse = null; try { parsedResponse = JSON.parse(responseBody); @@ -519,7 +537,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, connectionNam } } // Deserialize Response - if (statusCode === 200) { + if (statusCode === 201) { let parsedResponse = null; try { parsedResponse = JSON.parse(responseBody); @@ -543,7 +561,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, connectionNam /** * Update a connection. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -589,12 +607,21 @@ function _update(resourceGroupName, automationAccountName, connectionName, param if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -612,9 +639,6 @@ function _update(resourceGroupName, automationAccountName, connectionName, param 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -630,7 +654,7 @@ function _update(resourceGroupName, automationAccountName, connectionName, param requestUrl = requestUrl.replace('{connectionName}', encodeURIComponent(connectionName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -730,7 +754,7 @@ function _update(resourceGroupName, automationAccountName, connectionName, param /** * Retrieve a list of connections. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -762,12 +786,21 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -779,9 +812,6 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -796,7 +826,7 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1026,7 +1056,7 @@ class ConnectionOperations { /** * Delete the connection. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1060,7 +1090,7 @@ class ConnectionOperations { /** * Delete the connection. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1116,7 +1146,7 @@ class ConnectionOperations { /** * Retrieve the connection identified by connection name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1150,7 +1180,7 @@ class ConnectionOperations { /** * Retrieve the connection identified by connection name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1206,7 +1236,7 @@ class ConnectionOperations { /** * Create or update a connection. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1258,7 +1288,7 @@ class ConnectionOperations { /** * Create or update a connection. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1332,7 +1362,7 @@ class ConnectionOperations { /** * Update a connection. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1378,7 +1408,7 @@ class ConnectionOperations { /** * Update a connection. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1446,7 +1476,7 @@ class ConnectionOperations { /** * Retrieve a list of connections. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1478,7 +1508,7 @@ class ConnectionOperations { /** * Retrieve a list of connections. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * diff --git a/lib/services/automationManagement/lib/operations/connectionTypeOperations.js b/lib/services/automationManagement/lib/operations/connectionTypeOperations.js index 462f5136fd..fdd1e9fedb 100644 --- a/lib/services/automationManagement/lib/operations/connectionTypeOperations.js +++ b/lib/services/automationManagement/lib/operations/connectionTypeOperations.js @@ -17,7 +17,7 @@ const WebResource = msRest.WebResource; /** * Delete the connectiontype. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -50,12 +50,21 @@ function _deleteMethod(resourceGroupName, automationAccountName, connectionTypeN if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -70,9 +79,6 @@ function _deleteMethod(resourceGroupName, automationAccountName, connectionTypeN 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -88,7 +94,7 @@ function _deleteMethod(resourceGroupName, automationAccountName, connectionTypeN requestUrl = requestUrl.replace('{connectionTypeName}', encodeURIComponent(connectionTypeName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -157,7 +163,7 @@ function _deleteMethod(resourceGroupName, automationAccountName, connectionTypeN /** * Retrieve the connectiontype identified by connectiontype name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -191,12 +197,21 @@ function _get(resourceGroupName, automationAccountName, connectionTypeName, opti if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -211,9 +226,6 @@ function _get(resourceGroupName, automationAccountName, connectionTypeName, opti 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -229,7 +241,7 @@ function _get(resourceGroupName, automationAccountName, connectionTypeName, opti requestUrl = requestUrl.replace('{connectionTypeName}', encodeURIComponent(connectionTypeName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -315,7 +327,7 @@ function _get(resourceGroupName, automationAccountName, connectionTypeName, opti /** * Create a connectiontype. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -362,12 +374,21 @@ function _createOrUpdate(resourceGroupName, automationAccountName, connectionTyp if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -385,9 +406,6 @@ function _createOrUpdate(resourceGroupName, automationAccountName, connectionTyp 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -403,7 +421,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, connectionTyp requestUrl = requestUrl.replace('{connectionTypeName}', encodeURIComponent(connectionTypeName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -520,7 +538,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, connectionTyp /** * Retrieve a list of connectiontypes. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -553,12 +571,21 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -570,9 +597,6 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -587,7 +611,7 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -817,7 +841,7 @@ class ConnectionTypeOperations { /** * Delete the connectiontype. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -851,7 +875,7 @@ class ConnectionTypeOperations { /** * Delete the connectiontype. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -906,7 +930,7 @@ class ConnectionTypeOperations { /** * Retrieve the connectiontype identified by connectiontype name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -940,7 +964,7 @@ class ConnectionTypeOperations { /** * Retrieve the connectiontype identified by connectiontype name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -996,7 +1020,7 @@ class ConnectionTypeOperations { /** * Create a connectiontype. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1043,7 +1067,7 @@ class ConnectionTypeOperations { /** * Create a connectiontype. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1112,7 +1136,7 @@ class ConnectionTypeOperations { /** * Retrieve a list of connectiontypes. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1144,7 +1168,7 @@ class ConnectionTypeOperations { /** * Retrieve a list of connectiontypes. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * diff --git a/lib/services/automationManagement/lib/operations/credentialOperations.js b/lib/services/automationManagement/lib/operations/credentialOperations.js index ab79ce8fa1..f617c56f0b 100644 --- a/lib/services/automationManagement/lib/operations/credentialOperations.js +++ b/lib/services/automationManagement/lib/operations/credentialOperations.js @@ -17,7 +17,7 @@ const WebResource = msRest.WebResource; /** * Delete the credential. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -50,12 +50,21 @@ function _deleteMethod(resourceGroupName, automationAccountName, credentialName, if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -70,9 +79,6 @@ function _deleteMethod(resourceGroupName, automationAccountName, credentialName, 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -88,7 +94,7 @@ function _deleteMethod(resourceGroupName, automationAccountName, credentialName, requestUrl = requestUrl.replace('{credentialName}', encodeURIComponent(credentialName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -157,7 +163,7 @@ function _deleteMethod(resourceGroupName, automationAccountName, credentialName, /** * Retrieve the credential identified by credential name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -191,12 +197,21 @@ function _get(resourceGroupName, automationAccountName, credentialName, options, if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -211,9 +226,6 @@ function _get(resourceGroupName, automationAccountName, credentialName, options, 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -229,7 +241,7 @@ function _get(resourceGroupName, automationAccountName, credentialName, options, requestUrl = requestUrl.replace('{credentialName}', encodeURIComponent(credentialName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -315,7 +327,7 @@ function _get(resourceGroupName, automationAccountName, credentialName, options, /** * Create a credential. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -364,12 +376,21 @@ function _createOrUpdate(resourceGroupName, automationAccountName, credentialNam if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -387,9 +408,6 @@ function _createOrUpdate(resourceGroupName, automationAccountName, credentialNam 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -405,7 +423,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, credentialNam requestUrl = requestUrl.replace('{credentialName}', encodeURIComponent(credentialName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -451,7 +469,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, credentialNam return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 201 && statusCode !== 200) { + if (statusCode !== 200 && statusCode !== 201) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -481,7 +499,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, credentialNam let result = null; if (responseBody === '') responseBody = null; // Deserialize Response - if (statusCode === 201) { + if (statusCode === 200) { let parsedResponse = null; try { parsedResponse = JSON.parse(responseBody); @@ -498,7 +516,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, credentialNam } } // Deserialize Response - if (statusCode === 200) { + if (statusCode === 201) { let parsedResponse = null; try { parsedResponse = JSON.parse(responseBody); @@ -522,7 +540,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, credentialNam /** * Update a credential. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -532,7 +550,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, credentialNam * @param {object} parameters The parameters supplied to the Update credential * operation. * - * @param {string} parameters.name Gets or sets the name of the credential. + * @param {string} [parameters.name] Gets or sets the name of the credential. * * @param {string} [parameters.userName] Gets or sets the user name of the * credential. @@ -571,12 +589,21 @@ function _update(resourceGroupName, automationAccountName, credentialName, param if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -594,9 +621,6 @@ function _update(resourceGroupName, automationAccountName, credentialName, param 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -612,7 +636,7 @@ function _update(resourceGroupName, automationAccountName, credentialName, param requestUrl = requestUrl.replace('{credentialName}', encodeURIComponent(credentialName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -712,7 +736,7 @@ function _update(resourceGroupName, automationAccountName, credentialName, param /** * Retrieve a list of credentials. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -744,12 +768,21 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -761,9 +794,6 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -778,7 +808,7 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1006,7 +1036,7 @@ class CredentialOperations { /** * Delete the credential. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1040,7 +1070,7 @@ class CredentialOperations { /** * Delete the credential. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1095,7 +1125,7 @@ class CredentialOperations { /** * Retrieve the credential identified by credential name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1129,7 +1159,7 @@ class CredentialOperations { /** * Retrieve the credential identified by credential name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1185,7 +1215,7 @@ class CredentialOperations { /** * Create a credential. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1234,7 +1264,7 @@ class CredentialOperations { /** * Create a credential. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1305,7 +1335,7 @@ class CredentialOperations { /** * Update a credential. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1315,7 +1345,7 @@ class CredentialOperations { * @param {object} parameters The parameters supplied to the Update credential * operation. * - * @param {string} parameters.name Gets or sets the name of the credential. + * @param {string} [parameters.name] Gets or sets the name of the credential. * * @param {string} [parameters.userName] Gets or sets the user name of the * credential. @@ -1354,7 +1384,7 @@ class CredentialOperations { /** * Update a credential. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1364,7 +1394,7 @@ class CredentialOperations { * @param {object} parameters The parameters supplied to the Update credential * operation. * - * @param {string} parameters.name Gets or sets the name of the credential. + * @param {string} [parameters.name] Gets or sets the name of the credential. * * @param {string} [parameters.userName] Gets or sets the user name of the * credential. @@ -1425,7 +1455,7 @@ class CredentialOperations { /** * Retrieve a list of credentials. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1457,7 +1487,7 @@ class CredentialOperations { /** * Retrieve a list of credentials. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * diff --git a/lib/services/automationManagement/lib/operations/dscCompilationJobOperations.js b/lib/services/automationManagement/lib/operations/dscCompilationJobOperations.js index 8cb79e5abd..d89ef1d387 100644 --- a/lib/services/automationManagement/lib/operations/dscCompilationJobOperations.js +++ b/lib/services/automationManagement/lib/operations/dscCompilationJobOperations.js @@ -14,14 +14,15 @@ const msRest = require('ms-rest'); const msRestAzure = require('ms-rest-azure'); const WebResource = msRest.WebResource; + /** * Creates the Dsc compilation job of the configuration. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {uuid} compilationJobId The the DSC configuration Id. + * @param {string} compilationJobName The the DSC configuration Id. * * @param {object} parameters The parameters supplied to the create compilation * job operation. @@ -34,6 +35,9 @@ const WebResource = msRest.WebResource; * @param {object} [parameters.parameters] Gets or sets the parameters of the * job. * + * @param {boolean} [parameters.newNodeConfigurationBuildVersionRequired] If a + * new build version of NodeConfiguration is required. + * * @param {string} [parameters.name] Gets or sets name of the resource. * * @param {string} [parameters.location] Gets or sets the location of the @@ -60,7 +64,86 @@ const WebResource = msRest.WebResource; * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _create(resourceGroupName, automationAccountName, compilationJobId, parameters, options, callback) { +function _create(resourceGroupName, automationAccountName, compilationJobName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreate(resourceGroupName, automationAccountName, compilationJobName, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DscCompilationJob']().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); + }); + }); +} + +/** + * Retrieve the Dsc configuration compilation job identified by job id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} compilationJobName The the DSC configuration Id. + * + * @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 DscCompilationJob} 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, automationAccountName, compilationJobName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -70,12 +153,21 @@ function _create(resourceGroupName, automationAccountName, compilationJobId, par if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2018-01-15'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -84,18 +176,12 @@ function _create(resourceGroupName, automationAccountName, compilationJobId, par if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); } - if (compilationJobId === null || compilationJobId === undefined || typeof compilationJobId.valueOf() !== 'string' || !msRest.isValidUuid(compilationJobId)) { - throw new Error('compilationJobId cannot be null or undefined and it must be of type string and must be a valid uuid.'); - } - if (parameters === null || parameters === undefined) { - throw new Error('parameters cannot be null or undefined.'); + if (compilationJobName === null || compilationJobName === undefined || typeof compilationJobName.valueOf() !== 'string') { + throw new Error('compilationJobName cannot be null or undefined and it must be of type string.'); } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -105,20 +191,20 @@ function _create(resourceGroupName, automationAccountName, compilationJobId, par // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{compilationJobId}'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{compilationJobName}'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); - requestUrl = requestUrl.replace('{compilationJobId}', encodeURIComponent(compilationJobId.toString())); + requestUrl = requestUrl.replace('{compilationJobName}', encodeURIComponent(compilationJobName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } // Create HTTP transport objects let httpRequest = new WebResource(); - httpRequest.method = 'PUT'; + httpRequest.method = 'GET'; httpRequest.url = requestUrl; httpRequest.headers = {}; // Set Headers @@ -136,28 +222,14 @@ function _create(resourceGroupName, automationAccountName, compilationJobId, par } } } - // Serialize Request - let requestContent = null; - let requestModel = null; - try { - if (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['DscCompilationJobCreateParameters']().mapper(); - requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(parameters, null, 2)}.`); - return callback(serializationError); - } - httpRequest.body = requestContent; + httpRequest.body = null; // Send Request return client.pipeline(httpRequest, (err, response, responseBody) => { if (err) { return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 201) { + if (statusCode !== 200) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -187,7 +259,7 @@ function _create(resourceGroupName, automationAccountName, compilationJobId, par let result = null; if (responseBody === '') responseBody = null; // Deserialize Response - if (statusCode === 201) { + if (statusCode === 200) { let parsedResponse = null; try { parsedResponse = JSON.parse(responseBody); @@ -209,16 +281,16 @@ function _create(resourceGroupName, automationAccountName, compilationJobId, par } /** - * Retrieve the Dsc configuration compilation job identified by job id. - * - * @param {string} resourceGroupName The resource group name. + * Retrieve a list of dsc compilation jobs. * - * @param {string} automationAccountName The automation account name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {uuid} compilationJobId The Dsc configuration compilation job id. + * @param {string} automationAccountName The name of the automation account. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.filter] The filter to apply on the operation. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -229,13 +301,14 @@ function _create(resourceGroupName, automationAccountName, compilationJobId, par * {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 DscCompilationJob} for more information. + * See {@link DscCompilationJobListResult} 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, automationAccountName, compilationJobId, options, callback) { +function _listByAutomationAccount(resourceGroupName, automationAccountName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -245,12 +318,22 @@ function _get(resourceGroupName, automationAccountName, compilationJobId, option if (!callback) { throw new Error('callback cannot be null.'); } + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let apiVersion = '2018-01-15'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -259,15 +342,12 @@ function _get(resourceGroupName, automationAccountName, compilationJobId, option if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); } - if (compilationJobId === null || compilationJobId === undefined || typeof compilationJobId.valueOf() !== 'string' || !msRest.isValidUuid(compilationJobId)) { - throw new Error('compilationJobId cannot be null or undefined and it must be of type string and must be a valid uuid.'); + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -277,13 +357,15 @@ function _get(resourceGroupName, automationAccountName, compilationJobId, option // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{compilationJobId}'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); - requestUrl = requestUrl.replace('{compilationJobId}', encodeURIComponent(compilationJobId.toString())); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -351,7 +433,7 @@ function _get(resourceGroupName, automationAccountName, compilationJobId, option parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['DscCompilationJob']().mapper(); + let resultMapper = new client.models['DscCompilationJobListResult']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -367,15 +449,17 @@ function _get(resourceGroupName, automationAccountName, compilationJobId, option } /** - * Retrieve a list of dsc compilation jobs. + * Retrieve the job stream identified by job stream id. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {object} [options] Optional Parameters. + * @param {uuid} jobId The job id. * - * @param {string} [options.filter] The filter to apply on the operation. + * @param {string} jobStreamId The job stream id. + * + * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -387,14 +471,13 @@ function _get(resourceGroupName, automationAccountName, compilationJobId, option * {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 DscCompilationJobListResult} for more - * information. + * See {@link JobStream} 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 _listByAutomationAccount(resourceGroupName, automationAccountName, options, callback) { +function _getStream(resourceGroupName, automationAccountName, jobId, jobStreamId, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -404,13 +487,21 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti if (!callback) { throw new Error('callback cannot be null.'); } - let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let apiVersion = '2018-01-15'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -419,15 +510,15 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); } - if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { - throw new Error('filter must be of type string.'); + if (jobId === null || jobId === undefined || typeof jobId.valueOf() !== 'string' || !msRest.isValidUuid(jobId)) { + throw new Error('jobId cannot be null or undefined and it must be of type string and must be a valid uuid.'); + } + if (jobStreamId === null || jobStreamId === undefined || typeof jobStreamId.valueOf() !== 'string') { + throw new Error('jobStreamId cannot be null or undefined and it must be of type string.'); } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -437,15 +528,14 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{jobId}/streams/{jobStreamId}'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{jobId}', encodeURIComponent(jobId.toString())); + requestUrl = requestUrl.replace('{jobStreamId}', encodeURIComponent(jobStreamId)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - if (filter !== null && filter !== undefined) { - queryParameters.push('$filter=' + encodeURIComponent(filter)); - } - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -513,7 +603,7 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['DscCompilationJobListResult']().mapper(); + let resultMapper = new client.models['JobStream']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -529,15 +619,35 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti } /** - * Retrieve the job stream identified by job stream id. + * Creates the Dsc compilation job of the configuration. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {uuid} jobId The job id. + * @param {string} compilationJobName The the DSC configuration Id. * - * @param {string} jobStreamId The job stream id. + * @param {object} parameters The parameters supplied to the create compilation + * job operation. + * + * @param {object} parameters.configuration Gets or sets the configuration. + * + * @param {string} [parameters.configuration.name] Gets or sets the name of the + * Dsc configuration. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * job. + * + * @param {boolean} [parameters.newNodeConfigurationBuildVersionRequired] If a + * new build version of NodeConfiguration is required. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. * * @param {object} [options] Optional Parameters. * @@ -551,13 +661,13 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. - * See {@link JobStream} for more information. + * See {@link DscCompilationJob} 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 _getStream(resourceGroupName, automationAccountName, jobId, jobStreamId, options, callback) { +function _beginCreate(resourceGroupName, automationAccountName, compilationJobName, parameters, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -567,12 +677,21 @@ function _getStream(resourceGroupName, automationAccountName, jobId, jobStreamId if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2018-01-15'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -581,18 +700,15 @@ function _getStream(resourceGroupName, automationAccountName, jobId, jobStreamId if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); } - if (jobId === null || jobId === undefined || typeof jobId.valueOf() !== 'string' || !msRest.isValidUuid(jobId)) { - throw new Error('jobId cannot be null or undefined and it must be of type string and must be a valid uuid.'); + if (compilationJobName === null || compilationJobName === undefined || typeof compilationJobName.valueOf() !== 'string') { + throw new Error('compilationJobName cannot be null or undefined and it must be of type string.'); } - if (jobStreamId === null || jobStreamId === undefined || typeof jobStreamId.valueOf() !== 'string') { - throw new Error('jobStreamId cannot be null or undefined and it must be of type string.'); + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); } 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -602,21 +718,20 @@ function _getStream(resourceGroupName, automationAccountName, jobId, jobStreamId // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{jobId}/streams/{jobStreamId}'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{compilationJobName}'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); - requestUrl = requestUrl.replace('{jobId}', encodeURIComponent(jobId.toString())); - requestUrl = requestUrl.replace('{jobStreamId}', encodeURIComponent(jobStreamId)); + requestUrl = requestUrl.replace('{compilationJobName}', encodeURIComponent(compilationJobName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } // Create HTTP transport objects let httpRequest = new WebResource(); - httpRequest.method = 'GET'; + httpRequest.method = 'PUT'; httpRequest.url = requestUrl; httpRequest.headers = {}; // Set Headers @@ -634,14 +749,28 @@ function _getStream(resourceGroupName, automationAccountName, jobId, jobStreamId } } } - httpRequest.body = null; + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['DscCompilationJobCreateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; // Send Request return client.pipeline(httpRequest, (err, response, responseBody) => { if (err) { return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200) { + if (statusCode !== 201) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -671,13 +800,13 @@ function _getStream(resourceGroupName, automationAccountName, jobId, jobStreamId let result = null; if (responseBody === '') responseBody = null; // Deserialize Response - if (statusCode === 200) { + 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['JobStream']().mapper(); + let resultMapper = new client.models['DscCompilationJob']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -833,17 +962,18 @@ class DscCompilationJobOperations { this._get = _get; this._listByAutomationAccount = _listByAutomationAccount; this._getStream = _getStream; + this._beginCreate = _beginCreate; this._listByAutomationAccountNext = _listByAutomationAccountNext; } /** * Creates the Dsc compilation job of the configuration. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {uuid} compilationJobId The the DSC configuration Id. + * @param {string} compilationJobName The the DSC configuration Id. * * @param {object} parameters The parameters supplied to the create compilation * job operation. @@ -856,6 +986,9 @@ class DscCompilationJobOperations { * @param {object} [parameters.parameters] Gets or sets the parameters of the * job. * + * @param {boolean} [parameters.newNodeConfigurationBuildVersionRequired] If a + * new build version of NodeConfiguration is required. + * * @param {string} [parameters.name] Gets or sets name of the resource. * * @param {string} [parameters.location] Gets or sets the location of the @@ -875,11 +1008,11 @@ class DscCompilationJobOperations { * * @reject {Error} - The error object. */ - createWithHttpOperationResponse(resourceGroupName, automationAccountName, compilationJobId, parameters, options) { + createWithHttpOperationResponse(resourceGroupName, automationAccountName, compilationJobName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._create(resourceGroupName, automationAccountName, compilationJobId, parameters, options, (err, result, request, response) => { + self._create(resourceGroupName, automationAccountName, compilationJobName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -892,11 +1025,11 @@ class DscCompilationJobOperations { /** * Creates the Dsc compilation job of the configuration. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {uuid} compilationJobId The the DSC configuration Id. + * @param {string} compilationJobName The the DSC configuration Id. * * @param {object} parameters The parameters supplied to the create compilation * job operation. @@ -909,6 +1042,9 @@ class DscCompilationJobOperations { * @param {object} [parameters.parameters] Gets or sets the parameters of the * job. * + * @param {boolean} [parameters.newNodeConfigurationBuildVersionRequired] If a + * new build version of NodeConfiguration is required. + * * @param {string} [parameters.name] Gets or sets name of the resource. * * @param {string} [parameters.location] Gets or sets the location of the @@ -944,7 +1080,7 @@ class DscCompilationJobOperations { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - create(resourceGroupName, automationAccountName, compilationJobId, parameters, options, optionalCallback) { + create(resourceGroupName, automationAccountName, compilationJobName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -953,25 +1089,25 @@ class DscCompilationJobOperations { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._create(resourceGroupName, automationAccountName, compilationJobId, parameters, options, (err, result, request, response) => { + self._create(resourceGroupName, automationAccountName, compilationJobName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._create(resourceGroupName, automationAccountName, compilationJobId, parameters, options, optionalCallback); + return self._create(resourceGroupName, automationAccountName, compilationJobName, parameters, options, optionalCallback); } } /** * Retrieve the Dsc configuration compilation job identified by job id. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {uuid} compilationJobId The Dsc configuration compilation job id. + * @param {string} compilationJobName The the DSC configuration Id. * * @param {object} [options] Optional Parameters. * @@ -984,11 +1120,11 @@ class DscCompilationJobOperations { * * @reject {Error} - The error object. */ - getWithHttpOperationResponse(resourceGroupName, automationAccountName, compilationJobId, options) { + getWithHttpOperationResponse(resourceGroupName, automationAccountName, compilationJobName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._get(resourceGroupName, automationAccountName, compilationJobId, options, (err, result, request, response) => { + self._get(resourceGroupName, automationAccountName, compilationJobName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -1001,11 +1137,11 @@ class DscCompilationJobOperations { /** * Retrieve the Dsc configuration compilation job identified by job id. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {uuid} compilationJobId The Dsc configuration compilation job id. + * @param {string} compilationJobName The the DSC configuration Id. * * @param {object} [options] Optional Parameters. * @@ -1034,7 +1170,7 @@ class DscCompilationJobOperations { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - get(resourceGroupName, automationAccountName, compilationJobId, options, optionalCallback) { + get(resourceGroupName, automationAccountName, compilationJobName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -1043,23 +1179,23 @@ class DscCompilationJobOperations { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._get(resourceGroupName, automationAccountName, compilationJobId, options, (err, result, request, response) => { + self._get(resourceGroupName, automationAccountName, compilationJobName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._get(resourceGroupName, automationAccountName, compilationJobId, options, optionalCallback); + return self._get(resourceGroupName, automationAccountName, compilationJobName, options, optionalCallback); } } /** * Retrieve a list of dsc compilation jobs. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {object} [options] Optional Parameters. * @@ -1091,9 +1227,9 @@ class DscCompilationJobOperations { /** * Retrieve a list of dsc compilation jobs. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {object} [options] Optional Parameters. * @@ -1148,9 +1284,9 @@ class DscCompilationJobOperations { /** * Retrieve the job stream identified by job stream id. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {uuid} jobId The job id. * @@ -1184,9 +1320,9 @@ class DscCompilationJobOperations { /** * Retrieve the job stream identified by job stream id. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {uuid} jobId The job id. * @@ -1239,6 +1375,140 @@ class DscCompilationJobOperations { } } + /** + * Creates the Dsc compilation job of the configuration. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} compilationJobName The the DSC configuration Id. + * + * @param {object} parameters The parameters supplied to the create compilation + * job operation. + * + * @param {object} parameters.configuration Gets or sets the configuration. + * + * @param {string} [parameters.configuration.name] Gets or sets the name of the + * Dsc configuration. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * job. + * + * @param {boolean} [parameters.newNodeConfigurationBuildVersionRequired] If a + * new build version of NodeConfiguration is required. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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. + */ + beginCreateWithHttpOperationResponse(resourceGroupName, automationAccountName, compilationJobName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreate(resourceGroupName, automationAccountName, compilationJobName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates the Dsc compilation job of the configuration. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} compilationJobName The the DSC configuration Id. + * + * @param {object} parameters The parameters supplied to the create compilation + * job operation. + * + * @param {object} parameters.configuration Gets or sets the configuration. + * + * @param {string} [parameters.configuration.name] Gets or sets the name of the + * Dsc configuration. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * job. + * + * @param {boolean} [parameters.newNodeConfigurationBuildVersionRequired] If a + * new build version of NodeConfiguration is required. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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 {DscCompilationJob} - 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 DscCompilationJob} 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. + */ + beginCreate(resourceGroupName, automationAccountName, compilationJobName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreate(resourceGroupName, automationAccountName, compilationJobName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreate(resourceGroupName, automationAccountName, compilationJobName, parameters, options, optionalCallback); + } + } + /** * Retrieve a list of dsc compilation jobs. * diff --git a/lib/services/automationManagement/lib/operations/dscCompilationJobStream.js b/lib/services/automationManagement/lib/operations/dscCompilationJobStream.js new file mode 100644 index 0000000000..aa55a43755 --- /dev/null +++ b/lib/services/automationManagement/lib/operations/dscCompilationJobStream.js @@ -0,0 +1,284 @@ +/* + * 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; + +/** + * Retrieve all the job streams for the compilation Job. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {uuid} jobId The job id. + * + * @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 JobStreamListResult} 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 _listByJob(resourceGroupName, automationAccountName, jobId, 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 apiVersion = '2018-01-15'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (jobId === null || jobId === undefined || typeof jobId.valueOf() !== 'string' || !msRest.isValidUuid(jobId)) { + throw new Error('jobId cannot be null or undefined and it must be of type string and must be a valid uuid.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{jobId}/streams'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{jobId}', encodeURIComponent(jobId.toString())); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['JobStreamListResult']().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 DscCompilationJobStream. */ +class DscCompilationJobStream { + /** + * Create a DscCompilationJobStream. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listByJob = _listByJob; + } + + /** + * Retrieve all the job streams for the compilation Job. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {uuid} jobId The job id. + * + * @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. + */ + listByJobWithHttpOperationResponse(resourceGroupName, automationAccountName, jobId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByJob(resourceGroupName, automationAccountName, jobId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve all the job streams for the compilation Job. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {uuid} jobId The job id. + * + * @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 {JobStreamListResult} - 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 JobStreamListResult} 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. + */ + listByJob(resourceGroupName, automationAccountName, jobId, 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._listByJob(resourceGroupName, automationAccountName, jobId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByJob(resourceGroupName, automationAccountName, jobId, options, optionalCallback); + } + } + +} + +module.exports = DscCompilationJobStream; diff --git a/lib/services/automationManagement/lib/operations/dscConfigurationOperations.js b/lib/services/automationManagement/lib/operations/dscConfigurationOperations.js index 6cdfe616bb..8fb422a481 100644 --- a/lib/services/automationManagement/lib/operations/dscConfigurationOperations.js +++ b/lib/services/automationManagement/lib/operations/dscConfigurationOperations.js @@ -17,7 +17,7 @@ const WebResource = msRest.WebResource; /** * Delete the dsc configuration identified by configuration name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -50,12 +50,21 @@ function _deleteMethod(resourceGroupName, automationAccountName, configurationNa if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -70,9 +79,6 @@ function _deleteMethod(resourceGroupName, automationAccountName, configurationNa 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -88,7 +94,7 @@ function _deleteMethod(resourceGroupName, automationAccountName, configurationNa requestUrl = requestUrl.replace('{configurationName}', encodeURIComponent(configurationName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -157,7 +163,7 @@ function _deleteMethod(resourceGroupName, automationAccountName, configurationNa /** * Retrieve the configuration identified by configuration name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -191,12 +197,21 @@ function _get(resourceGroupName, automationAccountName, configurationName, optio if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -211,9 +226,6 @@ function _get(resourceGroupName, automationAccountName, configurationName, optio 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -229,7 +241,7 @@ function _get(resourceGroupName, automationAccountName, configurationName, optio requestUrl = requestUrl.replace('{configurationName}', encodeURIComponent(configurationName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -315,7 +327,7 @@ function _get(resourceGroupName, automationAccountName, configurationName, optio /** * Create the configuration identified by configuration name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -390,12 +402,21 @@ function _createOrUpdate(resourceGroupName, automationAccountName, configuration if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -413,9 +434,6 @@ function _createOrUpdate(resourceGroupName, automationAccountName, configuration 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -431,7 +449,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, configuration requestUrl = requestUrl.replace('{configurationName}', encodeURIComponent(configurationName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -545,10 +563,229 @@ function _createOrUpdate(resourceGroupName, automationAccountName, configuration }); } +/** + * Create the configuration identified by configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} configurationName The create or update parameters for + * configuration. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.parameters] The create or update parameters for + * configuration. + * + * @param {boolean} [options.parameters.logVerbose] Gets or sets verbose log + * option. + * + * @param {boolean} [options.parameters.logProgress] Gets or sets progress log + * option. + * + * @param {object} options.parameters.source Gets or sets the source. + * + * @param {object} [options.parameters.source.hash] Gets or sets the hash. + * + * @param {string} options.parameters.source.hash.algorithm Gets or sets the + * content hash algorithm used to hash the content. + * + * @param {string} options.parameters.source.hash.value Gets or sets expected + * hash value of the content. + * + * @param {string} [options.parameters.source.type] Gets or sets the content + * source type. Possible values include: 'embeddedContent', 'uri' + * + * @param {string} [options.parameters.source.value] Gets or sets the value of + * the content. This is based on the content source type. + * + * @param {string} [options.parameters.source.version] Gets or sets the version + * of the content. + * + * @param {object} [options.parameters.parameters] Gets or sets the + * configuration parameters. + * + * @param {string} [options.parameters.description] Gets or sets the + * description of the configuration. + * + * @param {string} [options.parameters.name] Gets or sets name of the resource. + * + * @param {object} [options.parameters.tags] Gets or sets the tags attached to + * the resource. + * + * @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 DscConfiguration} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, automationAccountName, configurationName, 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 parameters = (options && options.parameters !== undefined) ? options.parameters : undefined; + let apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (configurationName === null || configurationName === undefined || typeof configurationName.valueOf() !== 'string') { + throw new Error('configurationName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{configurationName}', encodeURIComponent(configurationName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['DscConfigurationUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DscConfiguration']().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); + }); +} + /** * Retrieve the configuration script identified by configuration name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -565,7 +802,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, configuration * * {Error} err - The Error object if an error occurred, null otherwise. * - * {object} [result] - The deserialized result object if an error did not occur. + * {string} [result] - The deserialized result object if an error did not occur. * * {object} [request] - The HTTP Request object if an error did not occur. * @@ -581,12 +818,21 @@ function _getContent(resourceGroupName, automationAccountName, configurationName if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -601,9 +847,6 @@ function _getContent(resourceGroupName, automationAccountName, configurationName 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -619,7 +862,7 @@ function _getContent(resourceGroupName, automationAccountName, configurationName requestUrl = requestUrl.replace('{configurationName}', encodeURIComponent(configurationName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -646,22 +889,20 @@ function _getContent(resourceGroupName, automationAccountName, configurationName } httpRequest.body = null; // Send Request - httpRequest.streamedResponse = true; return client.pipeline(httpRequest, (err, response, responseBody) => { if (err) { return callback(err); } - let statusCode = response.statusCode; if (statusCode !== 200) { - let error = new Error(`Unexpected status code: ${statusCode}`); + 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 { - if (responseBody !== undefined) parsedErrorResponse = JSON.parse(responseBody); + parsedErrorResponse = JSON.parse(responseBody); if (parsedErrorResponse) { let internalError = null; if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; @@ -679,9 +920,33 @@ function _getContent(resourceGroupName, automationAccountName, configurationName } return callback(error); } - // Create Result - let result = response; + 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 = { + required: false, + serializedName: 'parsedResponse', + type: { + name: 'String' + } + }; + 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); }); } @@ -689,7 +954,7 @@ function _getContent(resourceGroupName, automationAccountName, configurationName /** * Retrieve a list of configurations. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -722,12 +987,21 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -739,9 +1013,6 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -756,7 +1027,7 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -979,6 +1250,7 @@ class DscConfigurationOperations { this._deleteMethod = _deleteMethod; this._get = _get; this._createOrUpdate = _createOrUpdate; + this._update = _update; this._getContent = _getContent; this._listByAutomationAccount = _listByAutomationAccount; this._listByAutomationAccountNext = _listByAutomationAccountNext; @@ -987,7 +1259,7 @@ class DscConfigurationOperations { /** * Delete the dsc configuration identified by configuration name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1021,7 +1293,7 @@ class DscConfigurationOperations { /** * Delete the dsc configuration identified by configuration name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1076,7 +1348,7 @@ class DscConfigurationOperations { /** * Retrieve the configuration identified by configuration name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1110,7 +1382,7 @@ class DscConfigurationOperations { /** * Retrieve the configuration identified by configuration name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1166,7 +1438,7 @@ class DscConfigurationOperations { /** * Create the configuration identified by configuration name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1241,7 +1513,7 @@ class DscConfigurationOperations { /** * Create the configuration identified by configuration name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1335,10 +1607,180 @@ class DscConfigurationOperations { } } + /** + * Create the configuration identified by configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} configurationName The create or update parameters for + * configuration. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.parameters] The create or update parameters for + * configuration. + * + * @param {boolean} [options.parameters.logVerbose] Gets or sets verbose log + * option. + * + * @param {boolean} [options.parameters.logProgress] Gets or sets progress log + * option. + * + * @param {object} options.parameters.source Gets or sets the source. + * + * @param {object} [options.parameters.source.hash] Gets or sets the hash. + * + * @param {string} options.parameters.source.hash.algorithm Gets or sets the + * content hash algorithm used to hash the content. + * + * @param {string} options.parameters.source.hash.value Gets or sets expected + * hash value of the content. + * + * @param {string} [options.parameters.source.type] Gets or sets the content + * source type. Possible values include: 'embeddedContent', 'uri' + * + * @param {string} [options.parameters.source.value] Gets or sets the value of + * the content. This is based on the content source type. + * + * @param {string} [options.parameters.source.version] Gets or sets the version + * of the content. + * + * @param {object} [options.parameters.parameters] Gets or sets the + * configuration parameters. + * + * @param {string} [options.parameters.description] Gets or sets the + * description of the configuration. + * + * @param {string} [options.parameters.name] Gets or sets name of the resource. + * + * @param {object} [options.parameters.tags] Gets or sets the tags attached to + * the resource. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName, automationAccountName, configurationName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, automationAccountName, configurationName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create the configuration identified by configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} configurationName The create or update parameters for + * configuration. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.parameters] The create or update parameters for + * configuration. + * + * @param {boolean} [options.parameters.logVerbose] Gets or sets verbose log + * option. + * + * @param {boolean} [options.parameters.logProgress] Gets or sets progress log + * option. + * + * @param {object} options.parameters.source Gets or sets the source. + * + * @param {object} [options.parameters.source.hash] Gets or sets the hash. + * + * @param {string} options.parameters.source.hash.algorithm Gets or sets the + * content hash algorithm used to hash the content. + * + * @param {string} options.parameters.source.hash.value Gets or sets expected + * hash value of the content. + * + * @param {string} [options.parameters.source.type] Gets or sets the content + * source type. Possible values include: 'embeddedContent', 'uri' + * + * @param {string} [options.parameters.source.value] Gets or sets the value of + * the content. This is based on the content source type. + * + * @param {string} [options.parameters.source.version] Gets or sets the version + * of the content. + * + * @param {object} [options.parameters.parameters] Gets or sets the + * configuration parameters. + * + * @param {string} [options.parameters.description] Gets or sets the + * description of the configuration. + * + * @param {string} [options.parameters.name] Gets or sets name of the resource. + * + * @param {object} [options.parameters.tags] Gets or sets the tags attached to + * the resource. + * + * @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 {DscConfiguration} - 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 DscConfiguration} 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. + */ + update(resourceGroupName, automationAccountName, configurationName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, automationAccountName, configurationName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, automationAccountName, configurationName, options, optionalCallback); + } + } + /** * Retrieve the configuration script identified by configuration name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1351,7 +1793,7 @@ class DscConfigurationOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ @@ -1372,7 +1814,7 @@ class DscConfigurationOperations { /** * Retrieve the configuration script identified by configuration name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1390,7 +1832,7 @@ class DscConfigurationOperations { * * {Promise} A promise is returned * - * @resolve {Object} - The deserialized result object. + * @resolve {String} - The deserialized result object. * * @reject {Error} - The error object. * @@ -1398,7 +1840,7 @@ class DscConfigurationOperations { * * {Error} err - The Error object if an error occurred, null otherwise. * - * {object} [result] - The deserialized result object if an error did not occur. + * {string} [result] - The deserialized result object if an error did not occur. * * {object} [request] - The HTTP Request object if an error did not occur. * @@ -1427,7 +1869,7 @@ class DscConfigurationOperations { /** * Retrieve a list of configurations. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1459,7 +1901,7 @@ class DscConfigurationOperations { /** * Retrieve a list of configurations. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * diff --git a/lib/services/automationManagement/lib/operations/dscNodeConfigurationOperations.js b/lib/services/automationManagement/lib/operations/dscNodeConfigurationOperations.js index 127b0969d5..6d8b0a61f0 100644 --- a/lib/services/automationManagement/lib/operations/dscNodeConfigurationOperations.js +++ b/lib/services/automationManagement/lib/operations/dscNodeConfigurationOperations.js @@ -17,9 +17,9 @@ const WebResource = msRest.WebResource; /** * Delete the Dsc node configurations by node configuration. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {string} nodeConfigurationName The Dsc node configuration name. * @@ -50,12 +50,24 @@ function _deleteMethod(resourceGroupName, automationAccountName, nodeConfigurati if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2018-01-15'; // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -67,12 +79,6 @@ function _deleteMethod(resourceGroupName, automationAccountName, nodeConfigurati if (nodeConfigurationName === null || nodeConfigurationName === undefined || typeof nodeConfigurationName.valueOf() !== 'string') { throw new Error('nodeConfigurationName cannot be null or undefined and it must be of type string.'); } - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -83,12 +89,12 @@ function _deleteMethod(resourceGroupName, automationAccountName, nodeConfigurati // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations/{nodeConfigurationName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); requestUrl = requestUrl.replace('{nodeConfigurationName}', encodeURIComponent(nodeConfigurationName)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -157,9 +163,9 @@ function _deleteMethod(resourceGroupName, automationAccountName, nodeConfigurati /** * Retrieve the Dsc node configurations by node configuration. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {string} nodeConfigurationName The Dsc node configuration name. * @@ -191,12 +197,24 @@ function _get(resourceGroupName, automationAccountName, nodeConfigurationName, o if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2018-01-15'; // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -208,12 +226,6 @@ function _get(resourceGroupName, automationAccountName, nodeConfigurationName, o if (nodeConfigurationName === null || nodeConfigurationName === undefined || typeof nodeConfigurationName.valueOf() !== 'string') { throw new Error('nodeConfigurationName cannot be null or undefined and it must be of type string.'); } - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -224,12 +236,12 @@ function _get(resourceGroupName, automationAccountName, nodeConfigurationName, o // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations/{nodeConfigurationName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); requestUrl = requestUrl.replace('{nodeConfigurationName}', encodeURIComponent(nodeConfigurationName)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -312,15 +324,15 @@ function _get(resourceGroupName, automationAccountName, nodeConfigurationName, o }); } + /** * Create the node configuration identified by node configuration name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} nodeConfigurationName The create or update parameters for - * configuration. + * @param {string} nodeConfigurationName The Dsc node configuration name. * * @param {object} parameters The create or update parameters for * configuration. @@ -352,6 +364,9 @@ function _get(resourceGroupName, automationAccountName, nodeConfigurationName, o * @param {string} [parameters.configuration.name] Gets or sets the name of the * Dsc configuration. * + * @param {boolean} [parameters.incrementNodeConfigurationBuild] If a new build + * version of NodeConfiguration is required. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -377,15 +392,105 @@ function _createOrUpdate(resourceGroupName, automationAccountName, nodeConfigura callback = options; options = null; } + if (!callback) { throw new Error('callback cannot be null.'); } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, automationAccountName, nodeConfigurationName, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DscNodeConfiguration']().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); + }); + }); +} + +/** + * Retrieve a list of dsc node configurations. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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 DscNodeConfigurationListResult} 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 _listByAutomationAccount(resourceGroupName, automationAccountName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let apiVersion = '2018-01-15'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -394,17 +499,11 @@ function _createOrUpdate(resourceGroupName, automationAccountName, nodeConfigura if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); } - if (nodeConfigurationName === null || nodeConfigurationName === undefined || typeof nodeConfigurationName.valueOf() !== 'string') { - throw new Error('nodeConfigurationName cannot be null or undefined and it must be of type string.'); - } - if (parameters === null || parameters === undefined) { - throw new Error('parameters cannot be null or undefined.'); - } 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter 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.'); @@ -415,20 +514,22 @@ function _createOrUpdate(resourceGroupName, automationAccountName, nodeConfigura // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations/{nodeConfigurationName}'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); - requestUrl = requestUrl.replace('{nodeConfigurationName}', encodeURIComponent(nodeConfigurationName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } // Create HTTP transport objects let httpRequest = new WebResource(); - httpRequest.method = 'PUT'; + httpRequest.method = 'GET'; httpRequest.url = requestUrl; httpRequest.headers = {}; // Set Headers @@ -446,28 +547,14 @@ function _createOrUpdate(resourceGroupName, automationAccountName, nodeConfigura } } } - // Serialize Request - let requestContent = null; - let requestModel = null; - try { - if (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['DscNodeConfigurationCreateOrUpdateParameters']().mapper(); - requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(parameters, null, 2)}.`); - return callback(serializationError); - } - httpRequest.body = requestContent; + httpRequest.body = null; // Send Request return client.pipeline(httpRequest, (err, response, responseBody) => { if (err) { return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 201) { + if (statusCode !== 200) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -503,7 +590,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, nodeConfigura parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['DscNodeConfiguration']().mapper(); + let resultMapper = new client.models['DscNodeConfigurationListResult']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -513,38 +600,54 @@ function _createOrUpdate(resourceGroupName, automationAccountName, nodeConfigura 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['DscNodeConfiguration']().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); }); } /** - * Retrieve a list of dsc node configurations. + * Create the node configuration identified by node configuration name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {object} [options] Optional Parameters. + * @param {string} nodeConfigurationName The Dsc node configuration name. * - * @param {string} [options.filter] The filter to apply on the operation. + * @param {object} parameters The create or update parameters for + * configuration. + * + * @param {object} parameters.source Gets or sets the source. + * + * @param {object} [parameters.source.hash] Gets or sets the hash. + * + * @param {string} parameters.source.hash.algorithm Gets or sets the content + * hash algorithm used to hash the content. + * + * @param {string} parameters.source.hash.value Gets or sets expected hash + * value of the content. + * + * @param {string} [parameters.source.type] Gets or sets the content source + * type. Possible values include: 'embeddedContent', 'uri' + * + * @param {string} [parameters.source.value] Gets or sets the value of the + * content. This is based on the content source type. + * + * @param {string} [parameters.source.version] Gets or sets the version of the + * content. + * + * @param {string} parameters.name Gets or sets the type of the parameter. + * + * @param {object} parameters.configuration Gets or sets the configuration of + * the node. + * + * @param {string} [parameters.configuration.name] Gets or sets the name of the + * Dsc configuration. + * + * @param {boolean} [parameters.incrementNodeConfigurationBuild] If a new build + * version of NodeConfiguration is required. + * + * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -556,14 +659,13 @@ function _createOrUpdate(resourceGroupName, automationAccountName, nodeConfigura * {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 DscNodeConfigurationListResult} for more - * information. + * See {@link DscNodeConfiguration} 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 _listByAutomationAccount(resourceGroupName, automationAccountName, options, callback) { +function _beginCreateOrUpdate(resourceGroupName, automationAccountName, nodeConfigurationName, parameters, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -573,13 +675,21 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti if (!callback) { throw new Error('callback cannot be null.'); } - let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let apiVersion = '2018-01-15'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -588,15 +698,15 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); } - if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { - throw new Error('filter must be of type string.'); + if (nodeConfigurationName === null || nodeConfigurationName === undefined || typeof nodeConfigurationName.valueOf() !== 'string') { + throw new Error('nodeConfigurationName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); } 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -606,22 +716,20 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations/{nodeConfigurationName}'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{nodeConfigurationName}', encodeURIComponent(nodeConfigurationName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - if (filter !== null && filter !== undefined) { - queryParameters.push('$filter=' + encodeURIComponent(filter)); - } - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } // Create HTTP transport objects let httpRequest = new WebResource(); - httpRequest.method = 'GET'; + httpRequest.method = 'PUT'; httpRequest.url = requestUrl; httpRequest.headers = {}; // Set Headers @@ -639,14 +747,28 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti } } } - httpRequest.body = null; + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['DscNodeConfigurationCreateOrUpdateParametersProperties']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; // Send Request return client.pipeline(httpRequest, (err, response, responseBody) => { if (err) { return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200) { + if (statusCode !== 200 && statusCode !== 201) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -676,13 +798,13 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti let result = null; if (responseBody === '') responseBody = null; // Deserialize Response - if (statusCode === 200) { + 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['DscNodeConfigurationListResult']().mapper(); + let resultMapper = new client.models['DscNodeConfiguration']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -838,15 +960,16 @@ class DscNodeConfigurationOperations { this._get = _get; this._createOrUpdate = _createOrUpdate; this._listByAutomationAccount = _listByAutomationAccount; + this._beginCreateOrUpdate = _beginCreateOrUpdate; this._listByAutomationAccountNext = _listByAutomationAccountNext; } /** * Delete the Dsc node configurations by node configuration. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {string} nodeConfigurationName The Dsc node configuration name. * @@ -878,9 +1001,9 @@ class DscNodeConfigurationOperations { /** * Delete the Dsc node configurations by node configuration. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {string} nodeConfigurationName The Dsc node configuration name. * @@ -933,9 +1056,9 @@ class DscNodeConfigurationOperations { /** * Retrieve the Dsc node configurations by node configuration. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {string} nodeConfigurationName The Dsc node configuration name. * @@ -967,9 +1090,9 @@ class DscNodeConfigurationOperations { /** * Retrieve the Dsc node configurations by node configuration. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {string} nodeConfigurationName The Dsc node configuration name. * @@ -1023,12 +1146,11 @@ class DscNodeConfigurationOperations { /** * Create the node configuration identified by node configuration name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} nodeConfigurationName The create or update parameters for - * configuration. + * @param {string} nodeConfigurationName The Dsc node configuration name. * * @param {object} parameters The create or update parameters for * configuration. @@ -1060,6 +1182,9 @@ class DscNodeConfigurationOperations { * @param {string} [parameters.configuration.name] Gets or sets the name of the * Dsc configuration. * + * @param {boolean} [parameters.incrementNodeConfigurationBuild] If a new build + * version of NodeConfiguration is required. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1088,12 +1213,11 @@ class DscNodeConfigurationOperations { /** * Create the node configuration identified by node configuration name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} nodeConfigurationName The create or update parameters for - * configuration. + * @param {string} nodeConfigurationName The Dsc node configuration name. * * @param {object} parameters The create or update parameters for * configuration. @@ -1125,6 +1249,9 @@ class DscNodeConfigurationOperations { * @param {string} [parameters.configuration.name] Gets or sets the name of the * Dsc configuration. * + * @param {boolean} [parameters.incrementNodeConfigurationBuild] If a new build + * version of NodeConfiguration is required. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1175,9 +1302,9 @@ class DscNodeConfigurationOperations { /** * Retrieve a list of dsc node configurations. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {object} [options] Optional Parameters. * @@ -1209,9 +1336,9 @@ class DscNodeConfigurationOperations { /** * Retrieve a list of dsc node configurations. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {object} [options] Optional Parameters. * @@ -1263,6 +1390,162 @@ class DscNodeConfigurationOperations { } } + /** + * Create the node configuration identified by node configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeConfigurationName The Dsc node configuration name. + * + * @param {object} parameters The create or update parameters for + * configuration. + * + * @param {object} parameters.source Gets or sets the source. + * + * @param {object} [parameters.source.hash] Gets or sets the hash. + * + * @param {string} parameters.source.hash.algorithm Gets or sets the content + * hash algorithm used to hash the content. + * + * @param {string} parameters.source.hash.value Gets or sets expected hash + * value of the content. + * + * @param {string} [parameters.source.type] Gets or sets the content source + * type. Possible values include: 'embeddedContent', 'uri' + * + * @param {string} [parameters.source.value] Gets or sets the value of the + * content. This is based on the content source type. + * + * @param {string} [parameters.source.version] Gets or sets the version of the + * content. + * + * @param {string} parameters.name Gets or sets the type of the parameter. + * + * @param {object} parameters.configuration Gets or sets the configuration of + * the node. + * + * @param {string} [parameters.configuration.name] Gets or sets the name of the + * Dsc configuration. + * + * @param {boolean} [parameters.incrementNodeConfigurationBuild] If a new build + * version of NodeConfiguration is required. + * + * @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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, automationAccountName, nodeConfigurationName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, automationAccountName, nodeConfigurationName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create the node configuration identified by node configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeConfigurationName The Dsc node configuration name. + * + * @param {object} parameters The create or update parameters for + * configuration. + * + * @param {object} parameters.source Gets or sets the source. + * + * @param {object} [parameters.source.hash] Gets or sets the hash. + * + * @param {string} parameters.source.hash.algorithm Gets or sets the content + * hash algorithm used to hash the content. + * + * @param {string} parameters.source.hash.value Gets or sets expected hash + * value of the content. + * + * @param {string} [parameters.source.type] Gets or sets the content source + * type. Possible values include: 'embeddedContent', 'uri' + * + * @param {string} [parameters.source.value] Gets or sets the value of the + * content. This is based on the content source type. + * + * @param {string} [parameters.source.version] Gets or sets the version of the + * content. + * + * @param {string} parameters.name Gets or sets the type of the parameter. + * + * @param {object} parameters.configuration Gets or sets the configuration of + * the node. + * + * @param {string} [parameters.configuration.name] Gets or sets the name of the + * Dsc configuration. + * + * @param {boolean} [parameters.incrementNodeConfigurationBuild] If a new build + * version of NodeConfiguration is required. + * + * @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 {DscNodeConfiguration} - 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 DscNodeConfiguration} 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. + */ + beginCreateOrUpdate(resourceGroupName, automationAccountName, nodeConfigurationName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, automationAccountName, nodeConfigurationName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, automationAccountName, nodeConfigurationName, parameters, options, optionalCallback); + } + } + /** * Retrieve a list of dsc node configurations. * diff --git a/lib/services/automationManagement/lib/operations/dscNodeOperations.js b/lib/services/automationManagement/lib/operations/dscNodeOperations.js index a33bfd96bb..16dd2a39b7 100644 --- a/lib/services/automationManagement/lib/operations/dscNodeOperations.js +++ b/lib/services/automationManagement/lib/operations/dscNodeOperations.js @@ -17,9 +17,9 @@ const WebResource = msRest.WebResource; /** * Delete the dsc node identified by node id. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName Automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {string} nodeId The node id. * @@ -51,12 +51,21 @@ function _deleteMethod(resourceGroupName, automationAccountName, nodeId, options if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2018-01-15'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -71,9 +80,6 @@ function _deleteMethod(resourceGroupName, automationAccountName, nodeId, options 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -89,7 +95,7 @@ function _deleteMethod(resourceGroupName, automationAccountName, nodeId, options requestUrl = requestUrl.replace('{nodeId}', encodeURIComponent(nodeId)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -175,9 +181,9 @@ function _deleteMethod(resourceGroupName, automationAccountName, nodeId, options /** * Retrieve the dsc node identified by node id. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {string} nodeId The node id. * @@ -209,12 +215,21 @@ function _get(resourceGroupName, automationAccountName, nodeId, options, callbac if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2018-01-15'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -229,9 +244,6 @@ function _get(resourceGroupName, automationAccountName, nodeId, options, callbac 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -247,7 +259,7 @@ function _get(resourceGroupName, automationAccountName, nodeId, options, callbac requestUrl = requestUrl.replace('{nodeId}', encodeURIComponent(nodeId)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -333,21 +345,28 @@ function _get(resourceGroupName, automationAccountName, nodeId, options, callbac /** * Update the dsc node. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {string} nodeId Parameters supplied to the update dsc node. * - * @param {object} parameters Parameters supplied to the update dsc node. + * @param {object} dscNodeUpdateParameters Parameters supplied to the update + * dsc node. * - * @param {string} [parameters.nodeId] Gets or sets the id of the dsc node. + * @param {string} [dscNodeUpdateParameters.nodeId] Gets or sets the id of the + * dsc node. * - * @param {object} [parameters.nodeConfiguration] Gets or sets the + * @param {object} [dscNodeUpdateParameters.nodeConfiguration] Gets or sets the * configuration of the node. * - * @param {string} [parameters.nodeConfiguration.name] Gets or sets the name of - * the dsc nodeconfiguration. + * @param {string} [dscNodeUpdateParameters.nodeConfiguration.name] Gets or + * sets the name of the dsc nodeconfiguration. + * + * @param {object} [dscNodeUpdateParameters.properties] + * + * @param {string} [dscNodeUpdateParameters.properties.name] Gets or sets the + * name of the dsc nodeconfiguration. * * @param {object} [options] Optional Parameters. * @@ -367,7 +386,7 @@ function _get(resourceGroupName, automationAccountName, nodeId, options, callbac * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _update(resourceGroupName, automationAccountName, nodeId, parameters, options, callback) { +function _update(resourceGroupName, automationAccountName, nodeId, dscNodeUpdateParameters, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -377,12 +396,21 @@ function _update(resourceGroupName, automationAccountName, nodeId, parameters, o if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2018-01-15'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -394,15 +422,12 @@ function _update(resourceGroupName, automationAccountName, nodeId, parameters, o if (nodeId === null || nodeId === undefined || typeof nodeId.valueOf() !== 'string') { throw new Error('nodeId cannot be null or undefined and it must be of type string.'); } - if (parameters === null || parameters === undefined) { - throw new Error('parameters cannot be null or undefined.'); + if (dscNodeUpdateParameters === null || dscNodeUpdateParameters === undefined) { + throw new Error('dscNodeUpdateParameters cannot be null or undefined.'); } 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -418,7 +443,7 @@ function _update(resourceGroupName, automationAccountName, nodeId, parameters, o requestUrl = requestUrl.replace('{nodeId}', encodeURIComponent(nodeId)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -447,14 +472,14 @@ function _update(resourceGroupName, automationAccountName, nodeId, parameters, o let requestContent = null; let requestModel = null; try { - if (parameters !== null && parameters !== undefined) { + if (dscNodeUpdateParameters !== null && dscNodeUpdateParameters !== undefined) { let requestModelMapper = new client.models['DscNodeUpdateParameters']().mapper(); - requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestModel = client.serialize(requestModelMapper, dscNodeUpdateParameters, 'dscNodeUpdateParameters'); requestContent = JSON.stringify(requestModel); } } catch (error) { let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(parameters, null, 2)}.`); + `payload - ${JSON.stringify(dscNodeUpdateParameters, null, 2)}.`); return callback(serializationError); } httpRequest.body = requestContent; @@ -518,9 +543,9 @@ function _update(resourceGroupName, automationAccountName, nodeId, parameters, o /** * Retrieve a list of dsc nodes. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {object} [options] Optional Parameters. * @@ -553,12 +578,21 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti throw new Error('callback cannot be null.'); } let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let apiVersion = '2018-01-15'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -573,9 +607,6 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -593,7 +624,7 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti if (filter !== null && filter !== undefined) { queryParameters.push('$filter=' + encodeURIComponent(filter)); } - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -822,9 +853,9 @@ class DscNodeOperations { /** * Delete the dsc node identified by node id. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName Automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {string} nodeId The node id. * @@ -856,9 +887,9 @@ class DscNodeOperations { /** * Delete the dsc node identified by node id. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName Automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {string} nodeId The node id. * @@ -912,9 +943,9 @@ class DscNodeOperations { /** * Retrieve the dsc node identified by node id. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {string} nodeId The node id. * @@ -946,9 +977,9 @@ class DscNodeOperations { /** * Retrieve the dsc node identified by node id. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {string} nodeId The node id. * @@ -1002,21 +1033,28 @@ class DscNodeOperations { /** * Update the dsc node. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {string} nodeId Parameters supplied to the update dsc node. * - * @param {object} parameters Parameters supplied to the update dsc node. + * @param {object} dscNodeUpdateParameters Parameters supplied to the update + * dsc node. * - * @param {string} [parameters.nodeId] Gets or sets the id of the dsc node. + * @param {string} [dscNodeUpdateParameters.nodeId] Gets or sets the id of the + * dsc node. * - * @param {object} [parameters.nodeConfiguration] Gets or sets the + * @param {object} [dscNodeUpdateParameters.nodeConfiguration] Gets or sets the * configuration of the node. * - * @param {string} [parameters.nodeConfiguration.name] Gets or sets the name of - * the dsc nodeconfiguration. + * @param {string} [dscNodeUpdateParameters.nodeConfiguration.name] Gets or + * sets the name of the dsc nodeconfiguration. + * + * @param {object} [dscNodeUpdateParameters.properties] + * + * @param {string} [dscNodeUpdateParameters.properties.name] Gets or sets the + * name of the dsc nodeconfiguration. * * @param {object} [options] Optional Parameters. * @@ -1029,11 +1067,11 @@ class DscNodeOperations { * * @reject {Error} - The error object. */ - updateWithHttpOperationResponse(resourceGroupName, automationAccountName, nodeId, parameters, options) { + updateWithHttpOperationResponse(resourceGroupName, automationAccountName, nodeId, dscNodeUpdateParameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._update(resourceGroupName, automationAccountName, nodeId, parameters, options, (err, result, request, response) => { + self._update(resourceGroupName, automationAccountName, nodeId, dscNodeUpdateParameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -1046,21 +1084,28 @@ class DscNodeOperations { /** * Update the dsc node. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {string} nodeId Parameters supplied to the update dsc node. * - * @param {object} parameters Parameters supplied to the update dsc node. + * @param {object} dscNodeUpdateParameters Parameters supplied to the update + * dsc node. * - * @param {string} [parameters.nodeId] Gets or sets the id of the dsc node. + * @param {string} [dscNodeUpdateParameters.nodeId] Gets or sets the id of the + * dsc node. * - * @param {object} [parameters.nodeConfiguration] Gets or sets the + * @param {object} [dscNodeUpdateParameters.nodeConfiguration] Gets or sets the * configuration of the node. * - * @param {string} [parameters.nodeConfiguration.name] Gets or sets the name of - * the dsc nodeconfiguration. + * @param {string} [dscNodeUpdateParameters.nodeConfiguration.name] Gets or + * sets the name of the dsc nodeconfiguration. + * + * @param {object} [dscNodeUpdateParameters.properties] + * + * @param {string} [dscNodeUpdateParameters.properties.name] Gets or sets the + * name of the dsc nodeconfiguration. * * @param {object} [options] Optional Parameters. * @@ -1089,7 +1134,7 @@ class DscNodeOperations { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - update(resourceGroupName, automationAccountName, nodeId, parameters, options, optionalCallback) { + update(resourceGroupName, automationAccountName, nodeId, dscNodeUpdateParameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -1098,23 +1143,23 @@ class DscNodeOperations { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._update(resourceGroupName, automationAccountName, nodeId, parameters, options, (err, result, request, response) => { + self._update(resourceGroupName, automationAccountName, nodeId, dscNodeUpdateParameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._update(resourceGroupName, automationAccountName, nodeId, parameters, options, optionalCallback); + return self._update(resourceGroupName, automationAccountName, nodeId, dscNodeUpdateParameters, options, optionalCallback); } } /** * Retrieve a list of dsc nodes. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {object} [options] Optional Parameters. * @@ -1146,9 +1191,9 @@ class DscNodeOperations { /** * Retrieve a list of dsc nodes. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {object} [options] Optional Parameters. * diff --git a/lib/services/automationManagement/lib/operations/fields.js b/lib/services/automationManagement/lib/operations/fields.js index 916be3573e..99959d3d38 100644 --- a/lib/services/automationManagement/lib/operations/fields.js +++ b/lib/services/automationManagement/lib/operations/fields.js @@ -17,7 +17,7 @@ const WebResource = msRest.WebResource; /** * Retrieve a list of fields of a given type identified by module name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -53,12 +53,21 @@ function _listByType(resourceGroupName, automationAccountName, moduleName, typeN if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -76,9 +85,6 @@ function _listByType(resourceGroupName, automationAccountName, moduleName, typeN 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -95,7 +101,7 @@ function _listByType(resourceGroupName, automationAccountName, moduleName, typeN requestUrl = requestUrl.replace('{typeName}', encodeURIComponent(typeName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -192,7 +198,7 @@ class Fields { /** * Retrieve a list of fields of a given type identified by module name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -228,7 +234,7 @@ class Fields { /** * Retrieve a list of fields of a given type identified by module name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * diff --git a/lib/services/automationManagement/lib/operations/hybridRunbookWorkerGroupOperations.js b/lib/services/automationManagement/lib/operations/hybridRunbookWorkerGroupOperations.js index 70335296c0..51f2f367e7 100644 --- a/lib/services/automationManagement/lib/operations/hybridRunbookWorkerGroupOperations.js +++ b/lib/services/automationManagement/lib/operations/hybridRunbookWorkerGroupOperations.js @@ -17,7 +17,7 @@ const WebResource = msRest.WebResource; /** * Delete a hybrid runbook worker group. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName Automation account name. * @@ -51,12 +51,21 @@ function _deleteMethod(resourceGroupName, automationAccountName, hybridRunbookWo if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -71,9 +80,6 @@ function _deleteMethod(resourceGroupName, automationAccountName, hybridRunbookWo 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -89,7 +95,7 @@ function _deleteMethod(resourceGroupName, automationAccountName, hybridRunbookWo requestUrl = requestUrl.replace('{hybridRunbookWorkerGroupName}', encodeURIComponent(hybridRunbookWorkerGroupName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -158,7 +164,7 @@ function _deleteMethod(resourceGroupName, automationAccountName, hybridRunbookWo /** * Retrieve a hybrid runbook worker group. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -194,12 +200,21 @@ function _get(resourceGroupName, automationAccountName, hybridRunbookWorkerGroup if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -214,9 +229,6 @@ function _get(resourceGroupName, automationAccountName, hybridRunbookWorkerGroup 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -232,7 +244,7 @@ function _get(resourceGroupName, automationAccountName, hybridRunbookWorkerGroup requestUrl = requestUrl.replace('{hybridRunbookWorkerGroupName}', encodeURIComponent(hybridRunbookWorkerGroupName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -318,7 +330,7 @@ function _get(resourceGroupName, automationAccountName, hybridRunbookWorkerGroup /** * Update a hybrid runbook worker group. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -362,12 +374,21 @@ function _update(resourceGroupName, automationAccountName, hybridRunbookWorkerGr if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -385,9 +406,6 @@ function _update(resourceGroupName, automationAccountName, hybridRunbookWorkerGr 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -403,7 +421,7 @@ function _update(resourceGroupName, automationAccountName, hybridRunbookWorkerGr requestUrl = requestUrl.replace('{hybridRunbookWorkerGroupName}', encodeURIComponent(hybridRunbookWorkerGroupName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -503,7 +521,7 @@ function _update(resourceGroupName, automationAccountName, hybridRunbookWorkerGr /** * Retrieve a list of hybrid runbook worker groups. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -536,12 +554,21 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -553,9 +580,6 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -570,7 +594,7 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -800,7 +824,7 @@ class HybridRunbookWorkerGroupOperations { /** * Delete a hybrid runbook worker group. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName Automation account name. * @@ -835,7 +859,7 @@ class HybridRunbookWorkerGroupOperations { /** * Delete a hybrid runbook worker group. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName Automation account name. * @@ -891,7 +915,7 @@ class HybridRunbookWorkerGroupOperations { /** * Retrieve a hybrid runbook worker group. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -926,7 +950,7 @@ class HybridRunbookWorkerGroupOperations { /** * Retrieve a hybrid runbook worker group. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -984,7 +1008,7 @@ class HybridRunbookWorkerGroupOperations { /** * Update a hybrid runbook worker group. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1027,7 +1051,7 @@ class HybridRunbookWorkerGroupOperations { /** * Update a hybrid runbook worker group. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1093,7 +1117,7 @@ class HybridRunbookWorkerGroupOperations { /** * Retrieve a list of hybrid runbook worker groups. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1125,7 +1149,7 @@ class HybridRunbookWorkerGroupOperations { /** * Retrieve a list of hybrid runbook worker groups. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * diff --git a/lib/services/automationManagement/lib/operations/index.d.ts b/lib/services/automationManagement/lib/operations/index.d.ts index 8c78318a2d..6d21ef3ffe 100644 --- a/lib/services/automationManagement/lib/operations/index.d.ts +++ b/lib/services/automationManagement/lib/operations/index.d.ts @@ -9,7 +9,6 @@ */ import { ServiceClientOptions, RequestOptions, ServiceCallback, HttpOperationResponse } from 'ms-rest'; -import * as stream from 'stream'; import * as models from '../models'; @@ -771,6 +770,74 @@ export interface Usages { listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } +/** + * @class + * Keys + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface Keys { + + + /** + * Retrieve the automation keys for an account. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the automation keys for an account. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 {KeyListResult} - 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. + * + * {KeyListResult} [result] - The deserialized result object if an error did not occur. + * See {@link KeyListResult} 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. + */ + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + /** * @class * CertificateOperations @@ -783,7 +850,7 @@ export interface CertificateOperations { /** * Delete the certificate. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -805,7 +872,7 @@ export interface CertificateOperations { /** * Delete the certificate. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -845,7 +912,7 @@ export interface CertificateOperations { /** * Retrieve the certificate identified by certificate name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -867,7 +934,7 @@ export interface CertificateOperations { /** * Retrieve the certificate identified by certificate name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -908,7 +975,7 @@ export interface CertificateOperations { /** * Create a certificate. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -948,7 +1015,7 @@ export interface CertificateOperations { /** * Create a certificate. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1007,7 +1074,7 @@ export interface CertificateOperations { /** * Update a certificate. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1017,7 +1084,7 @@ export interface CertificateOperations { * @param {object} parameters The parameters supplied to the update certificate * operation. * - * @param {string} parameters.name Gets or sets the name of the certificate. + * @param {string} [parameters.name] Gets or sets the name of the certificate. * * @param {string} [parameters.description] Gets or sets the description of the * certificate. @@ -1038,7 +1105,7 @@ export interface CertificateOperations { /** * Update a certificate. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1048,7 +1115,7 @@ export interface CertificateOperations { * @param {object} parameters The parameters supplied to the update certificate * operation. * - * @param {string} parameters.name Gets or sets the name of the certificate. + * @param {string} [parameters.name] Gets or sets the name of the certificate. * * @param {string} [parameters.description] Gets or sets the description of the * certificate. @@ -1088,7 +1155,7 @@ export interface CertificateOperations { /** * Retrieve a list of certificates. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1108,7 +1175,7 @@ export interface CertificateOperations { /** * Retrieve a list of certificates. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1213,7 +1280,7 @@ export interface ConnectionOperations { /** * Delete the connection. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1235,7 +1302,7 @@ export interface ConnectionOperations { /** * Delete the connection. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1276,7 +1343,7 @@ export interface ConnectionOperations { /** * Retrieve the connection identified by connection name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1298,7 +1365,7 @@ export interface ConnectionOperations { /** * Retrieve the connection identified by connection name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1339,7 +1406,7 @@ export interface ConnectionOperations { /** * Create or update a connection. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1379,7 +1446,7 @@ export interface ConnectionOperations { /** * Create or update a connection. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1438,7 +1505,7 @@ export interface ConnectionOperations { /** * Update a connection. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1472,7 +1539,7 @@ export interface ConnectionOperations { /** * Update a connection. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1525,7 +1592,7 @@ export interface ConnectionOperations { /** * Retrieve a list of connections. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1545,7 +1612,7 @@ export interface ConnectionOperations { /** * Retrieve a list of connections. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1650,7 +1717,7 @@ export interface ConnectionTypeOperations { /** * Delete the connectiontype. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1672,7 +1739,7 @@ export interface ConnectionTypeOperations { /** * Delete the connectiontype. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1712,7 +1779,7 @@ export interface ConnectionTypeOperations { /** * Retrieve the connectiontype identified by connectiontype name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1734,7 +1801,7 @@ export interface ConnectionTypeOperations { /** * Retrieve the connectiontype identified by connectiontype name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1775,7 +1842,7 @@ export interface ConnectionTypeOperations { /** * Create a connectiontype. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1810,7 +1877,7 @@ export interface ConnectionTypeOperations { /** * Create a connectiontype. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1864,7 +1931,7 @@ export interface ConnectionTypeOperations { /** * Retrieve a list of connectiontypes. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1884,7 +1951,7 @@ export interface ConnectionTypeOperations { /** * Retrieve a list of connectiontypes. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1991,7 +2058,7 @@ export interface CredentialOperations { /** * Delete the credential. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -2013,7 +2080,7 @@ export interface CredentialOperations { /** * Delete the credential. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -2053,7 +2120,7 @@ export interface CredentialOperations { /** * Retrieve the credential identified by credential name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -2075,7 +2142,7 @@ export interface CredentialOperations { /** * Retrieve the credential identified by credential name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -2116,7 +2183,7 @@ export interface CredentialOperations { /** * Create a credential. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -2153,7 +2220,7 @@ export interface CredentialOperations { /** * Create a credential. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -2209,7 +2276,7 @@ export interface CredentialOperations { /** * Update a credential. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -2219,7 +2286,7 @@ export interface CredentialOperations { * @param {object} parameters The parameters supplied to the Update credential * operation. * - * @param {string} parameters.name Gets or sets the name of the credential. + * @param {string} [parameters.name] Gets or sets the name of the credential. * * @param {string} [parameters.userName] Gets or sets the user name of the * credential. @@ -2246,7 +2313,7 @@ export interface CredentialOperations { /** * Update a credential. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -2256,7 +2323,7 @@ export interface CredentialOperations { * @param {object} parameters The parameters supplied to the Update credential * operation. * - * @param {string} parameters.name Gets or sets the name of the credential. + * @param {string} [parameters.name] Gets or sets the name of the credential. * * @param {string} [parameters.userName] Gets or sets the user name of the * credential. @@ -2302,7 +2369,7 @@ export interface CredentialOperations { /** * Retrieve a list of credentials. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -2322,7 +2389,7 @@ export interface CredentialOperations { /** * Retrieve a list of credentials. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -2417,40 +2484,21 @@ export interface CredentialOperations { /** * @class - * DscCompilationJobOperations + * DscConfigurationOperations * __NOTE__: An instance of this class is automatically created for an * instance of the AutomationClient. */ -export interface DscCompilationJobOperations { +export interface DscConfigurationOperations { /** - * Creates the Dsc compilation job of the configuration. + * Delete the dsc configuration identified by configuration name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {uuid} compilationJobId The the DSC configuration Id. - * - * @param {object} parameters The parameters supplied to the create compilation - * job operation. - * - * @param {object} parameters.configuration Gets or sets the configuration. - * - * @param {string} [parameters.configuration.name] Gets or sets the name of the - * Dsc configuration. - * - * @param {object} [parameters.parameters] Gets or sets the parameters of the - * job. - * - * @param {string} [parameters.name] Gets or sets name of the resource. - * - * @param {string} [parameters.location] Gets or sets the location of the - * resource. - * - * @param {object} [parameters.tags] Gets or sets the tags attached to the - * resource. + * @param {string} configurationName The configuration name. * * @param {object} [options] Optional Parameters. * @@ -2459,39 +2507,20 @@ export interface DscCompilationJobOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, compilationJobId: string, parameters: models.DscCompilationJobCreateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteMethodWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, configurationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates the Dsc compilation job of the configuration. + * Delete the dsc configuration identified by configuration name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {uuid} compilationJobId The the DSC configuration Id. - * - * @param {object} parameters The parameters supplied to the create compilation - * job operation. - * - * @param {object} parameters.configuration Gets or sets the configuration. - * - * @param {string} [parameters.configuration.name] Gets or sets the name of the - * Dsc configuration. - * - * @param {object} [parameters.parameters] Gets or sets the parameters of the - * job. - * - * @param {string} [parameters.name] Gets or sets name of the resource. - * - * @param {string} [parameters.location] Gets or sets the location of the - * resource. - * - * @param {object} [parameters.tags] Gets or sets the tags attached to the - * resource. + * @param {string} configurationName The configuration name. * * @param {object} [options] Optional Parameters. * @@ -2505,7 +2534,7 @@ export interface DscCompilationJobOperations { * * {Promise} A promise is returned. * - * @resolve {DscCompilationJob} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -2513,26 +2542,25 @@ export interface DscCompilationJobOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {DscCompilationJob} [result] - The deserialized result object if an error did not occur. - * See {@link DscCompilationJob} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - create(resourceGroupName: string, automationAccountName: string, compilationJobId: string, parameters: models.DscCompilationJobCreateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - create(resourceGroupName: string, automationAccountName: string, compilationJobId: string, parameters: models.DscCompilationJobCreateParameters, callback: ServiceCallback): void; - create(resourceGroupName: string, automationAccountName: string, compilationJobId: string, parameters: models.DscCompilationJobCreateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, automationAccountName: string, configurationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, automationAccountName: string, configurationName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, automationAccountName: string, configurationName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve the Dsc configuration compilation job identified by job id. + * Retrieve the configuration identified by configuration name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {uuid} compilationJobId The Dsc configuration compilation job id. + * @param {string} configurationName The configuration name. * * @param {object} [options] Optional Parameters. * @@ -2541,20 +2569,20 @@ export interface DscCompilationJobOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, compilationJobId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, configurationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve the Dsc configuration compilation job identified by job id. + * Retrieve the configuration identified by configuration name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {uuid} compilationJobId The Dsc configuration compilation job id. + * @param {string} configurationName The configuration name. * * @param {object} [options] Optional Parameters. * @@ -2568,7 +2596,7 @@ export interface DscCompilationJobOperations { * * {Promise} A promise is returned. * - * @resolve {DscCompilationJob} - The deserialized result object. + * @resolve {DscConfiguration} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -2576,116 +2604,130 @@ export interface DscCompilationJobOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {DscCompilationJob} [result] - The deserialized result object if an error did not occur. - * See {@link DscCompilationJob} for more information. + * {DscConfiguration} [result] - The deserialized result object if an error did not occur. + * See {@link DscConfiguration} 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, automationAccountName: string, compilationJobId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, automationAccountName: string, compilationJobId: string, callback: ServiceCallback): void; - get(resourceGroupName: string, automationAccountName: string, compilationJobId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, configurationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, configurationName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, configurationName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve a list of dsc compilation jobs. + * Create the configuration identified by configuration name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {object} [options] Optional Parameters. + * @param {string} configurationName The create or update parameters for + * configuration. * - * @param {string} [options.filter] The filter to apply on the operation. + * @param {object} parameters The create or update parameters for + * configuration. * - * @param {object} [options.customHeaders] Headers that will be added to the - * request + * @param {boolean} [parameters.logVerbose] Gets or sets verbose log option. * - * @returns {Promise} A promise is returned + * @param {boolean} [parameters.logProgress] Gets or sets progress log option. * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @param {object} parameters.source Gets or sets the source. * - * @reject {Error|ServiceError} - The error object. - */ - listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Retrieve a list of dsc compilation jobs. + * @param {object} [parameters.source.hash] Gets or sets the hash. * - * @param {string} resourceGroupName The resource group name. + * @param {string} parameters.source.hash.algorithm Gets or sets the content + * hash algorithm used to hash the content. * - * @param {string} automationAccountName The automation account name. + * @param {string} parameters.source.hash.value Gets or sets expected hash + * value of the content. * - * @param {object} [options] Optional Parameters. + * @param {string} [parameters.source.type] Gets or sets the content source + * type. Possible values include: 'embeddedContent', 'uri' * - * @param {string} [options.filter] The filter to apply on the operation. + * @param {string} [parameters.source.value] Gets or sets the value of the + * content. This is based on the content source type. * - * @param {object} [options.customHeaders] Headers that will be added to the - * request + * @param {string} [parameters.source.version] Gets or sets the version of the + * content. * - * @param {ServiceCallback} [optionalCallback] - The optional callback. + * @param {object} [parameters.parameters] Gets or sets the configuration + * parameters. * - * @returns {ServiceCallback|Promise} If a callback was passed as the last - * parameter then it returns the callback else returns a Promise. + * @param {string} [parameters.description] Gets or sets the description of the + * configuration. * - * {Promise} A promise is returned. + * @param {string} [parameters.name] Gets or sets name of the resource. * - * @resolve {DscCompilationJobListResult} - The deserialized result object. + * @param {string} [parameters.location] Gets or sets the location of the + * resource. * - * @reject {Error|ServiceError} - The error object. + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. * - * {ServiceCallback} optionalCallback(err, result, request, response) + * @param {object} [options] Optional Parameters. * - * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * {DscCompilationJobListResult} [result] - The deserialized result object if an error did not occur. - * See {@link DscCompilationJobListResult} for more - * information. + * @returns {Promise} A promise is returned * - * {WebResource} [request] - The HTTP Request object if an error did not occur. + * @resolve {HttpOperationResponse} - The deserialized result object. * - * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + * @reject {Error|ServiceError} - The error object. */ - listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; - listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; - listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, configurationName: string, parameters: models.DscConfigurationCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve the job stream identified by job stream id. + * Create the configuration identified by configuration name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {uuid} jobId The job id. + * @param {string} configurationName The create or update parameters for + * configuration. * - * @param {string} jobStreamId The job stream id. + * @param {object} parameters The create or update parameters for + * configuration. * - * @param {object} [options] Optional Parameters. + * @param {boolean} [parameters.logVerbose] Gets or sets verbose log option. * - * @param {object} [options.customHeaders] Headers that will be added to the - * request + * @param {boolean} [parameters.logProgress] Gets or sets progress log option. * - * @returns {Promise} A promise is returned + * @param {object} parameters.source Gets or sets the source. * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @param {object} [parameters.source.hash] Gets or sets the hash. * - * @reject {Error|ServiceError} - The error object. - */ - getStreamWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, jobId: string, jobStreamId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Retrieve the job stream identified by job stream id. + * @param {string} parameters.source.hash.algorithm Gets or sets the content + * hash algorithm used to hash the content. * - * @param {string} resourceGroupName The resource group name. + * @param {string} parameters.source.hash.value Gets or sets expected hash + * value of the content. * - * @param {string} automationAccountName The automation account name. + * @param {string} [parameters.source.type] Gets or sets the content source + * type. Possible values include: 'embeddedContent', 'uri' * - * @param {uuid} jobId The job id. + * @param {string} [parameters.source.value] Gets or sets the value of the + * content. This is based on the content source type. * - * @param {string} jobStreamId The job stream id. + * @param {string} [parameters.source.version] Gets or sets the version of the + * content. + * + * @param {object} [parameters.parameters] Gets or sets the configuration + * parameters. + * + * @param {string} [parameters.description] Gets or sets the description of the + * configuration. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. * * @param {object} [options] Optional Parameters. * @@ -2699,7 +2741,7 @@ export interface DscCompilationJobOperations { * * {Promise} A promise is returned. * - * @resolve {JobStream} - The deserialized result object. + * @resolve {DscConfiguration} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -2707,45 +2749,131 @@ export interface DscCompilationJobOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {JobStream} [result] - The deserialized result object if an error did not occur. - * See {@link JobStream} for more information. + * {DscConfiguration} [result] - The deserialized result object if an error did not occur. + * See {@link DscConfiguration} 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. */ - getStream(resourceGroupName: string, automationAccountName: string, jobId: string, jobStreamId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - getStream(resourceGroupName: string, automationAccountName: string, jobId: string, jobStreamId: string, callback: ServiceCallback): void; - getStream(resourceGroupName: string, automationAccountName: string, jobId: string, jobStreamId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, automationAccountName: string, configurationName: string, parameters: models.DscConfigurationCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, automationAccountName: string, configurationName: string, parameters: models.DscConfigurationCreateOrUpdateParameters, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, automationAccountName: string, configurationName: string, parameters: models.DscConfigurationCreateOrUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve a list of dsc compilation jobs. + * Create the configuration identified by configuration name. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} configurationName The create or update parameters for + * configuration. * * @param {object} [options] Optional Parameters. * + * @param {object} [options.parameters] The create or update parameters for + * configuration. + * + * @param {boolean} [options.parameters.logVerbose] Gets or sets verbose log + * option. + * + * @param {boolean} [options.parameters.logProgress] Gets or sets progress log + * option. + * + * @param {object} options.parameters.source Gets or sets the source. + * + * @param {object} [options.parameters.source.hash] Gets or sets the hash. + * + * @param {string} options.parameters.source.hash.algorithm Gets or sets the + * content hash algorithm used to hash the content. + * + * @param {string} options.parameters.source.hash.value Gets or sets expected + * hash value of the content. + * + * @param {string} [options.parameters.source.type] Gets or sets the content + * source type. Possible values include: 'embeddedContent', 'uri' + * + * @param {string} [options.parameters.source.value] Gets or sets the value of + * the content. This is based on the content source type. + * + * @param {string} [options.parameters.source.version] Gets or sets the version + * of the content. + * + * @param {object} [options.parameters.parameters] Gets or sets the + * configuration parameters. + * + * @param {string} [options.parameters.description] Gets or sets the + * description of the configuration. + * + * @param {string} [options.parameters.name] Gets or sets name of the resource. + * + * @param {object} [options.parameters.tags] Gets or sets the tags attached to + * the resource. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + updateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, configurationName: string, options?: { parameters? : models.DscConfigurationUpdateParameters, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve a list of dsc compilation jobs. + * Create the configuration identified by configuration name. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} configurationName The create or update parameters for + * configuration. * * @param {object} [options] Optional Parameters. * + * @param {object} [options.parameters] The create or update parameters for + * configuration. + * + * @param {boolean} [options.parameters.logVerbose] Gets or sets verbose log + * option. + * + * @param {boolean} [options.parameters.logProgress] Gets or sets progress log + * option. + * + * @param {object} options.parameters.source Gets or sets the source. + * + * @param {object} [options.parameters.source.hash] Gets or sets the hash. + * + * @param {string} options.parameters.source.hash.algorithm Gets or sets the + * content hash algorithm used to hash the content. + * + * @param {string} options.parameters.source.hash.value Gets or sets expected + * hash value of the content. + * + * @param {string} [options.parameters.source.type] Gets or sets the content + * source type. Possible values include: 'embeddedContent', 'uri' + * + * @param {string} [options.parameters.source.value] Gets or sets the value of + * the content. This is based on the content source type. + * + * @param {string} [options.parameters.source.version] Gets or sets the version + * of the content. + * + * @param {object} [options.parameters.parameters] Gets or sets the + * configuration parameters. + * + * @param {string} [options.parameters.description] Gets or sets the + * description of the configuration. + * + * @param {string} [options.parameters.name] Gets or sets name of the resource. + * + * @param {object} [options.parameters.tags] Gets or sets the tags attached to + * the resource. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -2756,7 +2884,7 @@ export interface DscCompilationJobOperations { * * {Promise} A promise is returned. * - * @resolve {DscCompilationJobListResult} - The deserialized result object. + * @resolve {DscConfiguration} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -2764,32 +2892,22 @@ export interface DscCompilationJobOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {DscCompilationJobListResult} [result] - The deserialized result object if an error did not occur. - * See {@link DscCompilationJobListResult} for more - * information. + * {DscConfiguration} [result] - The deserialized result object if an error did not occur. + * See {@link DscConfiguration} 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. */ - listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; - listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * DscConfigurationOperations - * __NOTE__: An instance of this class is automatically created for an - * instance of the AutomationClient. - */ -export interface DscConfigurationOperations { + update(resourceGroupName: string, automationAccountName: string, configurationName: string, options?: { parameters? : models.DscConfigurationUpdateParameters, customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, automationAccountName: string, configurationName: string, callback: ServiceCallback): void; + update(resourceGroupName: string, automationAccountName: string, configurationName: string, options: { parameters? : models.DscConfigurationUpdateParameters, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Delete the dsc configuration identified by configuration name. + * Retrieve the configuration script identified by configuration name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -2802,16 +2920,16 @@ export interface DscConfigurationOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, configurationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getContentWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, configurationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Delete the dsc configuration identified by configuration name. + * Retrieve the configuration script identified by configuration name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -2829,7 +2947,7 @@ export interface DscConfigurationOperations { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {String} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -2837,26 +2955,24 @@ export interface DscConfigurationOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {String} [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, automationAccountName: string, configurationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, automationAccountName: string, configurationName: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, automationAccountName: string, configurationName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + getContent(resourceGroupName: string, automationAccountName: string, configurationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getContent(resourceGroupName: string, automationAccountName: string, configurationName: string, callback: ServiceCallback): void; + getContent(resourceGroupName: string, automationAccountName: string, configurationName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve the configuration identified by configuration name. + * Retrieve a list of configurations. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} configurationName The configuration name. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -2864,21 +2980,19 @@ export interface DscConfigurationOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, configurationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve the configuration identified by configuration name. + * Retrieve a list of configurations. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} configurationName The configuration name. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -2891,7 +3005,7 @@ export interface DscConfigurationOperations { * * {Promise} A promise is returned. * - * @resolve {DscConfiguration} - The deserialized result object. + * @resolve {DscConfigurationListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -2899,67 +3013,95 @@ export interface DscConfigurationOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {DscConfiguration} [result] - The deserialized result object if an error did not occur. - * See {@link DscConfiguration} for more information. + * {DscConfigurationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DscConfigurationListResult} 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, automationAccountName: string, configurationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, automationAccountName: string, configurationName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, automationAccountName: string, configurationName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Create the configuration identified by configuration name. + * Retrieve a list of configurations. * - * @param {string} resourceGroupName The resource group name. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * - * @param {string} automationAccountName The automation account name. + * @param {object} [options] Optional Parameters. * - * @param {string} configurationName The create or update parameters for - * configuration. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {object} parameters The create or update parameters for - * configuration. + * @returns {Promise} A promise is returned * - * @param {boolean} [parameters.logVerbose] Gets or sets verbose log option. + * @resolve {HttpOperationResponse} - The deserialized result object. * - * @param {boolean} [parameters.logProgress] Gets or sets progress log option. + * @reject {Error|ServiceError} - The error object. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of configurations. * - * @param {object} parameters.source Gets or sets the source. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * - * @param {object} [parameters.source.hash] Gets or sets the hash. + * @param {object} [options] Optional Parameters. * - * @param {string} parameters.source.hash.algorithm Gets or sets the content - * hash algorithm used to hash the content. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {string} parameters.source.hash.value Gets or sets expected hash - * value of the content. + * @param {ServiceCallback} [optionalCallback] - The optional callback. * - * @param {string} [parameters.source.type] Gets or sets the content source - * type. Possible values include: 'embeddedContent', 'uri' + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. * - * @param {string} [parameters.source.value] Gets or sets the value of the - * content. This is based on the content source type. + * {Promise} A promise is returned. * - * @param {string} [parameters.source.version] Gets or sets the version of the - * content. + * @resolve {DscConfigurationListResult} - The deserialized result object. * - * @param {object} [parameters.parameters] Gets or sets the configuration - * parameters. + * @reject {Error|ServiceError} - The error object. * - * @param {string} [parameters.description] Gets or sets the description of the - * configuration. + * {ServiceCallback} optionalCallback(err, result, request, response) * - * @param {string} [parameters.name] Gets or sets name of the resource. + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * @param {string} [parameters.location] Gets or sets the location of the - * resource. + * {DscConfigurationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DscConfigurationListResult} for more + * information. * - * @param {object} [parameters.tags] Gets or sets the tags attached to the - * resource. + * {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. + */ + listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * HybridRunbookWorkerGroupOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface HybridRunbookWorkerGroupOperations { + + + /** + * Delete a hybrid runbook worker group. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName Automation account name. + * + * @param {string} hybridRunbookWorkerGroupName The hybrid runbook worker group + * name * * @param {object} [options] Optional Parameters. * @@ -2968,61 +3110,85 @@ export interface DscConfigurationOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, configurationName: string, parameters: models.DscConfigurationCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteMethodWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, hybridRunbookWorkerGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Create the configuration identified by configuration name. + * Delete a hybrid runbook worker group. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName Automation account name. * - * @param {string} configurationName The create or update parameters for - * configuration. + * @param {string} hybridRunbookWorkerGroupName The hybrid runbook worker group + * name * - * @param {object} parameters The create or update parameters for - * configuration. + * @param {object} [options] Optional Parameters. * - * @param {boolean} [parameters.logVerbose] Gets or sets verbose log option. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {boolean} [parameters.logProgress] Gets or sets progress log option. + * @param {ServiceCallback} [optionalCallback] - The optional callback. * - * @param {object} parameters.source Gets or sets the source. + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. * - * @param {object} [parameters.source.hash] Gets or sets the hash. + * {Promise} A promise is returned. * - * @param {string} parameters.source.hash.algorithm Gets or sets the content - * hash algorithm used to hash the content. + * @resolve {null} - The deserialized result object. * - * @param {string} parameters.source.hash.value Gets or sets expected hash - * value of the content. + * @reject {Error|ServiceError} - The error object. * - * @param {string} [parameters.source.type] Gets or sets the content source - * type. Possible values include: 'embeddedContent', 'uri' + * {ServiceCallback} optionalCallback(err, result, request, response) * - * @param {string} [parameters.source.value] Gets or sets the value of the - * content. This is based on the content source type. + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * @param {string} [parameters.source.version] Gets or sets the version of the - * content. + * {null} [result] - The deserialized result object if an error did not occur. * - * @param {object} [parameters.parameters] Gets or sets the configuration - * parameters. + * {WebResource} [request] - The HTTP Request object if an error did not occur. * - * @param {string} [parameters.description] Gets or sets the description of the - * configuration. + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, automationAccountName: string, hybridRunbookWorkerGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, automationAccountName: string, hybridRunbookWorkerGroupName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, automationAccountName: string, hybridRunbookWorkerGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a hybrid runbook worker group. * - * @param {string} [parameters.name] Gets or sets name of the resource. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} [parameters.location] Gets or sets the location of the - * resource. + * @param {string} automationAccountName The automation account name. * - * @param {object} [parameters.tags] Gets or sets the tags attached to the - * resource. + * @param {string} hybridRunbookWorkerGroupName The hybrid runbook worker 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. + */ + getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, hybridRunbookWorkerGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a hybrid runbook worker group. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} hybridRunbookWorkerGroupName The hybrid runbook worker group + * name * * @param {object} [options] Optional Parameters. * @@ -3036,7 +3202,7 @@ export interface DscConfigurationOperations { * * {Promise} A promise is returned. * - * @resolve {DscConfiguration} - The deserialized result object. + * @resolve {HybridRunbookWorkerGroup} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -3044,26 +3210,36 @@ export interface DscConfigurationOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {DscConfiguration} [result] - The deserialized result object if an error did not occur. - * See {@link DscConfiguration} for more information. + * {HybridRunbookWorkerGroup} [result] - The deserialized result object if an error did not occur. + * See {@link HybridRunbookWorkerGroup} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - createOrUpdate(resourceGroupName: string, automationAccountName: string, configurationName: string, parameters: models.DscConfigurationCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, automationAccountName: string, configurationName: string, parameters: models.DscConfigurationCreateOrUpdateParameters, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, automationAccountName: string, configurationName: string, parameters: models.DscConfigurationCreateOrUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, hybridRunbookWorkerGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, hybridRunbookWorkerGroupName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, hybridRunbookWorkerGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve the configuration script identified by configuration name. + * Update a hybrid runbook worker group. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} configurationName The configuration name. + * @param {string} hybridRunbookWorkerGroupName The hybrid runbook worker group + * name + * + * @param {object} parameters The hybrid runbook worker group + * + * @param {object} [parameters.credential] Sets the credential of a worker + * group. + * + * @param {string} [parameters.credential.name] Gets or sets the name of the + * credential. * * @param {object} [options] Optional Parameters. * @@ -3072,20 +3248,29 @@ export interface DscConfigurationOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getContentWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, configurationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + updateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, hybridRunbookWorkerGroupName: string, parameters: models.HybridRunbookWorkerGroupUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve the configuration script identified by configuration name. + * Update a hybrid runbook worker group. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} configurationName The configuration name. + * @param {string} hybridRunbookWorkerGroupName The hybrid runbook worker group + * name + * + * @param {object} parameters The hybrid runbook worker group + * + * @param {object} [parameters.credential] Sets the credential of a worker + * group. + * + * @param {string} [parameters.credential.name] Gets or sets the name of the + * credential. * * @param {object} [options] Optional Parameters. * @@ -3099,7 +3284,7 @@ export interface DscConfigurationOperations { * * {Promise} A promise is returned. * - * @resolve {Object} - The deserialized result object. + * @resolve {HybridRunbookWorkerGroup} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -3107,21 +3292,23 @@ export interface DscConfigurationOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Object} [result] - The deserialized result object if an error did not occur. + * {HybridRunbookWorkerGroup} [result] - The deserialized result object if an error did not occur. + * See {@link HybridRunbookWorkerGroup} 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. */ - getContent(resourceGroupName: string, automationAccountName: string, configurationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - getContent(resourceGroupName: string, automationAccountName: string, configurationName: string, callback: ServiceCallback): void; - getContent(resourceGroupName: string, automationAccountName: string, configurationName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + update(resourceGroupName: string, automationAccountName: string, hybridRunbookWorkerGroupName: string, parameters: models.HybridRunbookWorkerGroupUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, automationAccountName: string, hybridRunbookWorkerGroupName: string, parameters: models.HybridRunbookWorkerGroupUpdateParameters, callback: ServiceCallback): void; + update(resourceGroupName: string, automationAccountName: string, hybridRunbookWorkerGroupName: string, parameters: models.HybridRunbookWorkerGroupUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve a list of configurations. + * Retrieve a list of hybrid runbook worker groups. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -3132,16 +3319,16 @@ export interface DscConfigurationOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve a list of configurations. + * Retrieve a list of hybrid runbook worker groups. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -3157,7 +3344,7 @@ export interface DscConfigurationOperations { * * {Promise} A promise is returned. * - * @resolve {DscConfigurationListResult} - The deserialized result object. + * @resolve {HybridRunbookWorkerGroupsListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -3165,21 +3352,21 @@ export interface DscConfigurationOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {DscConfigurationListResult} [result] - The deserialized result object if an error did not occur. - * See {@link DscConfigurationListResult} for more - * information. + * {HybridRunbookWorkerGroupsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link HybridRunbookWorkerGroupsListResult} 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. */ - listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; - listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve a list of configurations. + * Retrieve a list of hybrid runbook worker groups. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -3191,14 +3378,14 @@ export interface DscConfigurationOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve a list of configurations. + * Retrieve a list of hybrid runbook worker groups. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -3215,7 +3402,7 @@ export interface DscConfigurationOperations { * * {Promise} A promise is returned. * - * @resolve {DscConfigurationListResult} - The deserialized result object. + * @resolve {HybridRunbookWorkerGroupsListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -3223,35 +3410,37 @@ export interface DscConfigurationOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {DscConfigurationListResult} [result] - The deserialized result object if an error did not occur. - * See {@link DscConfigurationListResult} for more - * information. + * {HybridRunbookWorkerGroupsListResult} [result] - The deserialized result object if an error did not occur. + * See {@link HybridRunbookWorkerGroupsListResult} 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. */ - listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; - listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** * @class - * AgentRegistrationInformation + * JobScheduleOperations * __NOTE__: An instance of this class is automatically created for an * instance of the AutomationClient. */ -export interface AgentRegistrationInformation { +export interface JobScheduleOperations { /** - * Retrieve the automation agent registration information. + * Delete the job schedule identified by job schedule name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * + * @param {uuid} jobScheduleId The job schedule name. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -3259,19 +3448,21 @@ export interface AgentRegistrationInformation { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteMethodWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, jobScheduleId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve the automation agent registration information. + * Delete the job schedule identified by job schedule name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * + * @param {uuid} jobScheduleId The job schedule name. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -3284,7 +3475,7 @@ export interface AgentRegistrationInformation { * * {Promise} A promise is returned. * - * @resolve {AgentRegistration} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -3292,38 +3483,25 @@ export interface AgentRegistrationInformation { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {AgentRegistration} [result] - The deserialized result object if an error did not occur. - * See {@link AgentRegistration} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - get(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, automationAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, automationAccountName: string, jobScheduleId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, automationAccountName: string, jobScheduleId: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, automationAccountName: string, jobScheduleId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Regenerate a primary or secondary agent registration key + * Retrieve the job schedule identified by job schedule name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {object} parameters The name of the agent registration key to be - * regenerated - * - * @param {string} parameters.keyName Gets or sets the agent registration key - * name - Primary or Secondary. Possible values include: 'Primary', 'Secondary' - * - * @param {string} [parameters.name] Gets or sets the name of the resource. - * - * @param {string} [parameters.location] Gets or sets the location of the - * resource. - * - * @param {object} [parameters.tags] Gets or sets the tags attached to the - * resource. + * @param {uuid} jobScheduleId The job schedule name. * * @param {object} [options] Optional Parameters. * @@ -3332,32 +3510,20 @@ export interface AgentRegistrationInformation { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - regenerateKeyWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, parameters: models.AgentRegistrationRegenerateKeyParameter, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, jobScheduleId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Regenerate a primary or secondary agent registration key + * Retrieve the job schedule identified by job schedule name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {object} parameters The name of the agent registration key to be - * regenerated - * - * @param {string} parameters.keyName Gets or sets the agent registration key - * name - Primary or Secondary. Possible values include: 'Primary', 'Secondary' - * - * @param {string} [parameters.name] Gets or sets the name of the resource. - * - * @param {string} [parameters.location] Gets or sets the location of the - * resource. - * - * @param {object} [parameters.tags] Gets or sets the tags attached to the - * resource. + * @param {uuid} jobScheduleId The job schedule name. * * @param {object} [options] Optional Parameters. * @@ -3371,7 +3537,7 @@ export interface AgentRegistrationInformation { * * {Promise} A promise is returned. * - * @resolve {AgentRegistration} - The deserialized result object. + * @resolve {JobSchedule} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -3379,35 +3545,45 @@ export interface AgentRegistrationInformation { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {AgentRegistration} [result] - The deserialized result object if an error did not occur. - * See {@link AgentRegistration} for more information. + * {JobSchedule} [result] - The deserialized result object if an error did not occur. + * See {@link JobSchedule} 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. */ - regenerateKey(resourceGroupName: string, automationAccountName: string, parameters: models.AgentRegistrationRegenerateKeyParameter, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - regenerateKey(resourceGroupName: string, automationAccountName: string, parameters: models.AgentRegistrationRegenerateKeyParameter, callback: ServiceCallback): void; - regenerateKey(resourceGroupName: string, automationAccountName: string, parameters: models.AgentRegistrationRegenerateKeyParameter, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * DscNodeOperations - * __NOTE__: An instance of this class is automatically created for an - * instance of the AutomationClient. - */ -export interface DscNodeOperations { + get(resourceGroupName: string, automationAccountName: string, jobScheduleId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, jobScheduleId: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, jobScheduleId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Delete the dsc node identified by node id. + * Create a job schedule. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName Automation account name. + * @param {string} automationAccountName The automation account name. * - * @param {string} nodeId The node id. + * @param {uuid} jobScheduleId The job schedule name. + * + * @param {object} parameters The parameters supplied to the create job + * schedule operation. + * + * @param {object} parameters.schedule Gets or sets the schedule. + * + * @param {string} [parameters.schedule.name] Gets or sets the name of the + * schedule. + * + * @param {object} parameters.runbook Gets or sets the runbook. + * + * @param {string} [parameters.runbook.name] Gets or sets the name of the + * runbook. + * + * @param {string} [parameters.runOn] Gets or sets the hybrid worker group that + * the scheduled job should run on. + * + * @param {object} [parameters.parameters] Gets or sets a list of job + * properties. * * @param {object} [options] Optional Parameters. * @@ -3416,20 +3592,39 @@ export interface DscNodeOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, nodeId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, jobScheduleId: string, parameters: models.JobScheduleCreateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Delete the dsc node identified by node id. + * Create a job schedule. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName Automation account name. + * @param {string} automationAccountName The automation account name. * - * @param {string} nodeId The node id. + * @param {uuid} jobScheduleId The job schedule name. + * + * @param {object} parameters The parameters supplied to the create job + * schedule operation. + * + * @param {object} parameters.schedule Gets or sets the schedule. + * + * @param {string} [parameters.schedule.name] Gets or sets the name of the + * schedule. + * + * @param {object} parameters.runbook Gets or sets the runbook. + * + * @param {string} [parameters.runbook.name] Gets or sets the name of the + * runbook. + * + * @param {string} [parameters.runOn] Gets or sets the hybrid worker group that + * the scheduled job should run on. + * + * @param {object} [parameters.parameters] Gets or sets a list of job + * properties. * * @param {object} [options] Optional Parameters. * @@ -3443,7 +3638,7 @@ export interface DscNodeOperations { * * {Promise} A promise is returned. * - * @resolve {DscNode} - The deserialized result object. + * @resolve {JobSchedule} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -3451,27 +3646,25 @@ export interface DscNodeOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {DscNode} [result] - The deserialized result object if an error did not occur. - * See {@link DscNode} for more information. + * {JobSchedule} [result] - The deserialized result object if an error did not occur. + * See {@link JobSchedule} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - deleteMethod(resourceGroupName: string, automationAccountName: string, nodeId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, automationAccountName: string, nodeId: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, automationAccountName: string, nodeId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + create(resourceGroupName: string, automationAccountName: string, jobScheduleId: string, parameters: models.JobScheduleCreateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, automationAccountName: string, jobScheduleId: string, parameters: models.JobScheduleCreateParameters, callback: ServiceCallback): void; + create(resourceGroupName: string, automationAccountName: string, jobScheduleId: string, parameters: models.JobScheduleCreateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve the dsc node identified by node id. + * Retrieve a list of job schedules. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} nodeId The node id. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -3479,21 +3672,19 @@ export interface DscNodeOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, nodeId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve the dsc node identified by node id. + * Retrieve a list of job schedules. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} nodeId The node id. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -3506,7 +3697,7 @@ export interface DscNodeOperations { * * {Promise} A promise is returned. * - * @resolve {DscNode} - The deserialized result object. + * @resolve {JobScheduleListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -3514,36 +3705,23 @@ export interface DscNodeOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {DscNode} [result] - The deserialized result object if an error did not occur. - * See {@link DscNode} for more information. + * {JobScheduleListResult} [result] - The deserialized result object if an error did not occur. + * See {@link JobScheduleListResult} 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, automationAccountName: string, nodeId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, automationAccountName: string, nodeId: string, callback: ServiceCallback): void; - get(resourceGroupName: string, automationAccountName: string, nodeId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Update the dsc node. - * - * @param {string} resourceGroupName The resource group name. - * - * @param {string} automationAccountName The automation account name. - * - * @param {string} nodeId Parameters supplied to the update dsc node. - * - * @param {object} parameters Parameters supplied to the update dsc node. - * - * @param {string} [parameters.nodeId] Gets or sets the id of the dsc node. - * - * @param {object} [parameters.nodeConfiguration] Gets or sets the - * configuration of the node. + * Retrieve a list of job schedules. * - * @param {string} [parameters.nodeConfiguration.name] Gets or sets the name of - * the dsc nodeconfiguration. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -3552,30 +3730,17 @@ export interface DscNodeOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - updateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, nodeId: string, parameters: models.DscNodeUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Update the dsc node. - * - * @param {string} resourceGroupName The resource group name. - * - * @param {string} automationAccountName The automation account name. - * - * @param {string} nodeId Parameters supplied to the update dsc node. - * - * @param {object} parameters Parameters supplied to the update dsc node. - * - * @param {string} [parameters.nodeId] Gets or sets the id of the dsc node. - * - * @param {object} [parameters.nodeConfiguration] Gets or sets the - * configuration of the node. + * Retrieve a list of job schedules. * - * @param {string} [parameters.nodeConfiguration.name] Gets or sets the name of - * the dsc nodeconfiguration. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -3589,7 +3754,7 @@ export interface DscNodeOperations { * * {Promise} A promise is returned. * - * @resolve {DscNode} - The deserialized result object. + * @resolve {JobScheduleListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -3597,51 +3762,56 @@ export interface DscNodeOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {DscNode} [result] - The deserialized result object if an error did not occur. - * See {@link DscNode} for more information. + * {JobScheduleListResult} [result] - The deserialized result object if an error did not occur. + * See {@link JobScheduleListResult} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - update(resourceGroupName: string, automationAccountName: string, nodeId: string, parameters: models.DscNodeUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - update(resourceGroupName: string, automationAccountName: string, nodeId: string, parameters: models.DscNodeUpdateParameters, callback: ServiceCallback): void; - update(resourceGroupName: string, automationAccountName: string, nodeId: string, parameters: models.DscNodeUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * LinkedWorkspaceOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface LinkedWorkspaceOperations { /** - * Retrieve a list of dsc nodes. + * Retrieve the linked workspace for the account id. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * * @param {object} [options] Optional Parameters. * - * @param {string} [options.filter] The filter to apply on the operation. - * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve a list of dsc nodes. + * Retrieve the linked workspace for the account id. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * * @param {object} [options] Optional Parameters. * - * @param {string} [options.filter] The filter to apply on the operation. - * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -3652,7 +3822,7 @@ export interface DscNodeOperations { * * {Promise} A promise is returned. * - * @resolve {DscNodeListResult} - The deserialized result object. + * @resolve {LinkedWorkspace} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -3660,23 +3830,38 @@ export interface DscNodeOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {DscNodeListResult} [result] - The deserialized result object if an error did not occur. - * See {@link DscNodeListResult} for more information. + * {LinkedWorkspace} [result] - The deserialized result object if an error did not occur. + * See {@link LinkedWorkspace} 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. */ - listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; - listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; - listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ActivityOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface ActivityOperations { /** - * Retrieve a list of dsc nodes. + * Retrieve the activity in the module identified by module name and activity + * name. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The name of module. + * + * @param {string} activityName The name of activity. * * @param {object} [options] Optional Parameters. * @@ -3685,17 +3870,23 @@ export interface DscNodeOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, moduleName: string, activityName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve a list of dsc nodes. + * Retrieve the activity in the module identified by module name and activity + * name. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The name of module. + * + * @param {string} activityName The name of activity. * * @param {object} [options] Optional Parameters. * @@ -3709,7 +3900,7 @@ export interface DscNodeOperations { * * {Promise} A promise is returned. * - * @resolve {DscNodeListResult} - The deserialized result object. + * @resolve {Activity} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -3717,64 +3908,51 @@ export interface DscNodeOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {DscNodeListResult} [result] - The deserialized result object if an error did not occur. - * See {@link DscNodeListResult} for more information. + * {Activity} [result] - The deserialized result object if an error did not occur. + * See {@link Activity} 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. */ - listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; - listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * NodeReports - * __NOTE__: An instance of this class is automatically created for an - * instance of the AutomationClient. - */ -export interface NodeReports { + get(resourceGroupName: string, automationAccountName: string, moduleName: string, activityName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, moduleName: string, activityName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, moduleName: string, activityName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve the Dsc node report list by node id. + * Retrieve a list of activities in the module identified by module name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} nodeId The parameters supplied to the list operation. + * @param {string} moduleName The name of module. * * @param {object} [options] Optional Parameters. * - * @param {string} [options.filter] The filter to apply on the operation. - * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByNodeWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, nodeId: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + listByModuleWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, moduleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve the Dsc node report list by node id. + * Retrieve a list of activities in the module identified by module name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} nodeId The parameters supplied to the list operation. + * @param {string} moduleName The name of module. * * @param {object} [options] Optional Parameters. * - * @param {string} [options.filter] The filter to apply on the operation. - * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -3785,7 +3963,7 @@ export interface NodeReports { * * {Promise} A promise is returned. * - * @resolve {DscNodeReportListResult} - The deserialized result object. + * @resolve {ActivityListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -3793,29 +3971,23 @@ export interface NodeReports { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {DscNodeReportListResult} [result] - The deserialized result object if an error did not occur. - * See {@link DscNodeReportListResult} for more - * information. + * {ActivityListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ActivityListResult} 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. */ - listByNode(resourceGroupName: string, automationAccountName: string, nodeId: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; - listByNode(resourceGroupName: string, automationAccountName: string, nodeId: string, callback: ServiceCallback): void; - listByNode(resourceGroupName: string, automationAccountName: string, nodeId: string, options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - + listByModule(resourceGroupName: string, automationAccountName: string, moduleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByModule(resourceGroupName: string, automationAccountName: string, moduleName: string, callback: ServiceCallback): void; + listByModule(resourceGroupName: string, automationAccountName: string, moduleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + /** - * Retrieve the Dsc node report data by node id and report id. - * - * @param {string} resourceGroupName The resource group name. - * - * @param {string} automationAccountName The automation account name. - * - * @param {string} nodeId The Dsc node id. + * Retrieve a list of activities in the module identified by module name. * - * @param {string} reportId The report id. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -3824,22 +3996,17 @@ export interface NodeReports { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, nodeId: string, reportId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByModuleNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve the Dsc node report data by node id and report id. - * - * @param {string} resourceGroupName The resource group name. - * - * @param {string} automationAccountName The automation account name. - * - * @param {string} nodeId The Dsc node id. + * Retrieve a list of activities in the module identified by module name. * - * @param {string} reportId The report id. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -3853,7 +4020,7 @@ export interface NodeReports { * * {Promise} A promise is returned. * - * @resolve {DscNodeReport} - The deserialized result object. + * @resolve {ActivityListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -3861,28 +4028,35 @@ export interface NodeReports { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {DscNodeReport} [result] - The deserialized result object if an error did not occur. - * See {@link DscNodeReport} for more information. + * {ActivityListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ActivityListResult} 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, automationAccountName: string, nodeId: string, reportId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, automationAccountName: string, nodeId: string, reportId: string, callback: ServiceCallback): void; - get(resourceGroupName: string, automationAccountName: string, nodeId: string, reportId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByModuleNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByModuleNext(nextPageLink: string, callback: ServiceCallback): void; + listByModuleNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ModuleOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface ModuleOperations { /** - * Retrieve the Dsc node reports by node id and report id. + * Delete the module by name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} nodeId The Dsc node id. - * - * @param {string} reportId The report id. + * @param {string} moduleName The module name. * * @param {object} [options] Optional Parameters. * @@ -3891,22 +4065,20 @@ export interface NodeReports { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getContentWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, nodeId: string, reportId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteMethodWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, moduleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve the Dsc node reports by node id and report id. + * Delete the module by name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} nodeId The Dsc node id. - * - * @param {string} reportId The report id. + * @param {string} moduleName The module name. * * @param {object} [options] Optional Parameters. * @@ -3920,7 +4092,7 @@ export interface NodeReports { * * {Promise} A promise is returned. * - * @resolve {Object} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -3928,22 +4100,25 @@ export interface NodeReports { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Object} [result] - The deserialized result object if an error did not occur. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - getContent(resourceGroupName: string, automationAccountName: string, nodeId: string, reportId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - getContent(resourceGroupName: string, automationAccountName: string, nodeId: string, reportId: string, callback: ServiceCallback): void; - getContent(resourceGroupName: string, automationAccountName: string, nodeId: string, reportId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, automationAccountName: string, moduleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, automationAccountName: string, moduleName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, automationAccountName: string, moduleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve the Dsc node report list by node id. + * Retrieve the module identified by module name. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The module name. * * @param {object} [options] Optional Parameters. * @@ -3952,17 +4127,20 @@ export interface NodeReports { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByNodeNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, moduleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve the Dsc node report list by node id. + * Retrieve the module identified by module name. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} moduleName The module name. * * @param {object} [options] Optional Parameters. * @@ -3976,7 +4154,7 @@ export interface NodeReports { * * {Promise} A promise is returned. * - * @resolve {DscNodeReportListResult} - The deserialized result object. + * @resolve {Module} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -3984,36 +4162,52 @@ export interface NodeReports { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {DscNodeReportListResult} [result] - The deserialized result object if an error did not occur. - * See {@link DscNodeReportListResult} for more - * information. + * {Module} [result] - The deserialized result object if an error did not occur. + * See {@link Module} 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. */ - listByNodeNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByNodeNext(nextPageLink: string, callback: ServiceCallback): void; - listByNodeNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * DscNodeConfigurationOperations - * __NOTE__: An instance of this class is automatically created for an - * instance of the AutomationClient. - */ -export interface DscNodeConfigurationOperations { + get(resourceGroupName: string, automationAccountName: string, moduleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, moduleName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, moduleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Delete the Dsc node configurations by node configuration. + * Create or Update the module identified by module name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} nodeConfigurationName The Dsc node configuration name. + * @param {string} moduleName The name of module. + * + * @param {object} parameters The create or update parameters for module. + * + * @param {object} parameters.contentLink Gets or sets the module content link. + * + * @param {string} [parameters.contentLink.uri] Gets or sets the uri of the + * runbook content. + * + * @param {object} [parameters.contentLink.contentHash] Gets or sets the hash. + * + * @param {string} parameters.contentLink.contentHash.algorithm Gets or sets + * the content hash algorithm used to hash the content. + * + * @param {string} parameters.contentLink.contentHash.value Gets or sets + * expected hash value of the content. + * + * @param {string} [parameters.contentLink.version] Gets or sets the version of + * the content. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. * * @param {object} [options] Optional Parameters. * @@ -4022,20 +4216,46 @@ export interface DscNodeConfigurationOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, nodeConfigurationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, moduleName: string, parameters: models.ModuleCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Delete the Dsc node configurations by node configuration. + * Create or Update the module identified by module name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} nodeConfigurationName The Dsc node configuration name. + * @param {string} moduleName The name of module. + * + * @param {object} parameters The create or update parameters for module. + * + * @param {object} parameters.contentLink Gets or sets the module content link. + * + * @param {string} [parameters.contentLink.uri] Gets or sets the uri of the + * runbook content. + * + * @param {object} [parameters.contentLink.contentHash] Gets or sets the hash. + * + * @param {string} parameters.contentLink.contentHash.algorithm Gets or sets + * the content hash algorithm used to hash the content. + * + * @param {string} parameters.contentLink.contentHash.value Gets or sets + * expected hash value of the content. + * + * @param {string} [parameters.contentLink.version] Gets or sets the version of + * the content. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. * * @param {object} [options] Optional Parameters. * @@ -4049,7 +4269,7 @@ export interface DscNodeConfigurationOperations { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {Module} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -4057,25 +4277,53 @@ export interface DscNodeConfigurationOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {Module} [result] - The deserialized result object if an error did not occur. + * See {@link Module} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - deleteMethod(resourceGroupName: string, automationAccountName: string, nodeConfigurationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, automationAccountName: string, nodeConfigurationName: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, automationAccountName: string, nodeConfigurationName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, automationAccountName: string, moduleName: string, parameters: models.ModuleCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, automationAccountName: string, moduleName: string, parameters: models.ModuleCreateOrUpdateParameters, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, automationAccountName: string, moduleName: string, parameters: models.ModuleCreateOrUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve the Dsc node configurations by node configuration. + * Update the module identified by module name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} nodeConfigurationName The Dsc node configuration name. + * @param {string} moduleName The name of module. + * + * @param {object} parameters The update parameters for module. + * + * @param {object} [parameters.contentLink] Gets or sets the module content + * link. + * + * @param {string} [parameters.contentLink.uri] Gets or sets the uri of the + * runbook content. + * + * @param {object} [parameters.contentLink.contentHash] Gets or sets the hash. + * + * @param {string} parameters.contentLink.contentHash.algorithm Gets or sets + * the content hash algorithm used to hash the content. + * + * @param {string} parameters.contentLink.contentHash.value Gets or sets + * expected hash value of the content. + * + * @param {string} [parameters.contentLink.version] Gets or sets the version of + * the content. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. * * @param {object} [options] Optional Parameters. * @@ -4084,145 +4332,47 @@ export interface DscNodeConfigurationOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, nodeConfigurationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + updateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, moduleName: string, parameters: models.ModuleUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve the Dsc node configurations by node configuration. + * Update the module identified by module name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} nodeConfigurationName The Dsc node configuration name. + * @param {string} moduleName The name of module. * - * @param {object} [options] Optional Parameters. + * @param {object} parameters The update parameters for module. * - * @param {object} [options.customHeaders] Headers that will be added to the - * request + * @param {object} [parameters.contentLink] Gets or sets the module content + * link. * - * @param {ServiceCallback} [optionalCallback] - The optional callback. + * @param {string} [parameters.contentLink.uri] Gets or sets the uri of the + * runbook content. * - * @returns {ServiceCallback|Promise} If a callback was passed as the last - * parameter then it returns the callback else returns a Promise. + * @param {object} [parameters.contentLink.contentHash] Gets or sets the hash. * - * {Promise} A promise is returned. + * @param {string} parameters.contentLink.contentHash.algorithm Gets or sets + * the content hash algorithm used to hash the content. * - * @resolve {DscNodeConfiguration} - The deserialized result object. + * @param {string} parameters.contentLink.contentHash.value Gets or sets + * expected hash value of the content. * - * @reject {Error|ServiceError} - The error object. + * @param {string} [parameters.contentLink.version] Gets or sets the version of + * the content. * - * {ServiceCallback} optionalCallback(err, result, request, response) - * - * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. - * - * {DscNodeConfiguration} [result] - The deserialized result object if an error did not occur. - * See {@link DscNodeConfiguration} 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, automationAccountName: string, nodeConfigurationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, automationAccountName: string, nodeConfigurationName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, automationAccountName: string, nodeConfigurationName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Create the node configuration identified by node configuration name. - * - * @param {string} resourceGroupName The resource group name. - * - * @param {string} automationAccountName The automation account name. - * - * @param {string} nodeConfigurationName The create or update parameters for - * configuration. - * - * @param {object} parameters The create or update parameters for - * configuration. - * - * @param {object} parameters.source Gets or sets the source. - * - * @param {object} [parameters.source.hash] Gets or sets the hash. - * - * @param {string} parameters.source.hash.algorithm Gets or sets the content - * hash algorithm used to hash the content. - * - * @param {string} parameters.source.hash.value Gets or sets expected hash - * value of the content. - * - * @param {string} [parameters.source.type] Gets or sets the content source - * type. Possible values include: 'embeddedContent', 'uri' - * - * @param {string} [parameters.source.value] Gets or sets the value of the - * content. This is based on the content source type. - * - * @param {string} [parameters.source.version] Gets or sets the version of the - * content. - * - * @param {string} parameters.name Gets or sets the type of the parameter. - * - * @param {object} parameters.configuration Gets or sets the configuration of - * the node. - * - * @param {string} [parameters.configuration.name] Gets or sets the name of the - * Dsc configuration. - * - * @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. - */ - createOrUpdateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, nodeConfigurationName: string, parameters: models.DscNodeConfigurationCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Create the node configuration identified by node configuration name. - * - * @param {string} resourceGroupName The resource group name. - * - * @param {string} automationAccountName The automation account name. - * - * @param {string} nodeConfigurationName The create or update parameters for - * configuration. - * - * @param {object} parameters The create or update parameters for - * configuration. - * - * @param {object} parameters.source Gets or sets the source. - * - * @param {object} [parameters.source.hash] Gets or sets the hash. - * - * @param {string} parameters.source.hash.algorithm Gets or sets the content - * hash algorithm used to hash the content. - * - * @param {string} parameters.source.hash.value Gets or sets expected hash - * value of the content. - * - * @param {string} [parameters.source.type] Gets or sets the content source - * type. Possible values include: 'embeddedContent', 'uri' - * - * @param {string} [parameters.source.value] Gets or sets the value of the - * content. This is based on the content source type. - * - * @param {string} [parameters.source.version] Gets or sets the version of the - * content. - * - * @param {string} parameters.name Gets or sets the type of the parameter. + * @param {string} [parameters.name] Gets or sets name of the resource. * - * @param {object} parameters.configuration Gets or sets the configuration of - * the node. + * @param {string} [parameters.location] Gets or sets the location of the + * resource. * - * @param {string} [parameters.configuration.name] Gets or sets the name of the - * Dsc configuration. + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. * * @param {object} [options] Optional Parameters. * @@ -4236,7 +4386,7 @@ export interface DscNodeConfigurationOperations { * * {Promise} A promise is returned. * - * @resolve {DscNodeConfiguration} - The deserialized result object. + * @resolve {Module} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -4244,51 +4394,47 @@ export interface DscNodeConfigurationOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {DscNodeConfiguration} [result] - The deserialized result object if an error did not occur. - * See {@link DscNodeConfiguration} for more information. + * {Module} [result] - The deserialized result object if an error did not occur. + * See {@link Module} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - createOrUpdate(resourceGroupName: string, automationAccountName: string, nodeConfigurationName: string, parameters: models.DscNodeConfigurationCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, automationAccountName: string, nodeConfigurationName: string, parameters: models.DscNodeConfigurationCreateOrUpdateParameters, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, automationAccountName: string, nodeConfigurationName: string, parameters: models.DscNodeConfigurationCreateOrUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + update(resourceGroupName: string, automationAccountName: string, moduleName: string, parameters: models.ModuleUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, automationAccountName: string, moduleName: string, parameters: models.ModuleUpdateParameters, callback: ServiceCallback): void; + update(resourceGroupName: string, automationAccountName: string, moduleName: string, parameters: models.ModuleUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve a list of dsc node configurations. + * Retrieve a list of modules. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * * @param {object} [options] Optional Parameters. * - * @param {string} [options.filter] The filter to apply on the operation. - * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve a list of dsc node configurations. + * Retrieve a list of modules. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * * @param {object} [options] Optional Parameters. * - * @param {string} [options.filter] The filter to apply on the operation. - * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -4299,7 +4445,7 @@ export interface DscNodeConfigurationOperations { * * {Promise} A promise is returned. * - * @resolve {DscNodeConfigurationListResult} - The deserialized result object. + * @resolve {ModuleListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -4307,21 +4453,20 @@ export interface DscNodeConfigurationOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {DscNodeConfigurationListResult} [result] - The deserialized result object if an error did not occur. - * See {@link DscNodeConfigurationListResult} for more - * information. + * {ModuleListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ModuleListResult} 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. */ - listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; - listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; - listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve a list of dsc node configurations. + * Retrieve a list of modules. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -4333,14 +4478,14 @@ export interface DscNodeConfigurationOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve a list of dsc node configurations. + * Retrieve a list of modules. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -4357,7 +4502,7 @@ export interface DscNodeConfigurationOperations { * * {Promise} A promise is returned. * - * @resolve {DscNodeConfigurationListResult} - The deserialized result object. + * @resolve {ModuleListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -4365,37 +4510,37 @@ export interface DscNodeConfigurationOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {DscNodeConfigurationListResult} [result] - The deserialized result object if an error did not occur. - * See {@link DscNodeConfigurationListResult} for more - * information. + * {ModuleListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ModuleListResult} 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. */ - listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; - listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** * @class - * HybridRunbookWorkerGroupOperations + * ObjectDataTypes * __NOTE__: An instance of this class is automatically created for an * instance of the AutomationClient. */ -export interface HybridRunbookWorkerGroupOperations { +export interface ObjectDataTypes { /** - * Delete a hybrid runbook worker group. + * Retrieve a list of fields of a given type identified by module name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName Automation account name. + * @param {string} automationAccountName The automation account name. * - * @param {string} hybridRunbookWorkerGroupName The hybrid runbook worker group - * name + * @param {string} moduleName The name of module. + * + * @param {string} typeName The name of type. * * @param {object} [options] Optional Parameters. * @@ -4404,21 +4549,22 @@ export interface HybridRunbookWorkerGroupOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, hybridRunbookWorkerGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listFieldsByModuleAndTypeWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, moduleName: string, typeName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Delete a hybrid runbook worker group. + * Retrieve a list of fields of a given type identified by module name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName Automation account name. + * @param {string} automationAccountName The automation account name. * - * @param {string} hybridRunbookWorkerGroupName The hybrid runbook worker group - * name + * @param {string} moduleName The name of module. + * + * @param {string} typeName The name of type. * * @param {object} [options] Optional Parameters. * @@ -4432,7 +4578,7 @@ export interface HybridRunbookWorkerGroupOperations { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {TypeFieldListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -4440,26 +4586,26 @@ export interface HybridRunbookWorkerGroupOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {TypeFieldListResult} [result] - The deserialized result object if an error did not occur. + * See {@link TypeFieldListResult} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - deleteMethod(resourceGroupName: string, automationAccountName: string, hybridRunbookWorkerGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, automationAccountName: string, hybridRunbookWorkerGroupName: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, automationAccountName: string, hybridRunbookWorkerGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listFieldsByModuleAndType(resourceGroupName: string, automationAccountName: string, moduleName: string, typeName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listFieldsByModuleAndType(resourceGroupName: string, automationAccountName: string, moduleName: string, typeName: string, callback: ServiceCallback): void; + listFieldsByModuleAndType(resourceGroupName: string, automationAccountName: string, moduleName: string, typeName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve a hybrid runbook worker group. + * Retrieve a list of fields of a given type across all accessible modules. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} hybridRunbookWorkerGroupName The hybrid runbook worker group - * name + * @param {string} typeName The name of type. * * @param {object} [options] Optional Parameters. * @@ -4468,21 +4614,20 @@ export interface HybridRunbookWorkerGroupOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, hybridRunbookWorkerGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listFieldsByTypeWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, typeName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve a hybrid runbook worker group. + * Retrieve a list of fields of a given type across all accessible modules. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} hybridRunbookWorkerGroupName The hybrid runbook worker group - * name + * @param {string} typeName The name of type. * * @param {object} [options] Optional Parameters. * @@ -4496,7 +4641,7 @@ export interface HybridRunbookWorkerGroupOperations { * * {Promise} A promise is returned. * - * @resolve {HybridRunbookWorkerGroup} - The deserialized result object. + * @resolve {TypeFieldListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -4504,36 +4649,37 @@ export interface HybridRunbookWorkerGroupOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {HybridRunbookWorkerGroup} [result] - The deserialized result object if an error did not occur. - * See {@link HybridRunbookWorkerGroup} for more - * information. + * {TypeFieldListResult} [result] - The deserialized result object if an error did not occur. + * See {@link TypeFieldListResult} 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, automationAccountName: string, hybridRunbookWorkerGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, automationAccountName: string, hybridRunbookWorkerGroupName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, automationAccountName: string, hybridRunbookWorkerGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listFieldsByType(resourceGroupName: string, automationAccountName: string, typeName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listFieldsByType(resourceGroupName: string, automationAccountName: string, typeName: string, callback: ServiceCallback): void; + listFieldsByType(resourceGroupName: string, automationAccountName: string, typeName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Fields + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface Fields { /** - * Update a hybrid runbook worker group. + * Retrieve a list of fields of a given type identified by module name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} hybridRunbookWorkerGroupName The hybrid runbook worker group - * name - * - * @param {object} parameters The hybrid runbook worker group - * - * @param {object} [parameters.credential] Sets the credential of a worker - * group. + * @param {string} moduleName The name of module. * - * @param {string} [parameters.credential.name] Gets or sets the name of the - * credential. + * @param {string} typeName The name of type. * * @param {object} [options] Optional Parameters. * @@ -4542,29 +4688,22 @@ export interface HybridRunbookWorkerGroupOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - updateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, hybridRunbookWorkerGroupName: string, parameters: models.HybridRunbookWorkerGroupUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByTypeWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, moduleName: string, typeName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Update a hybrid runbook worker group. + * Retrieve a list of fields of a given type identified by module name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} hybridRunbookWorkerGroupName The hybrid runbook worker group - * name - * - * @param {object} parameters The hybrid runbook worker group - * - * @param {object} [parameters.credential] Sets the credential of a worker - * group. + * @param {string} moduleName The name of module. * - * @param {string} [parameters.credential.name] Gets or sets the name of the - * credential. + * @param {string} typeName The name of type. * * @param {object} [options] Optional Parameters. * @@ -4578,7 +4717,7 @@ export interface HybridRunbookWorkerGroupOperations { * * {Promise} A promise is returned. * - * @resolve {HybridRunbookWorkerGroup} - The deserialized result object. + * @resolve {TypeFieldListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -4586,26 +4725,36 @@ export interface HybridRunbookWorkerGroupOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {HybridRunbookWorkerGroup} [result] - The deserialized result object if an error did not occur. - * See {@link HybridRunbookWorkerGroup} for more - * information. + * {TypeFieldListResult} [result] - The deserialized result object if an error did not occur. + * See {@link TypeFieldListResult} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - update(resourceGroupName: string, automationAccountName: string, hybridRunbookWorkerGroupName: string, parameters: models.HybridRunbookWorkerGroupUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - update(resourceGroupName: string, automationAccountName: string, hybridRunbookWorkerGroupName: string, parameters: models.HybridRunbookWorkerGroupUpdateParameters, callback: ServiceCallback): void; - update(resourceGroupName: string, automationAccountName: string, hybridRunbookWorkerGroupName: string, parameters: models.HybridRunbookWorkerGroupUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByType(resourceGroupName: string, automationAccountName: string, moduleName: string, typeName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByType(resourceGroupName: string, automationAccountName: string, moduleName: string, typeName: string, callback: ServiceCallback): void; + listByType(resourceGroupName: string, automationAccountName: string, moduleName: string, typeName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * RunbookDraftOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface RunbookDraftOperations { /** - * Retrieve a list of hybrid runbook worker groups. + * Retrieve the content of runbook draft identified by runbook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * + * @param {string} runbookName The runbook name. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -4613,19 +4762,21 @@ export interface HybridRunbookWorkerGroupOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getContentWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve a list of hybrid runbook worker groups. + * Retrieve the content of runbook draft identified by runbook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * + * @param {string} runbookName The runbook name. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -4638,7 +4789,7 @@ export interface HybridRunbookWorkerGroupOperations { * * {Promise} A promise is returned. * - * @resolve {HybridRunbookWorkerGroupsListResult} - The deserialized result object. + * @resolve {String} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -4646,24 +4797,27 @@ export interface HybridRunbookWorkerGroupOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {HybridRunbookWorkerGroupsListResult} [result] - The deserialized result object if an error did not occur. - * See {@link HybridRunbookWorkerGroupsListResult} for - * more information. + * {String} [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. */ - listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; - listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + getContent(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getContent(resourceGroupName: string, automationAccountName: string, runbookName: string, callback: ServiceCallback): void; + getContent(resourceGroupName: string, automationAccountName: string, runbookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve a list of hybrid runbook worker groups. + * Replaces the runbook draft content. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook name. + * + * @param {string} runbookContent The runbook draft content. * * @param {object} [options] Optional Parameters. * @@ -4672,17 +4826,22 @@ export interface HybridRunbookWorkerGroupOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + replaceContentWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, runbookContent: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve a list of hybrid runbook worker groups. + * Replaces the runbook draft content. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook name. + * + * @param {string} runbookContent The runbook draft content. * * @param {object} [options] Optional Parameters. * @@ -4696,7 +4855,7 @@ export interface HybridRunbookWorkerGroupOperations { * * {Promise} A promise is returned. * - * @resolve {HybridRunbookWorkerGroupsListResult} - The deserialized result object. + * @resolve {String} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -4704,36 +4863,25 @@ export interface HybridRunbookWorkerGroupOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {HybridRunbookWorkerGroupsListResult} [result] - The deserialized result object if an error did not occur. - * See {@link HybridRunbookWorkerGroupsListResult} for - * more information. + * {String} [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. */ - listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; - listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * JobOperations - * __NOTE__: An instance of this class is automatically created for an - * instance of the AutomationClient. - */ -export interface JobOperations { + replaceContent(resourceGroupName: string, automationAccountName: string, runbookName: string, runbookContent: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + replaceContent(resourceGroupName: string, automationAccountName: string, runbookName: string, runbookContent: string, callback: ServiceCallback): void; + replaceContent(resourceGroupName: string, automationAccountName: string, runbookName: string, runbookContent: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve the job output identified by job id. + * Retrieve the runbook draft identified by runbook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} jobId The job id. + * @param {string} runbookName The runbook name. * * @param {object} [options] Optional Parameters. * @@ -4742,20 +4890,20 @@ export interface JobOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getOutputWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, jobId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve the job output identified by job id. + * Retrieve the runbook draft identified by runbook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} jobId The job id. + * @param {string} runbookName The runbook name. * * @param {object} [options] Optional Parameters. * @@ -4769,7 +4917,7 @@ export interface JobOperations { * * {Promise} A promise is returned. * - * @resolve {Object} - The deserialized result object. + * @resolve {RunbookDraft} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -4777,25 +4925,27 @@ export interface JobOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Object} [result] - The deserialized result object if an error did not occur. + * {RunbookDraft} [result] - The deserialized result object if an error did not occur. + * See {@link RunbookDraft} 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. */ - getOutput(resourceGroupName: string, automationAccountName: string, jobId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - getOutput(resourceGroupName: string, automationAccountName: string, jobId: string, callback: ServiceCallback): void; - getOutput(resourceGroupName: string, automationAccountName: string, jobId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, runbookName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, runbookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve the runbook content of the job identified by job id. + * Publish runbook draft. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} jobId The job id. + * @param {string} runbookName The parameters supplied to the publish runbook + * operation. * * @param {object} [options] Optional Parameters. * @@ -4804,20 +4954,21 @@ export interface JobOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getRunbookContentWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, jobId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + publishWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve the runbook content of the job identified by job id. + * Publish runbook draft. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} jobId The job id. + * @param {string} runbookName The parameters supplied to the publish runbook + * operation. * * @param {object} [options] Optional Parameters. * @@ -4831,7 +4982,7 @@ export interface JobOperations { * * {Promise} A promise is returned. * - * @resolve {Object} - The deserialized result object. + * @resolve {String} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -4839,25 +4990,25 @@ export interface JobOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Object} [result] - The deserialized result object if an error did not occur. + * {String} [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. */ - getRunbookContent(resourceGroupName: string, automationAccountName: string, jobId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - getRunbookContent(resourceGroupName: string, automationAccountName: string, jobId: string, callback: ServiceCallback): void; - getRunbookContent(resourceGroupName: string, automationAccountName: string, jobId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + publish(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + publish(resourceGroupName: string, automationAccountName: string, runbookName: string, callback: ServiceCallback): void; + publish(resourceGroupName: string, automationAccountName: string, runbookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Suspend the job identified by jobId. + * Undo draft edit to last known published state identified by runbook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {uuid} jobId The job id. + * @param {string} runbookName The runbook name. * * @param {object} [options] Optional Parameters. * @@ -4866,20 +5017,20 @@ export interface JobOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - suspendWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, jobId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + undoEditWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Suspend the job identified by jobId. + * Undo draft edit to last known published state identified by runbook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {uuid} jobId The job id. + * @param {string} runbookName The runbook name. * * @param {object} [options] Optional Parameters. * @@ -4893,7 +5044,7 @@ export interface JobOperations { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {RunbookDraftUndoEditResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -4901,25 +5052,29 @@ export interface JobOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {RunbookDraftUndoEditResult} [result] - The deserialized result object if an error did not occur. + * See {@link RunbookDraftUndoEditResult} 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. */ - suspend(resourceGroupName: string, automationAccountName: string, jobId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - suspend(resourceGroupName: string, automationAccountName: string, jobId: string, callback: ServiceCallback): void; - suspend(resourceGroupName: string, automationAccountName: string, jobId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + undoEdit(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + undoEdit(resourceGroupName: string, automationAccountName: string, runbookName: string, callback: ServiceCallback): void; + undoEdit(resourceGroupName: string, automationAccountName: string, runbookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Stop the job identified by jobId. + * Replaces the runbook draft content. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {uuid} jobId The job id. + * @param {string} runbookName The runbook name. + * + * @param {string} runbookContent The runbook draft content. * * @param {object} [options] Optional Parameters. * @@ -4928,20 +5083,22 @@ export interface JobOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - stopWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, jobId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginReplaceContentWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, runbookContent: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Stop the job identified by jobId. + * Replaces the runbook draft content. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {uuid} jobId The job id. + * @param {string} runbookName The runbook name. + * + * @param {string} runbookContent The runbook draft content. * * @param {object} [options] Optional Parameters. * @@ -4955,7 +5112,7 @@ export interface JobOperations { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {String} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -4963,25 +5120,26 @@ export interface JobOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {String} [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. */ - stop(resourceGroupName: string, automationAccountName: string, jobId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - stop(resourceGroupName: string, automationAccountName: string, jobId: string, callback: ServiceCallback): void; - stop(resourceGroupName: string, automationAccountName: string, jobId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginReplaceContent(resourceGroupName: string, automationAccountName: string, runbookName: string, runbookContent: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginReplaceContent(resourceGroupName: string, automationAccountName: string, runbookName: string, runbookContent: string, callback: ServiceCallback): void; + beginReplaceContent(resourceGroupName: string, automationAccountName: string, runbookName: string, runbookContent: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve the job identified by job id. + * Publish runbook draft. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {uuid} jobId The job id. + * @param {string} runbookName The parameters supplied to the publish runbook + * operation. * * @param {object} [options] Optional Parameters. * @@ -4990,20 +5148,21 @@ export interface JobOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, jobId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginPublishWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve the job identified by job id. + * Publish runbook draft. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {uuid} jobId The job id. + * @param {string} runbookName The parameters supplied to the publish runbook + * operation. * * @param {object} [options] Optional Parameters. * @@ -5017,7 +5176,7 @@ export interface JobOperations { * * {Promise} A promise is returned. * - * @resolve {Job} - The deserialized result object. + * @resolve {String} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -5025,48 +5184,34 @@ export interface JobOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Job} [result] - The deserialized result object if an error did not occur. - * See {@link Job} for more information. + * {String} [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. */ - get(resourceGroupName: string, automationAccountName: string, jobId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, automationAccountName: string, jobId: string, callback: ServiceCallback): void; - get(resourceGroupName: string, automationAccountName: string, jobId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginPublish(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginPublish(resourceGroupName: string, automationAccountName: string, runbookName: string, callback: ServiceCallback): void; + beginPublish(resourceGroupName: string, automationAccountName: string, runbookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * RunbookOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface RunbookOperations { /** - * Create a job of the runbook. + * Retrieve the content of runbook identified by runbook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {uuid} jobId The job id. - * - * @param {object} parameters The parameters supplied to the create job - * operation. - * - * @param {object} parameters.runbook Gets or sets the runbook. - * - * @param {string} [parameters.runbook.name] Gets or sets the name of the - * runbook. - * - * @param {object} [parameters.parameters] Gets or sets the parameters of the - * job. - * - * @param {string} [parameters.runOn] Gets or sets the runOn which specifies - * the group name where the job is to be executed. - * - * @param {string} [parameters.name] Gets or sets name of the resource. - * - * @param {string} [parameters.location] Gets or sets the location of the - * resource. - * - * @param {object} [parameters.tags] Gets or sets the tags attached to the - * resource. + * @param {string} runbookName The runbook name. * * @param {object} [options] Optional Parameters. * @@ -5075,42 +5220,20 @@ export interface JobOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, jobId: string, parameters: models.JobCreateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getContentWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Create a job of the runbook. + * Retrieve the content of runbook identified by runbook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {uuid} jobId The job id. - * - * @param {object} parameters The parameters supplied to the create job - * operation. - * - * @param {object} parameters.runbook Gets or sets the runbook. - * - * @param {string} [parameters.runbook.name] Gets or sets the name of the - * runbook. - * - * @param {object} [parameters.parameters] Gets or sets the parameters of the - * job. - * - * @param {string} [parameters.runOn] Gets or sets the runOn which specifies - * the group name where the job is to be executed. - * - * @param {string} [parameters.name] Gets or sets name of the resource. - * - * @param {string} [parameters.location] Gets or sets the location of the - * resource. - * - * @param {object} [parameters.tags] Gets or sets the tags attached to the - * resource. + * @param {string} runbookName The runbook name. * * @param {object} [options] Optional Parameters. * @@ -5124,7 +5247,7 @@ export interface JobOperations { * * {Promise} A promise is returned. * - * @resolve {Job} - The deserialized result object. + * @resolve {String} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -5132,50 +5255,49 @@ export interface JobOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Job} [result] - The deserialized result object if an error did not occur. - * See {@link Job} for more information. + * {String} [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. */ - create(resourceGroupName: string, automationAccountName: string, jobId: string, parameters: models.JobCreateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - create(resourceGroupName: string, automationAccountName: string, jobId: string, parameters: models.JobCreateParameters, callback: ServiceCallback): void; - create(resourceGroupName: string, automationAccountName: string, jobId: string, parameters: models.JobCreateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + getContent(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getContent(resourceGroupName: string, automationAccountName: string, runbookName: string, callback: ServiceCallback): void; + getContent(resourceGroupName: string, automationAccountName: string, runbookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve a list of jobs. + * Retrieve the runbook identified by runbook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {object} [options] Optional Parameters. + * @param {string} runbookName The runbook name. * - * @param {string} [options.filter] The filter to apply on the 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. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve a list of jobs. + * Retrieve the runbook identified by runbook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {object} [options] Optional Parameters. + * @param {string} runbookName The runbook name. * - * @param {string} [options.filter] The filter to apply on the operation. + * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -5187,7 +5309,7 @@ export interface JobOperations { * * {Promise} A promise is returned. * - * @resolve {JobListResult} - The deserialized result object. + * @resolve {Runbook} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -5195,26 +5317,90 @@ export interface JobOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {JobListResult} [result] - The deserialized result object if an error did not occur. - * See {@link JobListResult} for more information. + * {Runbook} [result] - The deserialized result object if an error did not occur. + * See {@link Runbook} 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. */ - listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; - listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; - listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, runbookName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, runbookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Resume the job identified by jobId. + * Create the runbook identified by runbook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {uuid} jobId The job id. + * @param {string} runbookName The runbook name. + * + * @param {object} parameters The create or update parameters for runbook. + * Provide either content link for a published runbook or draft, not both. + * + * @param {boolean} [parameters.logVerbose] Gets or sets verbose log option. + * + * @param {boolean} [parameters.logProgress] Gets or sets progress log option. + * + * @param {string} parameters.runbookType Gets or sets the type of the runbook. + * Possible values include: 'Script', 'Graph', 'PowerShellWorkflow', + * 'PowerShell', 'GraphPowerShellWorkflow', 'GraphPowerShell' + * + * @param {object} [parameters.draft] Gets or sets the draft runbook + * properties. + * + * @param {boolean} [parameters.draft.inEdit] Gets or sets whether runbook is + * in edit mode. + * + * @param {object} [parameters.draft.draftContentLink] Gets or sets the draft + * runbook content link. + * + * @param {date} [parameters.draft.creationTime] Gets or sets the creation time + * of the runbook draft. + * + * @param {date} [parameters.draft.lastModifiedTime] Gets or sets the last + * modified time of the runbook draft. + * + * @param {object} [parameters.draft.parameters] Gets or sets the runbook draft + * parameters. + * + * @param {array} [parameters.draft.outputTypes] Gets or sets the runbook + * output types. + * + * @param {object} [parameters.publishContentLink] Gets or sets the published + * runbook content link. + * + * @param {string} [parameters.publishContentLink.uri] Gets or sets the uri of + * the runbook content. + * + * @param {object} [parameters.publishContentLink.contentHash] Gets or sets the + * hash. + * + * @param {string} parameters.publishContentLink.contentHash.algorithm Gets or + * sets the content hash algorithm used to hash the content. + * + * @param {string} parameters.publishContentLink.contentHash.value Gets or sets + * expected hash value of the content. + * + * @param {string} [parameters.publishContentLink.version] Gets or sets the + * version of the content. + * + * @param {string} [parameters.description] Gets or sets the description of the + * runbook. + * + * @param {number} [parameters.logActivityTrace] Gets or sets the + * activity-level tracing options of the runbook. + * + * @param {string} [parameters.name] Gets or sets the name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. * * @param {object} [options] Optional Parameters. * @@ -5223,76 +5409,84 @@ export interface JobOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - resumeWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, jobId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, parameters: models.RunbookCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Resume the job identified by jobId. + * Create the runbook identified by runbook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {uuid} jobId The job id. + * @param {string} runbookName The runbook name. * - * @param {object} [options] Optional Parameters. + * @param {object} parameters The create or update parameters for runbook. + * Provide either content link for a published runbook or draft, not both. * - * @param {object} [options.customHeaders] Headers that will be added to the - * request + * @param {boolean} [parameters.logVerbose] Gets or sets verbose log option. * - * @param {ServiceCallback} [optionalCallback] - The optional callback. + * @param {boolean} [parameters.logProgress] Gets or sets progress log option. * - * @returns {ServiceCallback|Promise} If a callback was passed as the last - * parameter then it returns the callback else returns a Promise. + * @param {string} parameters.runbookType Gets or sets the type of the runbook. + * Possible values include: 'Script', 'Graph', 'PowerShellWorkflow', + * 'PowerShell', 'GraphPowerShellWorkflow', 'GraphPowerShell' * - * {Promise} A promise is returned. + * @param {object} [parameters.draft] Gets or sets the draft runbook + * properties. * - * @resolve {null} - The deserialized result object. + * @param {boolean} [parameters.draft.inEdit] Gets or sets whether runbook is + * in edit mode. * - * @reject {Error|ServiceError} - The error object. + * @param {object} [parameters.draft.draftContentLink] Gets or sets the draft + * runbook content link. * - * {ServiceCallback} optionalCallback(err, result, request, response) + * @param {date} [parameters.draft.creationTime] Gets or sets the creation time + * of the runbook draft. * - * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * @param {date} [parameters.draft.lastModifiedTime] Gets or sets the last + * modified time of the runbook draft. * - * {null} [result] - The deserialized result object if an error did not occur. + * @param {object} [parameters.draft.parameters] Gets or sets the runbook draft + * parameters. * - * {WebResource} [request] - The HTTP Request object if an error did not occur. + * @param {array} [parameters.draft.outputTypes] Gets or sets the runbook + * output types. * - * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. - */ - resume(resourceGroupName: string, automationAccountName: string, jobId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - resume(resourceGroupName: string, automationAccountName: string, jobId: string, callback: ServiceCallback): void; - resume(resourceGroupName: string, automationAccountName: string, jobId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Retrieve a list of jobs. + * @param {object} [parameters.publishContentLink] Gets or sets the published + * runbook content link. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} [parameters.publishContentLink.uri] Gets or sets the uri of + * the runbook content. * - * @param {object} [options] Optional Parameters. + * @param {object} [parameters.publishContentLink.contentHash] Gets or sets the + * hash. * - * @param {object} [options.customHeaders] Headers that will be added to the - * request + * @param {string} parameters.publishContentLink.contentHash.algorithm Gets or + * sets the content hash algorithm used to hash the content. * - * @returns {Promise} A promise is returned + * @param {string} parameters.publishContentLink.contentHash.value Gets or sets + * expected hash value of the content. * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @param {string} [parameters.publishContentLink.version] Gets or sets the + * version of the content. * - * @reject {Error|ServiceError} - The error object. - */ - listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Retrieve a list of jobs. + * @param {string} [parameters.description] Gets or sets the description of the + * runbook. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {number} [parameters.logActivityTrace] Gets or sets the + * activity-level tracing options of the runbook. + * + * @param {string} [parameters.name] Gets or sets the name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. * * @param {object} [options] Optional Parameters. * @@ -5306,7 +5500,7 @@ export interface JobOperations { * * {Promise} A promise is returned. * - * @resolve {JobListResult} - The deserialized result object. + * @resolve {Runbook} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -5314,37 +5508,46 @@ export interface JobOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {JobListResult} [result] - The deserialized result object if an error did not occur. - * See {@link JobListResult} for more information. + * {Runbook} [result] - The deserialized result object if an error did not occur. + * See {@link Runbook} 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. */ - listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; - listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * JobStreamOperations - * __NOTE__: An instance of this class is automatically created for an - * instance of the AutomationClient. - */ -export interface JobStreamOperations { + createOrUpdate(resourceGroupName: string, automationAccountName: string, runbookName: string, parameters: models.RunbookCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, automationAccountName: string, runbookName: string, parameters: models.RunbookCreateOrUpdateParameters, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, automationAccountName: string, runbookName: string, parameters: models.RunbookCreateOrUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve the job stream identified by job stream id. + * Update the runbook identified by runbook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} jobId The job id. + * @param {string} runbookName The runbook name. * - * @param {string} jobStreamId The job stream id. + * @param {object} parameters The update parameters for runbook. + * + * @param {string} [parameters.description] Gets or sets the description of the + * runbook. + * + * @param {boolean} [parameters.logVerbose] Gets or sets verbose log option. + * + * @param {boolean} [parameters.logProgress] Gets or sets progress log option. + * + * @param {number} [parameters.logActivityTrace] Gets or sets the + * activity-level tracing options of the runbook. + * + * @param {string} [parameters.name] Gets or sets the name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. * * @param {object} [options] Optional Parameters. * @@ -5353,22 +5556,40 @@ export interface JobStreamOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, jobId: string, jobStreamId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + updateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, parameters: models.RunbookUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve the job stream identified by job stream id. + * Update the runbook identified by runbook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} jobId The job id. + * @param {string} runbookName The runbook name. * - * @param {string} jobStreamId The job stream id. + * @param {object} parameters The update parameters for runbook. + * + * @param {string} [parameters.description] Gets or sets the description of the + * runbook. + * + * @param {boolean} [parameters.logVerbose] Gets or sets verbose log option. + * + * @param {boolean} [parameters.logProgress] Gets or sets progress log option. + * + * @param {number} [parameters.logActivityTrace] Gets or sets the + * activity-level tracing options of the runbook. + * + * @param {string} [parameters.name] Gets or sets the name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. * * @param {object} [options] Optional Parameters. * @@ -5382,7 +5603,7 @@ export interface JobStreamOperations { * * {Promise} A promise is returned. * - * @resolve {JobStream} - The deserialized result object. + * @resolve {Runbook} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -5390,55 +5611,51 @@ export interface JobStreamOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {JobStream} [result] - The deserialized result object if an error did not occur. - * See {@link JobStream} for more information. + * {Runbook} [result] - The deserialized result object if an error did not occur. + * See {@link Runbook} 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, automationAccountName: string, jobId: string, jobStreamId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, automationAccountName: string, jobId: string, jobStreamId: string, callback: ServiceCallback): void; - get(resourceGroupName: string, automationAccountName: string, jobId: string, jobStreamId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + update(resourceGroupName: string, automationAccountName: string, runbookName: string, parameters: models.RunbookUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, automationAccountName: string, runbookName: string, parameters: models.RunbookUpdateParameters, callback: ServiceCallback): void; + update(resourceGroupName: string, automationAccountName: string, runbookName: string, parameters: models.RunbookUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve a list of jobs streams identified by job id. + * Delete the runbook by name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} jobId The job Id. + * @param {string} runbookName The runbook name. * * @param {object} [options] Optional Parameters. * - * @param {string} [options.filter] The filter to apply on the operation. - * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByJobWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, jobId: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteMethodWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve a list of jobs streams identified by job id. + * Delete the runbook by name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} jobId The job Id. + * @param {string} runbookName The runbook name. * * @param {object} [options] Optional Parameters. * - * @param {string} [options.filter] The filter to apply on the operation. - * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -5449,7 +5666,7 @@ export interface JobStreamOperations { * * {Promise} A promise is returned. * - * @resolve {JobStreamListResult} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -5457,23 +5674,23 @@ export interface JobStreamOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {JobStreamListResult} [result] - The deserialized result object if an error did not occur. - * See {@link JobStreamListResult} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByJob(resourceGroupName: string, automationAccountName: string, jobId: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; - listByJob(resourceGroupName: string, automationAccountName: string, jobId: string, callback: ServiceCallback): void; - listByJob(resourceGroupName: string, automationAccountName: string, jobId: string, options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, automationAccountName: string, runbookName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, automationAccountName: string, runbookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve a list of jobs streams identified by job id. + * Retrieve a list of runbooks. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. * * @param {object} [options] Optional Parameters. * @@ -5482,17 +5699,18 @@ export interface JobStreamOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByJobNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve a list of jobs streams identified by job id. + * Retrieve a list of runbooks. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. * * @param {object} [options] Optional Parameters. * @@ -5506,7 +5724,7 @@ export interface JobStreamOperations { * * {Promise} A promise is returned. * - * @resolve {JobStreamListResult} - The deserialized result object. + * @resolve {RunbookListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -5514,35 +5732,23 @@ export interface JobStreamOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {JobStreamListResult} [result] - The deserialized result object if an error did not occur. - * See {@link JobStreamListResult} for more information. + * {RunbookListResult} [result] - The deserialized result object if an error did not occur. + * See {@link RunbookListResult} 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. */ - listByJobNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByJobNext(nextPageLink: string, callback: ServiceCallback): void; - listByJobNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * JobScheduleOperations - * __NOTE__: An instance of this class is automatically created for an - * instance of the AutomationClient. - */ -export interface JobScheduleOperations { + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Delete the job schedule identified by job schedule name. - * - * @param {string} resourceGroupName The resource group name. - * - * @param {string} automationAccountName The automation account name. + * Retrieve a list of runbooks. * - * @param {uuid} jobScheduleId The job schedule name. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -5551,20 +5757,17 @@ export interface JobScheduleOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, jobScheduleId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Delete the job schedule identified by job schedule name. - * - * @param {string} resourceGroupName The resource group name. - * - * @param {string} automationAccountName The automation account name. + * Retrieve a list of runbooks. * - * @param {uuid} jobScheduleId The job schedule name. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -5578,7 +5781,7 @@ export interface JobScheduleOperations { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {RunbookListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -5586,25 +5789,38 @@ export interface JobScheduleOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {RunbookListResult} [result] - The deserialized result object if an error did not occur. + * See {@link RunbookListResult} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - deleteMethod(resourceGroupName: string, automationAccountName: string, jobScheduleId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, automationAccountName: string, jobScheduleId: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, automationAccountName: string, jobScheduleId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * TestJobStreams + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface TestJobStreams { /** - * Retrieve the job schedule identified by job schedule name. + * Retrieve a test job stream of the test job identified by runbook name and + * stream id. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {uuid} jobScheduleId The job schedule name. + * @param {string} runbookName The runbook name. + * + * @param {string} jobStreamId The job stream id. * * @param {object} [options] Optional Parameters. * @@ -5613,20 +5829,23 @@ export interface JobScheduleOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, jobScheduleId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, jobStreamId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve the job schedule identified by job schedule name. + * Retrieve a test job stream of the test job identified by runbook name and + * stream id. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {uuid} jobScheduleId The job schedule name. + * @param {string} runbookName The runbook name. + * + * @param {string} jobStreamId The job stream id. * * @param {object} [options] Optional Parameters. * @@ -5640,7 +5859,7 @@ export interface JobScheduleOperations { * * {Promise} A promise is returned. * - * @resolve {JobSchedule} - The deserialized result object. + * @resolve {JobStream} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -5648,89 +5867,55 @@ export interface JobScheduleOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {JobSchedule} [result] - The deserialized result object if an error did not occur. - * See {@link JobSchedule} for more information. + * {JobStream} [result] - The deserialized result object if an error did not occur. + * See {@link JobStream} 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, automationAccountName: string, jobScheduleId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, automationAccountName: string, jobScheduleId: string, callback: ServiceCallback): void; - get(resourceGroupName: string, automationAccountName: string, jobScheduleId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, runbookName: string, jobStreamId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, runbookName: string, jobStreamId: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, runbookName: string, jobStreamId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Create a job schedule. + * Retrieve a list of test job streams identified by runbook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {uuid} jobScheduleId The job schedule name. - * - * @param {object} parameters The parameters supplied to the create job - * schedule operation. - * - * @param {object} parameters.schedule Gets or sets the schedule. - * - * @param {string} [parameters.schedule.name] Gets or sets the name of the - * schedule. - * - * @param {object} parameters.runbook Gets or sets the runbook. - * - * @param {string} [parameters.runbook.name] Gets or sets the name of the - * runbook. - * - * @param {string} [parameters.runOn] Gets or sets the hybrid worker group that - * the scheduled job should run on. - * - * @param {object} [parameters.parameters] Gets or sets a list of job - * properties. + * @param {string} runbookName The runbook name. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.filter] The filter to apply on the operation. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, jobScheduleId: string, parameters: models.JobScheduleCreateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByTestJobWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Create a job schedule. + * Retrieve a list of test job streams identified by runbook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {uuid} jobScheduleId The job schedule name. - * - * @param {object} parameters The parameters supplied to the create job - * schedule operation. - * - * @param {object} parameters.schedule Gets or sets the schedule. - * - * @param {string} [parameters.schedule.name] Gets or sets the name of the - * schedule. - * - * @param {object} parameters.runbook Gets or sets the runbook. - * - * @param {string} [parameters.runbook.name] Gets or sets the name of the - * runbook. - * - * @param {string} [parameters.runOn] Gets or sets the hybrid worker group that - * the scheduled job should run on. - * - * @param {object} [parameters.parameters] Gets or sets a list of job - * properties. + * @param {string} runbookName The runbook name. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.filter] The filter to apply on the operation. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -5741,7 +5926,7 @@ export interface JobScheduleOperations { * * {Promise} A promise is returned. * - * @resolve {JobSchedule} - The deserialized result object. + * @resolve {JobStreamListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -5749,24 +5934,23 @@ export interface JobScheduleOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {JobSchedule} [result] - The deserialized result object if an error did not occur. - * See {@link JobSchedule} for more information. + * {JobStreamListResult} [result] - The deserialized result object if an error did not occur. + * See {@link JobStreamListResult} 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, automationAccountName: string, jobScheduleId: string, parameters: models.JobScheduleCreateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - create(resourceGroupName: string, automationAccountName: string, jobScheduleId: string, parameters: models.JobScheduleCreateParameters, callback: ServiceCallback): void; - create(resourceGroupName: string, automationAccountName: string, jobScheduleId: string, parameters: models.JobScheduleCreateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByTestJob(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByTestJob(resourceGroupName: string, automationAccountName: string, runbookName: string, callback: ServiceCallback): void; + listByTestJob(resourceGroupName: string, automationAccountName: string, runbookName: string, options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve a list of job schedules. - * - * @param {string} resourceGroupName The resource group name. + * Retrieve a list of test job streams identified by runbook name. * - * @param {string} automationAccountName The automation account name. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -5775,18 +5959,17 @@ export interface JobScheduleOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByTestJobNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve a list of job schedules. - * - * @param {string} resourceGroupName The resource group name. + * Retrieve a list of test job streams identified by runbook name. * - * @param {string} automationAccountName The automation account name. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -5800,7 +5983,7 @@ export interface JobScheduleOperations { * * {Promise} A promise is returned. * - * @resolve {JobScheduleListResult} - The deserialized result object. + * @resolve {JobStreamListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -5808,23 +5991,45 @@ export interface JobScheduleOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {JobScheduleListResult} [result] - The deserialized result object if an error did not occur. - * See {@link JobScheduleListResult} for more information. + * {JobStreamListResult} [result] - The deserialized result object if an error did not occur. + * See {@link JobStreamListResult} 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. */ - listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; - listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByTestJobNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByTestJobNext(nextPageLink: string, callback: ServiceCallback): void; + listByTestJobNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * TestJobOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface TestJobOperations { /** - * Retrieve a list of job schedules. + * Create a test job of the runbook. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The parameters supplied to the create test job + * operation. + * + * @param {object} parameters The parameters supplied to the create test job + * operation. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * test job. + * + * @param {string} [parameters.runOn] Gets or sets the runOn which specifies + * the group name where the job is to be executed. * * @param {object} [options] Optional Parameters. * @@ -5833,17 +6038,30 @@ export interface JobScheduleOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, parameters: models.TestJobCreateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve a list of job schedules. + * Create a test job of the runbook. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The parameters supplied to the create test job + * operation. + * + * @param {object} parameters The parameters supplied to the create test job + * operation. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * test job. + * + * @param {string} [parameters.runOn] Gets or sets the runOn which specifies + * the group name where the job is to be executed. * * @param {object} [options] Optional Parameters. * @@ -5857,7 +6075,7 @@ export interface JobScheduleOperations { * * {Promise} A promise is returned. * - * @resolve {JobScheduleListResult} - The deserialized result object. + * @resolve {TestJob} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -5865,38 +6083,26 @@ export interface JobScheduleOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {JobScheduleListResult} [result] - The deserialized result object if an error did not occur. - * See {@link JobScheduleListResult} for more information. - * + * {TestJob} [result] - The deserialized result object if an error did not occur. + * See {@link TestJob} 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. */ - listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; - listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * ActivityOperations - * __NOTE__: An instance of this class is automatically created for an - * instance of the AutomationClient. - */ -export interface ActivityOperations { + create(resourceGroupName: string, automationAccountName: string, runbookName: string, parameters: models.TestJobCreateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, automationAccountName: string, runbookName: string, parameters: models.TestJobCreateParameters, callback: ServiceCallback): void; + create(resourceGroupName: string, automationAccountName: string, runbookName: string, parameters: models.TestJobCreateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve the activity in the module identified by module name and activity - * name. + * Retrieve the test job for the specified runbook. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} moduleName The name of module. - * - * @param {string} activityName The name of activity. + * @param {string} runbookName The runbook name. * * @param {object} [options] Optional Parameters. * @@ -5905,23 +6111,20 @@ export interface ActivityOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, moduleName: string, activityName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve the activity in the module identified by module name and activity - * name. + * Retrieve the test job for the specified runbook. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} moduleName The name of module. - * - * @param {string} activityName The name of activity. + * @param {string} runbookName The runbook name. * * @param {object} [options] Optional Parameters. * @@ -5935,7 +6138,7 @@ export interface ActivityOperations { * * {Promise} A promise is returned. * - * @resolve {Activity} - The deserialized result object. + * @resolve {TestJob} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -5943,26 +6146,26 @@ export interface ActivityOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Activity} [result] - The deserialized result object if an error did not occur. - * See {@link Activity} for more information. + * {TestJob} [result] - The deserialized result object if an error did not occur. + * See {@link TestJob} 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, automationAccountName: string, moduleName: string, activityName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, automationAccountName: string, moduleName: string, activityName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, automationAccountName: string, moduleName: string, activityName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, runbookName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, runbookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve a list of activities in the module identified by module name. + * Resume the test job. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} moduleName The name of module. + * @param {string} runbookName The runbook name. * * @param {object} [options] Optional Parameters. * @@ -5971,20 +6174,20 @@ export interface ActivityOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByModuleWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, moduleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + resumeWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve a list of activities in the module identified by module name. + * Resume the test job. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} moduleName The name of module. + * @param {string} runbookName The runbook name. * * @param {object} [options] Optional Parameters. * @@ -5998,7 +6201,7 @@ export interface ActivityOperations { * * {Promise} A promise is returned. * - * @resolve {ActivityListResult} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -6006,23 +6209,25 @@ export interface ActivityOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ActivityListResult} [result] - The deserialized result object if an error did not occur. - * See {@link ActivityListResult} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByModule(resourceGroupName: string, automationAccountName: string, moduleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByModule(resourceGroupName: string, automationAccountName: string, moduleName: string, callback: ServiceCallback): void; - listByModule(resourceGroupName: string, automationAccountName: string, moduleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + resume(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + resume(resourceGroupName: string, automationAccountName: string, runbookName: string, callback: ServiceCallback): void; + resume(resourceGroupName: string, automationAccountName: string, runbookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve a list of activities in the module identified by module name. + * Stop the test job. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook name. * * @param {object} [options] Optional Parameters. * @@ -6031,17 +6236,20 @@ export interface ActivityOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByModuleNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + stopWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve a list of activities in the module identified by module name. + * Stop the test job. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook name. * * @param {object} [options] Optional Parameters. * @@ -6055,7 +6263,7 @@ export interface ActivityOperations { * * {Promise} A promise is returned. * - * @resolve {ActivityListResult} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -6063,35 +6271,25 @@ export interface ActivityOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ActivityListResult} [result] - The deserialized result object if an error did not occur. - * See {@link ActivityListResult} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByModuleNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByModuleNext(nextPageLink: string, callback: ServiceCallback): void; - listByModuleNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * ModuleOperations - * __NOTE__: An instance of this class is automatically created for an - * instance of the AutomationClient. - */ -export interface ModuleOperations { + stop(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + stop(resourceGroupName: string, automationAccountName: string, runbookName: string, callback: ServiceCallback): void; + stop(resourceGroupName: string, automationAccountName: string, runbookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Delete the module by name. + * Suspend the test job. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} moduleName The module name. + * @param {string} runbookName The runbook name. * * @param {object} [options] Optional Parameters. * @@ -6104,16 +6302,16 @@ export interface ModuleOperations { * * @reject {Error|ServiceError} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, moduleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + suspendWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Delete the module by name. + * Suspend the test job. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} moduleName The module name. + * @param {string} runbookName The runbook name. * * @param {object} [options] Optional Parameters. * @@ -6141,19 +6339,63 @@ export interface ModuleOperations { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - deleteMethod(resourceGroupName: string, automationAccountName: string, moduleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, automationAccountName: string, moduleName: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, automationAccountName: string, moduleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + suspend(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + suspend(resourceGroupName: string, automationAccountName: string, runbookName: string, callback: ServiceCallback): void; + suspend(resourceGroupName: string, automationAccountName: string, runbookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ScheduleOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface ScheduleOperations { /** - * Retrieve the module identified by module name. + * Create a schedule. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} moduleName The module name. + * @param {string} scheduleName The schedule name. + * + * @param {object} parameters The parameters supplied to the create or update + * schedule operation. + * + * @param {string} parameters.name Gets or sets the name of the schedule. + * + * @param {string} [parameters.description] Gets or sets the description of the + * schedule. + * + * @param {date} parameters.startTime Gets or sets the start time of the + * schedule. + * + * @param {date} [parameters.expiryTime] Gets or sets the end time of the + * schedule. + * + * @param {object} [parameters.interval] Gets or sets the interval of the + * schedule. + * + * @param {string} parameters.frequency Possible values include: 'OneTime', + * 'Day', 'Hour', 'Week', 'Month' + * + * @param {string} [parameters.timeZone] Gets or sets the time zone of the + * schedule. + * + * @param {object} [parameters.advancedSchedule] Gets or sets the + * AdvancedSchedule. + * + * @param {array} [parameters.advancedSchedule.weekDays] Days of the week that + * the job should execute on. + * + * @param {array} [parameters.advancedSchedule.monthDays] Days of the month + * that the job should execute on. Must be between 1 and 31. + * + * @param {array} [parameters.advancedSchedule.monthlyOccurrences] Occurrences + * of days within a month. * * @param {object} [options] Optional Parameters. * @@ -6162,20 +6404,55 @@ export interface ModuleOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, moduleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, scheduleName: string, parameters: models.ScheduleCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve the module identified by module name. + * Create a schedule. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} moduleName The module name. + * @param {string} scheduleName The schedule name. + * + * @param {object} parameters The parameters supplied to the create or update + * schedule operation. + * + * @param {string} parameters.name Gets or sets the name of the schedule. + * + * @param {string} [parameters.description] Gets or sets the description of the + * schedule. + * + * @param {date} parameters.startTime Gets or sets the start time of the + * schedule. + * + * @param {date} [parameters.expiryTime] Gets or sets the end time of the + * schedule. + * + * @param {object} [parameters.interval] Gets or sets the interval of the + * schedule. + * + * @param {string} parameters.frequency Possible values include: 'OneTime', + * 'Day', 'Hour', 'Week', 'Month' + * + * @param {string} [parameters.timeZone] Gets or sets the time zone of the + * schedule. + * + * @param {object} [parameters.advancedSchedule] Gets or sets the + * AdvancedSchedule. + * + * @param {array} [parameters.advancedSchedule.weekDays] Days of the week that + * the job should execute on. + * + * @param {array} [parameters.advancedSchedule.monthDays] Days of the month + * that the job should execute on. Must be between 1 and 31. + * + * @param {array} [parameters.advancedSchedule.monthlyOccurrences] Occurrences + * of days within a month. * * @param {object} [options] Optional Parameters. * @@ -6189,7 +6466,7 @@ export interface ModuleOperations { * * {Promise} A promise is returned. * - * @resolve {Module} - The deserialized result object. + * @resolve {Schedule} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -6197,100 +6474,70 @@ export interface ModuleOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Module} [result] - The deserialized result object if an error did not occur. - * See {@link Module} for more information. + * {Schedule} [result] - The deserialized result object if an error did not occur. + * See {@link Schedule} 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, automationAccountName: string, moduleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, automationAccountName: string, moduleName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, automationAccountName: string, moduleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, automationAccountName: string, scheduleName: string, parameters: models.ScheduleCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, automationAccountName: string, scheduleName: string, parameters: models.ScheduleCreateOrUpdateParameters, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, automationAccountName: string, scheduleName: string, parameters: models.ScheduleCreateOrUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Create or Update the module identified by module name. + * Update the schedule identified by schedule name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} moduleName The name of module. - * - * @param {object} parameters The create or update parameters for module. + * @param {string} scheduleName The schedule name. * - * @param {object} parameters.contentLink Gets or sets the module content link. + * @param {object} parameters The parameters supplied to the update schedule + * operation. * - * @param {string} [parameters.contentLink.uri] Gets or sets the uri of the - * runbook content. + * @param {string} [parameters.name] Gets or sets the name of the schedule. * - * @param {object} [parameters.contentLink.contentHash] Gets or sets the hash. + * @param {string} [parameters.description] Gets or sets the description of the + * schedule. * - * @param {string} parameters.contentLink.contentHash.algorithm Gets or sets - * the content hash algorithm used to hash the content. + * @param {boolean} [parameters.isEnabled] Gets or sets a value indicating + * whether this schedule is enabled. * - * @param {string} parameters.contentLink.contentHash.value Gets or sets - * expected hash value of the content. - * - * @param {string} [parameters.contentLink.version] Gets or sets the version of - * the content. - * - * @param {string} [parameters.name] Gets or sets name of the resource. - * - * @param {string} [parameters.location] Gets or sets the location of the - * resource. - * - * @param {object} [parameters.tags] Gets or sets the tags attached to the - * resource. - * - * @param {object} [options] Optional Parameters. + * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, moduleName: string, parameters: models.ModuleCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + updateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, scheduleName: string, parameters: models.ScheduleUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Create or Update the module identified by module name. + * Update the schedule identified by schedule name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} moduleName The name of module. - * - * @param {object} parameters The create or update parameters for module. - * - * @param {object} parameters.contentLink Gets or sets the module content link. - * - * @param {string} [parameters.contentLink.uri] Gets or sets the uri of the - * runbook content. - * - * @param {object} [parameters.contentLink.contentHash] Gets or sets the hash. - * - * @param {string} parameters.contentLink.contentHash.algorithm Gets or sets - * the content hash algorithm used to hash the content. - * - * @param {string} parameters.contentLink.contentHash.value Gets or sets - * expected hash value of the content. + * @param {string} scheduleName The schedule name. * - * @param {string} [parameters.contentLink.version] Gets or sets the version of - * the content. + * @param {object} parameters The parameters supplied to the update schedule + * operation. * - * @param {string} [parameters.name] Gets or sets name of the resource. + * @param {string} [parameters.name] Gets or sets the name of the schedule. * - * @param {string} [parameters.location] Gets or sets the location of the - * resource. + * @param {string} [parameters.description] Gets or sets the description of the + * schedule. * - * @param {object} [parameters.tags] Gets or sets the tags attached to the - * resource. + * @param {boolean} [parameters.isEnabled] Gets or sets a value indicating + * whether this schedule is enabled. * * @param {object} [options] Optional Parameters. * @@ -6304,7 +6551,7 @@ export interface ModuleOperations { * * {Promise} A promise is returned. * - * @resolve {Module} - The deserialized result object. + * @resolve {Schedule} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -6312,102 +6559,111 @@ export interface ModuleOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Module} [result] - The deserialized result object if an error did not occur. - * See {@link Module} for more information. + * {Schedule} [result] - The deserialized result object if an error did not occur. + * See {@link Schedule} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - createOrUpdate(resourceGroupName: string, automationAccountName: string, moduleName: string, parameters: models.ModuleCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, automationAccountName: string, moduleName: string, parameters: models.ModuleCreateOrUpdateParameters, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, automationAccountName: string, moduleName: string, parameters: models.ModuleCreateOrUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + update(resourceGroupName: string, automationAccountName: string, scheduleName: string, parameters: models.ScheduleUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, automationAccountName: string, scheduleName: string, parameters: models.ScheduleUpdateParameters, callback: ServiceCallback): void; + update(resourceGroupName: string, automationAccountName: string, scheduleName: string, parameters: models.ScheduleUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Update the module identified by module name. + * Retrieve the schedule identified by schedule name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} moduleName The name of module. - * - * @param {object} parameters The update parameters for module. - * - * @param {object} [parameters.contentLink] Gets or sets the module content - * link. + * @param {string} scheduleName The schedule name. * - * @param {string} [parameters.contentLink.uri] Gets or sets the uri of the - * runbook content. + * @param {object} [options] Optional Parameters. * - * @param {object} [parameters.contentLink.contentHash] Gets or sets the hash. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {string} parameters.contentLink.contentHash.algorithm Gets or sets - * the content hash algorithm used to hash the content. + * @returns {Promise} A promise is returned * - * @param {string} parameters.contentLink.contentHash.value Gets or sets - * expected hash value of the content. + * @resolve {HttpOperationResponse} - The deserialized result object. * - * @param {string} [parameters.contentLink.version] Gets or sets the version of - * the content. + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, scheduleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the schedule identified by schedule name. * - * @param {string} [parameters.name] Gets or sets name of the resource. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} [parameters.location] Gets or sets the location of the - * resource. + * @param {string} automationAccountName The automation account name. * - * @param {object} [parameters.tags] Gets or sets the tags attached to the - * resource. + * @param {string} scheduleName The schedule name. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * - * @returns {Promise} A promise is returned + * @param {ServiceCallback} [optionalCallback] - The optional callback. * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. * - * @reject {Error|ServiceError} - The error object. + * {Promise} A promise is returned. + * + * @resolve {Schedule} - 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. + * + * {Schedule} [result] - The deserialized result object if an error did not occur. + * See {@link Schedule} 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. */ - updateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, moduleName: string, parameters: models.ModuleUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + get(resourceGroupName: string, automationAccountName: string, scheduleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, scheduleName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, scheduleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + /** - * Update the module identified by module name. + * Delete the schedule identified by schedule name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} moduleName The name of module. - * - * @param {object} parameters The update parameters for module. - * - * @param {object} [parameters.contentLink] Gets or sets the module content - * link. + * @param {string} scheduleName The schedule name. * - * @param {string} [parameters.contentLink.uri] Gets or sets the uri of the - * runbook content. + * @param {object} [options] Optional Parameters. * - * @param {object} [parameters.contentLink.contentHash] Gets or sets the hash. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {string} parameters.contentLink.contentHash.algorithm Gets or sets - * the content hash algorithm used to hash the content. + * @returns {Promise} A promise is returned * - * @param {string} parameters.contentLink.contentHash.value Gets or sets - * expected hash value of the content. + * @resolve {HttpOperationResponse} - The deserialized result object. * - * @param {string} [parameters.contentLink.version] Gets or sets the version of - * the content. + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, scheduleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete the schedule identified by schedule name. * - * @param {string} [parameters.name] Gets or sets name of the resource. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} [parameters.location] Gets or sets the location of the - * resource. + * @param {string} automationAccountName The automation account name. * - * @param {object} [parameters.tags] Gets or sets the tags attached to the - * resource. + * @param {string} scheduleName The schedule name. * * @param {object} [options] Optional Parameters. * @@ -6421,7 +6677,7 @@ export interface ModuleOperations { * * {Promise} A promise is returned. * - * @resolve {Module} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -6429,22 +6685,21 @@ export interface ModuleOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Module} [result] - The deserialized result object if an error did not occur. - * See {@link Module} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - update(resourceGroupName: string, automationAccountName: string, moduleName: string, parameters: models.ModuleUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - update(resourceGroupName: string, automationAccountName: string, moduleName: string, parameters: models.ModuleUpdateParameters, callback: ServiceCallback): void; - update(resourceGroupName: string, automationAccountName: string, moduleName: string, parameters: models.ModuleUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, automationAccountName: string, scheduleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, automationAccountName: string, scheduleName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, automationAccountName: string, scheduleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve a list of modules. + * Retrieve a list of schedules. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -6455,16 +6710,16 @@ export interface ModuleOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve a list of modules. + * Retrieve a list of schedules. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -6480,7 +6735,7 @@ export interface ModuleOperations { * * {Promise} A promise is returned. * - * @resolve {ModuleListResult} - The deserialized result object. + * @resolve {ScheduleListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -6488,20 +6743,20 @@ export interface ModuleOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ModuleListResult} [result] - The deserialized result object if an error did not occur. - * See {@link ModuleListResult} for more information. + * {ScheduleListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ScheduleListResult} 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. */ - listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; - listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve a list of modules. + * Retrieve a list of schedules. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -6513,14 +6768,14 @@ export interface ModuleOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve a list of modules. + * Retrieve a list of schedules. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -6537,7 +6792,7 @@ export interface ModuleOperations { * * {Promise} A promise is returned. * - * @resolve {ModuleListResult} - The deserialized result object. + * @resolve {ScheduleListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -6545,37 +6800,48 @@ export interface ModuleOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ModuleListResult} [result] - The deserialized result object if an error did not occur. - * See {@link ModuleListResult} for more information. + * {ScheduleListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ScheduleListResult} 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. */ - listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; - listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** * @class - * ObjectDataTypes + * VariableOperations * __NOTE__: An instance of this class is automatically created for an * instance of the AutomationClient. */ -export interface ObjectDataTypes { +export interface VariableOperations { /** - * Retrieve a list of fields of a given type identified by module name. + * Create a variable. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} moduleName The name of module. + * @param {string} variableName The variable name. * - * @param {string} typeName The name of type. + * @param {object} parameters The parameters supplied to the create or update + * variable operation. + * + * @param {string} parameters.name Gets or sets the name of the variable. + * + * @param {string} [parameters.value] Gets or sets the value of the variable. + * + * @param {string} [parameters.description] Gets or sets the description of the + * variable. + * + * @param {boolean} [parameters.isEncrypted] Gets or sets the encrypted flag of + * the variable. * * @param {object} [options] Optional Parameters. * @@ -6584,36 +6850,47 @@ export interface ObjectDataTypes { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listFieldsByModuleAndTypeWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, moduleName: string, typeName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, variableName: string, parameters: models.VariableCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve a list of fields of a given type identified by module name. + * Create a variable. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} moduleName The name of module. + * @param {string} variableName The variable name. * - * @param {string} typeName The name of type. + * @param {object} parameters The parameters supplied to the create or update + * variable operation. * - * @param {object} [options] Optional Parameters. + * @param {string} parameters.name Gets or sets the name of the variable. * - * @param {object} [options.customHeaders] Headers that will be added to the - * request + * @param {string} [parameters.value] Gets or sets the value of the variable. * - * @param {ServiceCallback} [optionalCallback] - The optional callback. + * @param {string} [parameters.description] Gets or sets the description of the + * variable. + * + * @param {boolean} [parameters.isEncrypted] Gets or sets the encrypted flag of + * the variable. + * + * @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 {TypeFieldListResult} - The deserialized result object. + * @resolve {Variable} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -6621,26 +6898,36 @@ export interface ObjectDataTypes { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {TypeFieldListResult} [result] - The deserialized result object if an error did not occur. - * See {@link TypeFieldListResult} for more information. + * {Variable} [result] - The deserialized result object if an error did not occur. + * See {@link Variable} 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. */ - listFieldsByModuleAndType(resourceGroupName: string, automationAccountName: string, moduleName: string, typeName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listFieldsByModuleAndType(resourceGroupName: string, automationAccountName: string, moduleName: string, typeName: string, callback: ServiceCallback): void; - listFieldsByModuleAndType(resourceGroupName: string, automationAccountName: string, moduleName: string, typeName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, automationAccountName: string, variableName: string, parameters: models.VariableCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, automationAccountName: string, variableName: string, parameters: models.VariableCreateOrUpdateParameters, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, automationAccountName: string, variableName: string, parameters: models.VariableCreateOrUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve a list of fields of a given type across all accessible modules. + * Update a variable. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} typeName The name of type. + * @param {string} variableName The variable name. + * + * @param {object} parameters The parameters supplied to the update variable + * operation. + * + * @param {string} [parameters.name] Gets or sets the name of the variable. + * + * @param {string} [parameters.value] Gets or sets the value of the variable. + * + * @param {string} [parameters.description] Gets or sets the description of the + * variable. * * @param {object} [options] Optional Parameters. * @@ -6649,20 +6936,30 @@ export interface ObjectDataTypes { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listFieldsByTypeWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, typeName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + updateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, variableName: string, parameters: models.VariableUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve a list of fields of a given type across all accessible modules. + * Update a variable. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} typeName The name of type. + * @param {string} variableName The variable name. + * + * @param {object} parameters The parameters supplied to the update variable + * operation. + * + * @param {string} [parameters.name] Gets or sets the name of the variable. + * + * @param {string} [parameters.value] Gets or sets the value of the variable. + * + * @param {string} [parameters.description] Gets or sets the description of the + * variable. * * @param {object} [options] Optional Parameters. * @@ -6676,7 +6973,7 @@ export interface ObjectDataTypes { * * {Promise} A promise is returned. * - * @resolve {TypeFieldListResult} - The deserialized result object. + * @resolve {Variable} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -6684,37 +6981,26 @@ export interface ObjectDataTypes { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {TypeFieldListResult} [result] - The deserialized result object if an error did not occur. - * See {@link TypeFieldListResult} for more information. + * {Variable} [result] - The deserialized result object if an error did not occur. + * See {@link Variable} 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. */ - listFieldsByType(resourceGroupName: string, automationAccountName: string, typeName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listFieldsByType(resourceGroupName: string, automationAccountName: string, typeName: string, callback: ServiceCallback): void; - listFieldsByType(resourceGroupName: string, automationAccountName: string, typeName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * Fields - * __NOTE__: An instance of this class is automatically created for an - * instance of the AutomationClient. - */ -export interface Fields { + update(resourceGroupName: string, automationAccountName: string, variableName: string, parameters: models.VariableUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, automationAccountName: string, variableName: string, parameters: models.VariableUpdateParameters, callback: ServiceCallback): void; + update(resourceGroupName: string, automationAccountName: string, variableName: string, parameters: models.VariableUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve a list of fields of a given type identified by module name. + * Delete the variable. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} moduleName The name of module. - * - * @param {string} typeName The name of type. + * @param {string} variableName The name of variable. * * @param {object} [options] Optional Parameters. * @@ -6723,22 +7009,20 @@ export interface Fields { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByTypeWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, moduleName: string, typeName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteMethodWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, variableName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve a list of fields of a given type identified by module name. + * Delete the variable. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} moduleName The name of module. - * - * @param {string} typeName The name of type. + * @param {string} variableName The name of variable. * * @param {object} [options] Optional Parameters. * @@ -6752,7 +7036,7 @@ export interface Fields { * * {Promise} A promise is returned. * - * @resolve {TypeFieldListResult} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -6760,35 +7044,25 @@ export interface Fields { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {TypeFieldListResult} [result] - The deserialized result object if an error did not occur. - * See {@link TypeFieldListResult} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByType(resourceGroupName: string, automationAccountName: string, moduleName: string, typeName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByType(resourceGroupName: string, automationAccountName: string, moduleName: string, typeName: string, callback: ServiceCallback): void; - listByType(resourceGroupName: string, automationAccountName: string, moduleName: string, typeName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * RunbookDraftOperations - * __NOTE__: An instance of this class is automatically created for an - * instance of the AutomationClient. - */ -export interface RunbookDraftOperations { + deleteMethod(resourceGroupName: string, automationAccountName: string, variableName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, automationAccountName: string, variableName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, automationAccountName: string, variableName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve the content of runbook draft identified by runbook name. + * Retrieve the variable identified by variable name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} runbookName The runbook name. + * @param {string} variableName The name of variable. * * @param {object} [options] Optional Parameters. * @@ -6797,20 +7071,20 @@ export interface RunbookDraftOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getContentWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, variableName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve the content of runbook draft identified by runbook name. + * Retrieve the variable identified by variable name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} runbookName The runbook name. + * @param {string} variableName The name of variable. * * @param {object} [options] Optional Parameters. * @@ -6824,7 +7098,7 @@ export interface RunbookDraftOperations { * * {Promise} A promise is returned. * - * @resolve {Object} - The deserialized result object. + * @resolve {Variable} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -6832,28 +7106,25 @@ export interface RunbookDraftOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Object} [result] - The deserialized result object if an error did not occur. + * {Variable} [result] - The deserialized result object if an error did not occur. + * See {@link Variable} 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. */ - getContent(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - getContent(resourceGroupName: string, automationAccountName: string, runbookName: string, callback: ServiceCallback): void; - getContent(resourceGroupName: string, automationAccountName: string, runbookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, variableName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, variableName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, variableName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Updates the runbook draft with runbookStream as its content. + * Retrieve a list of variables. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} runbookName The runbook name. - * - * @param {object} runbookContent The runbook draft content. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -6861,23 +7132,19 @@ export interface RunbookDraftOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, runbookContent: stream.Readable, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Updates the runbook draft with runbookStream as its content. + * Retrieve a list of variables. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} runbookName The runbook name. - * - * @param {object} runbookContent The runbook draft content. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -6890,7 +7157,7 @@ export interface RunbookDraftOperations { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {VariableListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -6898,25 +7165,23 @@ export interface RunbookDraftOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {VariableListResult} [result] - The deserialized result object if an error did not occur. + * See {@link VariableListResult} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - createOrUpdate(resourceGroupName: string, automationAccountName: string, runbookName: string, runbookContent: stream.Readable, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, automationAccountName: string, runbookName: string, runbookContent: stream.Readable, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, automationAccountName: string, runbookName: string, runbookContent: stream.Readable, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve the runbook draft identified by runbook name. - * - * @param {string} resourceGroupName The resource group name. - * - * @param {string} automationAccountName The automation account name. + * Retrieve a list of variables. * - * @param {string} runbookName The runbook name. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -6925,20 +7190,17 @@ export interface RunbookDraftOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve the runbook draft identified by runbook name. - * - * @param {string} resourceGroupName The resource group name. - * - * @param {string} automationAccountName The automation account name. + * Retrieve a list of variables. * - * @param {string} runbookName The runbook name. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -6952,7 +7214,7 @@ export interface RunbookDraftOperations { * * {Promise} A promise is returned. * - * @resolve {RunbookDraft} - The deserialized result object. + * @resolve {VariableListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -6960,28 +7222,34 @@ export interface RunbookDraftOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {RunbookDraft} [result] - The deserialized result object if an error did not occur. - * See {@link RunbookDraft} for more information. + * {VariableListResult} [result] - The deserialized result object if an error did not occur. + * See {@link VariableListResult} 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, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, automationAccountName: string, runbookName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, automationAccountName: string, runbookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * WebhookOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface WebhookOperations { /** - * Publish runbook draft. + * Generates a Uri for use in creating a webhook. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} runbookName The parameters supplied to the publish runbook - * operation. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -6989,22 +7257,19 @@ export interface RunbookDraftOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - publishWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + generateUriWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Publish runbook draft. + * Generates a Uri for use in creating a webhook. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} runbookName The parameters supplied to the publish runbook - * operation. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -7017,7 +7282,7 @@ export interface RunbookDraftOperations { * * {Promise} A promise is returned. * - * @resolve {Runbook} - The deserialized result object. + * @resolve {String} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -7025,26 +7290,25 @@ export interface RunbookDraftOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Runbook} [result] - The deserialized result object if an error did not occur. - * See {@link Runbook} for more information. + * {String} [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. */ - publish(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - publish(resourceGroupName: string, automationAccountName: string, runbookName: string, callback: ServiceCallback): void; - publish(resourceGroupName: string, automationAccountName: string, runbookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + generateUri(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + generateUri(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + generateUri(resourceGroupName: string, automationAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve the runbook identified by runbook name. + * Delete the webhook by name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} runbookName The runbook name. + * @param {string} webhookName The webhook name. * * @param {object} [options] Optional Parameters. * @@ -7053,20 +7317,20 @@ export interface RunbookDraftOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - undoEditWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteMethodWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, webhookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve the runbook identified by runbook name. + * Delete the webhook by name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} runbookName The runbook name. + * @param {string} webhookName The webhook name. * * @param {object} [options] Optional Parameters. * @@ -7080,7 +7344,7 @@ export interface RunbookDraftOperations { * * {Promise} A promise is returned. * - * @resolve {RunbookDraftUndoEditResult} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -7088,29 +7352,25 @@ export interface RunbookDraftOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {RunbookDraftUndoEditResult} [result] - The deserialized result object if an error did not occur. - * See {@link RunbookDraftUndoEditResult} for more - * information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - undoEdit(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - undoEdit(resourceGroupName: string, automationAccountName: string, runbookName: string, callback: ServiceCallback): void; - undoEdit(resourceGroupName: string, automationAccountName: string, runbookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, automationAccountName: string, webhookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, automationAccountName: string, webhookName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, automationAccountName: string, webhookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Updates the runbook draft with runbookStream as its content. + * Retrieve the webhook identified by webhook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} runbookName The runbook name. - * - * @param {object} runbookContent The runbook draft content. + * @param {string} webhookName The webhook name. * * @param {object} [options] Optional Parameters. * @@ -7119,22 +7379,20 @@ export interface RunbookDraftOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, runbookContent: stream.Readable, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, webhookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Updates the runbook draft with runbookStream as its content. + * Retrieve the webhook identified by webhook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} runbookName The runbook name. - * - * @param {object} runbookContent The runbook draft content. + * @param {string} webhookName The webhook name. * * @param {object} [options] Optional Parameters. * @@ -7148,7 +7406,7 @@ export interface RunbookDraftOperations { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {Webhook} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -7156,26 +7414,48 @@ export interface RunbookDraftOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {Webhook} [result] - The deserialized result object if an error did not occur. + * See {@link Webhook} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginCreateOrUpdate(resourceGroupName: string, automationAccountName: string, runbookName: string, runbookContent: stream.Readable, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginCreateOrUpdate(resourceGroupName: string, automationAccountName: string, runbookName: string, runbookContent: stream.Readable, callback: ServiceCallback): void; - beginCreateOrUpdate(resourceGroupName: string, automationAccountName: string, runbookName: string, runbookContent: stream.Readable, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, webhookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, webhookName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, webhookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Publish runbook draft. + * Create the webhook identified by webhook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} runbookName The parameters supplied to the publish runbook - * operation. + * @param {string} webhookName The webhook name. + * + * @param {object} parameters The create or update parameters for webhook. + * + * @param {string} parameters.name Gets or sets the name of the webhook. + * + * @param {boolean} [parameters.isEnabled] Gets or sets the value of the + * enabled flag of webhook. + * + * @param {string} [parameters.uri] Gets or sets the uri. + * + * @param {date} [parameters.expiryTime] Gets or sets the expiry time. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * job. + * + * @param {object} [parameters.runbook] Gets or sets the runbook. + * + * @param {string} [parameters.runbook.name] Gets or sets the name of the + * runbook. + * + * @param {string} [parameters.runOn] Gets or sets the name of the hybrid + * worker group the webhook job will run on. * * @param {object} [options] Optional Parameters. * @@ -7184,21 +7464,42 @@ export interface RunbookDraftOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginPublishWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, webhookName: string, parameters: models.WebhookCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Publish runbook draft. + * Create the webhook identified by webhook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} runbookName The parameters supplied to the publish runbook - * operation. + * @param {string} webhookName The webhook name. + * + * @param {object} parameters The create or update parameters for webhook. + * + * @param {string} parameters.name Gets or sets the name of the webhook. + * + * @param {boolean} [parameters.isEnabled] Gets or sets the value of the + * enabled flag of webhook. + * + * @param {string} [parameters.uri] Gets or sets the uri. + * + * @param {date} [parameters.expiryTime] Gets or sets the expiry time. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * job. + * + * @param {object} [parameters.runbook] Gets or sets the runbook. + * + * @param {string} [parameters.runbook.name] Gets or sets the name of the + * runbook. + * + * @param {string} [parameters.runOn] Gets or sets the name of the hybrid + * worker group the webhook job will run on. * * @param {object} [options] Optional Parameters. * @@ -7212,7 +7513,7 @@ export interface RunbookDraftOperations { * * {Promise} A promise is returned. * - * @resolve {Runbook} - The deserialized result object. + * @resolve {Webhook} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -7220,35 +7521,42 @@ export interface RunbookDraftOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Runbook} [result] - The deserialized result object if an error did not occur. - * See {@link Runbook} for more information. + * {Webhook} [result] - The deserialized result object if an error did not occur. + * See {@link Webhook} 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. */ - beginPublish(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginPublish(resourceGroupName: string, automationAccountName: string, runbookName: string, callback: ServiceCallback): void; - beginPublish(resourceGroupName: string, automationAccountName: string, runbookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * RunbookOperations - * __NOTE__: An instance of this class is automatically created for an - * instance of the AutomationClient. - */ -export interface RunbookOperations { + createOrUpdate(resourceGroupName: string, automationAccountName: string, webhookName: string, parameters: models.WebhookCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, automationAccountName: string, webhookName: string, parameters: models.WebhookCreateOrUpdateParameters, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, automationAccountName: string, webhookName: string, parameters: models.WebhookCreateOrUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve the content of runbook identified by runbook name. + * Update the webhook identified by webhook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} runbookName The runbook name. + * @param {string} webhookName The webhook name. + * + * @param {object} parameters The update parameters for webhook. + * + * @param {string} [parameters.name] Gets or sets the name of the webhook. + * + * @param {boolean} [parameters.isEnabled] Gets or sets the value of the + * enabled flag of webhook. + * + * @param {string} [parameters.runOn] Gets or sets the name of the hybrid + * worker group the webhook job will run on. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * job. + * + * @param {string} [parameters.description] Gets or sets the description of the + * webhook. * * @param {object} [options] Optional Parameters. * @@ -7257,20 +7565,36 @@ export interface RunbookOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getContentWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + updateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, webhookName: string, parameters: models.WebhookUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve the content of runbook identified by runbook name. + * Update the webhook identified by webhook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} runbookName The runbook name. + * @param {string} webhookName The webhook name. + * + * @param {object} parameters The update parameters for webhook. + * + * @param {string} [parameters.name] Gets or sets the name of the webhook. + * + * @param {boolean} [parameters.isEnabled] Gets or sets the value of the + * enabled flag of webhook. + * + * @param {string} [parameters.runOn] Gets or sets the name of the hybrid + * worker group the webhook job will run on. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * job. + * + * @param {string} [parameters.description] Gets or sets the description of the + * webhook. * * @param {object} [options] Optional Parameters. * @@ -7284,7 +7608,7 @@ export interface RunbookOperations { * * {Promise} A promise is returned. * - * @resolve {Object} - The deserialized result object. + * @resolve {Webhook} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -7292,50 +7616,51 @@ export interface RunbookOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Object} [result] - The deserialized result object if an error did not occur. + * {Webhook} [result] - The deserialized result object if an error did not occur. + * See {@link Webhook} 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. */ - getContent(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - getContent(resourceGroupName: string, automationAccountName: string, runbookName: string, callback: ServiceCallback): void; - getContent(resourceGroupName: string, automationAccountName: string, runbookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + update(resourceGroupName: string, automationAccountName: string, webhookName: string, parameters: models.WebhookUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, automationAccountName: string, webhookName: string, parameters: models.WebhookUpdateParameters, callback: ServiceCallback): void; + update(resourceGroupName: string, automationAccountName: string, webhookName: string, parameters: models.WebhookUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve the runbook identified by runbook name. + * Retrieve a list of webhooks. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} runbookName The runbook name. - * * @param {object} [options] Optional Parameters. * + * @param {string} [options.filter] The filter to apply on the operation. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve the runbook identified by runbook name. + * Retrieve a list of webhooks. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * - * @param {string} runbookName The runbook name. - * * @param {object} [options] Optional Parameters. * + * @param {string} [options.filter] The filter to apply on the operation. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -7346,7 +7671,7 @@ export interface RunbookOperations { * * {Promise} A promise is returned. * - * @resolve {Runbook} - The deserialized result object. + * @resolve {WebhookListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -7354,281 +7679,333 @@ export interface RunbookOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Runbook} [result] - The deserialized result object if an error did not occur. - * See {@link Runbook} for more information. + * {WebhookListResult} [result] - The deserialized result object if an error did not occur. + * See {@link WebhookListResult} 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, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, automationAccountName: string, runbookName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, automationAccountName: string, runbookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Create the runbook identified by runbook name. + * Retrieve a list of webhooks. * - * @param {string} resourceGroupName The resource group name. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * - * @param {string} automationAccountName The automation account name. + * @param {object} [options] Optional Parameters. * - * @param {string} runbookName The runbook name. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {object} parameters The create or update parameters for runbook. - * Provide either content link for a published runbook or draft, not both. + * @returns {Promise} A promise is returned * - * @param {boolean} [parameters.logVerbose] Gets or sets verbose log option. + * @resolve {HttpOperationResponse} - The deserialized result object. * - * @param {boolean} [parameters.logProgress] Gets or sets progress log option. + * @reject {Error|ServiceError} - The error object. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of webhooks. * - * @param {string} parameters.runbookType Gets or sets the type of the runbook. - * Possible values include: 'Script', 'Graph', 'PowerShellWorkflow', - * 'PowerShell', 'GraphPowerShellWorkflow', 'GraphPowerShell' + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * - * @param {object} [parameters.draft] Gets or sets the draft runbook - * properties. + * @param {object} [options] Optional Parameters. * - * @param {boolean} [parameters.draft.inEdit] Gets or sets whether runbook is - * in edit mode. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {object} [parameters.draft.draftContentLink] Gets or sets the draft - * runbook content link. + * @param {ServiceCallback} [optionalCallback] - The optional callback. * - * @param {date} [parameters.draft.creationTime] Gets or sets the creation time - * of the runbook draft. + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. * - * @param {date} [parameters.draft.lastModifiedTime] Gets or sets the last - * modified time of the runbook draft. + * {Promise} A promise is returned. * - * @param {object} [parameters.draft.parameters] Gets or sets the runbook draft - * parameters. + * @resolve {WebhookListResult} - The deserialized result object. * - * @param {array} [parameters.draft.outputTypes] Gets or sets the runbook - * output types. + * @reject {Error|ServiceError} - The error object. * - * @param {object} [parameters.publishContentLink] Gets or sets the published - * runbook content link. + * {ServiceCallback} optionalCallback(err, result, request, response) * - * @param {string} [parameters.publishContentLink.uri] Gets or sets the uri of - * the runbook content. + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * @param {object} [parameters.publishContentLink.contentHash] Gets or sets the - * hash. + * {WebhookListResult} [result] - The deserialized result object if an error did not occur. + * See {@link WebhookListResult} for more information. * - * @param {string} parameters.publishContentLink.contentHash.algorithm Gets or - * sets the content hash algorithm used to hash the content. + * {WebResource} [request] - The HTTP Request object if an error did not occur. * - * @param {string} parameters.publishContentLink.contentHash.value Gets or sets - * expected hash value of the content. + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * SoftwareUpdateConfigurations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface SoftwareUpdateConfigurations { + + + /** + * Create a new software update configuration with the name given in the URI. * - * @param {string} [parameters.publishContentLink.version] Gets or sets the - * version of the content. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} [parameters.description] Gets or sets the description of the - * runbook. + * @param {string} automationAccountName The name of the automation account. * - * @param {number} [parameters.logActivityTrace] Gets or sets the - * activity-level tracing options of the runbook. - * - * @param {string} [parameters.name] Gets or sets the name of the resource. + * @param {string} softwareUpdateConfigurationName The name of the software + * update configuration to be created. * - * @param {string} [parameters.location] Gets or sets the location of the - * resource. + * @param {object} parameters Request body. * - * @param {object} [parameters.tags] Gets or sets the tags attached to the - * resource. + * @param {object} parameters.updateConfiguration update specific properties + * for the Software update configuration * - * @param {object} [options] Optional Parameters. + * @param {string} parameters.updateConfiguration.operatingSystem operating + * system of target machines. Possible values include: 'Windows', 'Linux' * - * @param {object} [options.customHeaders] Headers that will be added to the - * request + * @param {object} [parameters.updateConfiguration.windows] Windows specific + * update configuration. * - * @returns {Promise} A promise is returned + * @param {string} + * [parameters.updateConfiguration.windows.includedUpdateClassifications] + * Update classification included in the software update configuration. A comma + * separated string with required values. Possible values include: + * 'Unclassified', 'Critical', 'Security', 'UpdateRollup', 'FeaturePack', + * 'ServicePack', 'Definition', 'Tools', 'Updates' * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @param {array} [parameters.updateConfiguration.windows.excludedKbNumbers] KB + * numbers excluded from the software update configuration. * - * @reject {Error|ServiceError} - The error object. - */ - createOrUpdateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, parameters: models.RunbookCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Create the runbook identified by runbook name. + * @param {object} [parameters.updateConfiguration.linux] Linux specific update + * configuration. * - * @param {string} resourceGroupName The resource group name. + * @param {string} + * [parameters.updateConfiguration.linux.includedPackageClassifications] Update + * classifications included in the software update configuration. Possible + * values include: 'Unclassified', 'Critical', 'Security', 'Other' * - * @param {string} automationAccountName The automation account name. + * @param {array} + * [parameters.updateConfiguration.linux.excludedPackageNameMasks] packages + * excluded from the software update configuration. * - * @param {string} runbookName The runbook name. + * @param {moment.duration} [parameters.updateConfiguration.duration] Maximum + * time allowed for the software update configuration run. Duration needs to be + * specified using the format PT[n]H[n]M[n]S as per ISO8601 * - * @param {object} parameters The create or update parameters for runbook. - * Provide either content link for a published runbook or draft, not both. + * @param {array} [parameters.updateConfiguration.azureVirtualMachines] List of + * azure resource Ids for azure virtual machines targeted by the software + * update configuration. * - * @param {boolean} [parameters.logVerbose] Gets or sets verbose log option. + * @param {array} [parameters.updateConfiguration.nonAzureComputerNames] List + * of names of non-azure machines targeted by the software update + * configuration. * - * @param {boolean} [parameters.logProgress] Gets or sets progress log option. + * @param {object} parameters.scheduleInfo Schedule information for the + * Software update configuration * - * @param {string} parameters.runbookType Gets or sets the type of the runbook. - * Possible values include: 'Script', 'Graph', 'PowerShellWorkflow', - * 'PowerShell', 'GraphPowerShellWorkflow', 'GraphPowerShell' + * @param {date} [parameters.scheduleInfo.startTime] Gets or sets the start + * time of the schedule. * - * @param {object} [parameters.draft] Gets or sets the draft runbook - * properties. + * @param {date} [parameters.scheduleInfo.expiryTime] Gets or sets the end time + * of the schedule. * - * @param {boolean} [parameters.draft.inEdit] Gets or sets whether runbook is - * in edit mode. + * @param {number} [parameters.scheduleInfo.expiryTimeOffsetMinutes] Gets or + * sets the expiry time's offset in minutes. * - * @param {object} [parameters.draft.draftContentLink] Gets or sets the draft - * runbook content link. + * @param {boolean} [parameters.scheduleInfo.isEnabled] Gets or sets a value + * indicating whether this schedule is enabled. * - * @param {date} [parameters.draft.creationTime] Gets or sets the creation time - * of the runbook draft. + * @param {date} [parameters.scheduleInfo.nextRun] Gets or sets the next run + * time of the schedule. * - * @param {date} [parameters.draft.lastModifiedTime] Gets or sets the last - * modified time of the runbook draft. + * @param {number} [parameters.scheduleInfo.nextRunOffsetMinutes] Gets or sets + * the next run time's offset in minutes. * - * @param {object} [parameters.draft.parameters] Gets or sets the runbook draft - * parameters. + * @param {number} [parameters.scheduleInfo.interval] Gets or sets the interval + * of the schedule. * - * @param {array} [parameters.draft.outputTypes] Gets or sets the runbook - * output types. + * @param {string} [parameters.scheduleInfo.frequency] Gets or sets the + * frequency of the schedule. Possible values include: 'OneTime', 'Day', + * 'Hour', 'Week', 'Month' * - * @param {object} [parameters.publishContentLink] Gets or sets the published - * runbook content link. + * @param {string} [parameters.scheduleInfo.timeZone] Gets or sets the time + * zone of the schedule. * - * @param {string} [parameters.publishContentLink.uri] Gets or sets the uri of - * the runbook content. + * @param {object} [parameters.scheduleInfo.advancedSchedule] Gets or sets the + * advanced schedule. * - * @param {object} [parameters.publishContentLink.contentHash] Gets or sets the - * hash. + * @param {array} [parameters.scheduleInfo.advancedSchedule.weekDays] Days of + * the week that the job should execute on. * - * @param {string} parameters.publishContentLink.contentHash.algorithm Gets or - * sets the content hash algorithm used to hash the content. + * @param {array} [parameters.scheduleInfo.advancedSchedule.monthDays] Days of + * the month that the job should execute on. Must be between 1 and 31. * - * @param {string} parameters.publishContentLink.contentHash.value Gets or sets - * expected hash value of the content. + * @param {array} [parameters.scheduleInfo.advancedSchedule.monthlyOccurrences] + * Occurrences of days within a month. * - * @param {string} [parameters.publishContentLink.version] Gets or sets the - * version of the content. + * @param {date} [parameters.scheduleInfo.creationTime] Gets or sets the + * creation time. * - * @param {string} [parameters.description] Gets or sets the description of the - * runbook. + * @param {date} [parameters.scheduleInfo.lastModifiedTime] Gets or sets the + * last modified time. * - * @param {number} [parameters.logActivityTrace] Gets or sets the - * activity-level tracing options of the runbook. + * @param {string} [parameters.scheduleInfo.description] Gets or sets the + * description. * - * @param {string} [parameters.name] Gets or sets the name of the resource. + * @param {object} [parameters.error] detailes of provisioning error * - * @param {string} [parameters.location] Gets or sets the location of the - * resource. + * @param {string} [parameters.error.code] Error code * - * @param {object} [parameters.tags] Gets or sets the tags attached to the - * resource. + * @param {string} [parameters.error.message] Error message indicating why the + * operation failed. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * - * @param {ServiceCallback} [optionalCallback] - The optional callback. + * @returns {Promise} A promise is returned * - * @returns {ServiceCallback|Promise} If a callback was passed as the last - * parameter then it returns the callback else returns a Promise. + * @resolve {HttpOperationResponse} - The deserialized result object. * - * {Promise} A promise is returned. + * @reject {Error|ServiceError} - The error object. + */ + createWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, softwareUpdateConfigurationName: string, parameters: models.SoftwareUpdateConfiguration, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create a new software update configuration with the name given in the URI. * - * @resolve {null} - The deserialized result object. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @reject {Error|ServiceError} - The error object. + * @param {string} automationAccountName The name of the automation account. * - * {ServiceCallback} optionalCallback(err, result, request, response) + * @param {string} softwareUpdateConfigurationName The name of the software + * update configuration to be created. * - * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * @param {object} parameters Request body. * - * {null} [result] - The deserialized result object if an error did not occur. + * @param {object} parameters.updateConfiguration update specific properties + * for the Software update configuration * - * {WebResource} [request] - The HTTP Request object if an error did not occur. + * @param {string} parameters.updateConfiguration.operatingSystem operating + * system of target machines. Possible values include: 'Windows', 'Linux' * - * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. - */ - createOrUpdate(resourceGroupName: string, automationAccountName: string, runbookName: string, parameters: models.RunbookCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, automationAccountName: string, runbookName: string, parameters: models.RunbookCreateOrUpdateParameters, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, automationAccountName: string, runbookName: string, parameters: models.RunbookCreateOrUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Update the runbook identified by runbook name. + * @param {object} [parameters.updateConfiguration.windows] Windows specific + * update configuration. * - * @param {string} resourceGroupName The resource group name. + * @param {string} + * [parameters.updateConfiguration.windows.includedUpdateClassifications] + * Update classification included in the software update configuration. A comma + * separated string with required values. Possible values include: + * 'Unclassified', 'Critical', 'Security', 'UpdateRollup', 'FeaturePack', + * 'ServicePack', 'Definition', 'Tools', 'Updates' * - * @param {string} automationAccountName The automation account name. + * @param {array} [parameters.updateConfiguration.windows.excludedKbNumbers] KB + * numbers excluded from the software update configuration. * - * @param {string} runbookName The runbook name. + * @param {object} [parameters.updateConfiguration.linux] Linux specific update + * configuration. * - * @param {object} parameters The update parameters for runbook. + * @param {string} + * [parameters.updateConfiguration.linux.includedPackageClassifications] Update + * classifications included in the software update configuration. Possible + * values include: 'Unclassified', 'Critical', 'Security', 'Other' * - * @param {string} [parameters.description] Gets or sets the description of the - * runbook. + * @param {array} + * [parameters.updateConfiguration.linux.excludedPackageNameMasks] packages + * excluded from the software update configuration. * - * @param {boolean} [parameters.logVerbose] Gets or sets verbose log option. + * @param {moment.duration} [parameters.updateConfiguration.duration] Maximum + * time allowed for the software update configuration run. Duration needs to be + * specified using the format PT[n]H[n]M[n]S as per ISO8601 * - * @param {boolean} [parameters.logProgress] Gets or sets progress log option. + * @param {array} [parameters.updateConfiguration.azureVirtualMachines] List of + * azure resource Ids for azure virtual machines targeted by the software + * update configuration. * - * @param {number} [parameters.logActivityTrace] Gets or sets the - * activity-level tracing options of the runbook. + * @param {array} [parameters.updateConfiguration.nonAzureComputerNames] List + * of names of non-azure machines targeted by the software update + * configuration. * - * @param {string} [parameters.name] Gets or sets the name of the resource. + * @param {object} parameters.scheduleInfo Schedule information for the + * Software update configuration * - * @param {string} [parameters.location] Gets or sets the location of the - * resource. + * @param {date} [parameters.scheduleInfo.startTime] Gets or sets the start + * time of the schedule. * - * @param {object} [parameters.tags] Gets or sets the tags attached to the - * resource. + * @param {date} [parameters.scheduleInfo.expiryTime] Gets or sets the end time + * of the schedule. * - * @param {object} [options] Optional Parameters. + * @param {number} [parameters.scheduleInfo.expiryTimeOffsetMinutes] Gets or + * sets the expiry time's offset in minutes. * - * @param {object} [options.customHeaders] Headers that will be added to the - * request + * @param {boolean} [parameters.scheduleInfo.isEnabled] Gets or sets a value + * indicating whether this schedule is enabled. * - * @returns {Promise} A promise is returned + * @param {date} [parameters.scheduleInfo.nextRun] Gets or sets the next run + * time of the schedule. * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @param {number} [parameters.scheduleInfo.nextRunOffsetMinutes] Gets or sets + * the next run time's offset in minutes. * - * @reject {Error|ServiceError} - The error object. - */ - updateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, parameters: models.RunbookUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Update the runbook identified by runbook name. + * @param {number} [parameters.scheduleInfo.interval] Gets or sets the interval + * of the schedule. * - * @param {string} resourceGroupName The resource group name. + * @param {string} [parameters.scheduleInfo.frequency] Gets or sets the + * frequency of the schedule. Possible values include: 'OneTime', 'Day', + * 'Hour', 'Week', 'Month' * - * @param {string} automationAccountName The automation account name. + * @param {string} [parameters.scheduleInfo.timeZone] Gets or sets the time + * zone of the schedule. * - * @param {string} runbookName The runbook name. + * @param {object} [parameters.scheduleInfo.advancedSchedule] Gets or sets the + * advanced schedule. * - * @param {object} parameters The update parameters for runbook. + * @param {array} [parameters.scheduleInfo.advancedSchedule.weekDays] Days of + * the week that the job should execute on. * - * @param {string} [parameters.description] Gets or sets the description of the - * runbook. + * @param {array} [parameters.scheduleInfo.advancedSchedule.monthDays] Days of + * the month that the job should execute on. Must be between 1 and 31. * - * @param {boolean} [parameters.logVerbose] Gets or sets verbose log option. + * @param {array} [parameters.scheduleInfo.advancedSchedule.monthlyOccurrences] + * Occurrences of days within a month. * - * @param {boolean} [parameters.logProgress] Gets or sets progress log option. + * @param {date} [parameters.scheduleInfo.creationTime] Gets or sets the + * creation time. * - * @param {number} [parameters.logActivityTrace] Gets or sets the - * activity-level tracing options of the runbook. + * @param {date} [parameters.scheduleInfo.lastModifiedTime] Gets or sets the + * last modified time. * - * @param {string} [parameters.name] Gets or sets the name of the resource. + * @param {string} [parameters.scheduleInfo.description] Gets or sets the + * description. * - * @param {string} [parameters.location] Gets or sets the location of the - * resource. + * @param {object} [parameters.error] detailes of provisioning error * - * @param {object} [parameters.tags] Gets or sets the tags attached to the - * resource. + * @param {string} [parameters.error.code] Error code + * + * @param {string} [parameters.error.message] Error message indicating why the + * operation failed. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -7639,7 +8016,7 @@ export interface RunbookOperations { * * {Promise} A promise is returned. * - * @resolve {Runbook} - The deserialized result object. + * @resolve {SoftwareUpdateConfiguration} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -7647,51 +8024,60 @@ export interface RunbookOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Runbook} [result] - The deserialized result object if an error did not occur. - * See {@link Runbook} for more information. + * {SoftwareUpdateConfiguration} [result] - The deserialized result object if an error did not occur. + * See {@link SoftwareUpdateConfiguration} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - update(resourceGroupName: string, automationAccountName: string, runbookName: string, parameters: models.RunbookUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - update(resourceGroupName: string, automationAccountName: string, runbookName: string, parameters: models.RunbookUpdateParameters, callback: ServiceCallback): void; - update(resourceGroupName: string, automationAccountName: string, runbookName: string, parameters: models.RunbookUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + create(resourceGroupName: string, automationAccountName: string, softwareUpdateConfigurationName: string, parameters: models.SoftwareUpdateConfiguration, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, automationAccountName: string, softwareUpdateConfigurationName: string, parameters: models.SoftwareUpdateConfiguration, callback: ServiceCallback): void; + create(resourceGroupName: string, automationAccountName: string, softwareUpdateConfigurationName: string, parameters: models.SoftwareUpdateConfiguration, options: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Delete the runbook by name. + * Get a single software update configuration by name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} runbookName The runbook name. + * @param {string} softwareUpdateConfigurationName The name of the software + * update configuration to be created. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getByNameWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, softwareUpdateConfigurationName: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Delete the runbook by name. + * Get a single software update configuration by name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} runbookName The runbook name. + * @param {string} softwareUpdateConfigurationName The name of the software + * update configuration to be created. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -7702,7 +8088,7 @@ export interface RunbookOperations { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {SoftwareUpdateConfiguration} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -7710,46 +8096,60 @@ export interface RunbookOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {SoftwareUpdateConfiguration} [result] - The deserialized result object if an error did not occur. + * See {@link SoftwareUpdateConfiguration} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - deleteMethod(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, automationAccountName: string, runbookName: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, automationAccountName: string, runbookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + getByName(resourceGroupName: string, automationAccountName: string, softwareUpdateConfigurationName: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + getByName(resourceGroupName: string, automationAccountName: string, softwareUpdateConfigurationName: string, callback: ServiceCallback): void; + getByName(resourceGroupName: string, automationAccountName: string, softwareUpdateConfigurationName: string, options: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve a list of runbooks. + * delete a specific software update configuration. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} softwareUpdateConfigurationName The name of the software + * update configuration to be created. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteMethodWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, softwareUpdateConfigurationName: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve a list of runbooks. + * delete a specific software update configuration. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} softwareUpdateConfigurationName The name of the software + * update configuration to be created. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -7760,7 +8160,7 @@ export interface RunbookOperations { * * {Promise} A promise is returned. * - * @resolve {RunbookListResult} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -7768,45 +8168,56 @@ export interface RunbookOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {RunbookListResult} [result] - The deserialized result object if an error did not occur. - * See {@link RunbookListResult} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; - listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, automationAccountName: string, softwareUpdateConfigurationName: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, automationAccountName: string, softwareUpdateConfigurationName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, automationAccountName: string, softwareUpdateConfigurationName: string, options: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve a list of runbooks. + * Get all software update configurations for the account. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @param {string} [options.filter] The filter to apply on the operation. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { clientRequestId? : string, filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve a list of runbooks. + * Get all software update configurations for the account. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @param {string} [options.filter] The filter to apply on the operation. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -7817,7 +8228,7 @@ export interface RunbookOperations { * * {Promise} A promise is returned. * - * @resolve {RunbookListResult} - The deserialized result object. + * @resolve {SoftwareUpdateConfigurationListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -7825,64 +8236,69 @@ export interface RunbookOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {RunbookListResult} [result] - The deserialized result object if an error did not occur. - * See {@link RunbookListResult} for more information. + * {SoftwareUpdateConfigurationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SoftwareUpdateConfigurationListResult} 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. */ - listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; - listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + list(resourceGroupName: string, automationAccountName: string, options?: { clientRequestId? : string, filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, automationAccountName: string, options: { clientRequestId? : string, filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** * @class - * TestJobStreams + * SoftwareUpdateConfigurationRuns * __NOTE__: An instance of this class is automatically created for an * instance of the AutomationClient. */ -export interface TestJobStreams { +export interface SoftwareUpdateConfigurationRuns { /** - * Retrieve a test job streams identified by runbook name and stream id. - * - * @param {string} resourceGroupName The resource group name. + * Get a single software update configuration Run by Id. * - * @param {string} automationAccountName The automation account name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} runbookName The runbook name. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} jobStreamId The job stream id. + * @param {uuid} softwareUpdateConfigurationRunId The Id of the software update + * configuration run. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, jobStreamId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getByIdWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, softwareUpdateConfigurationRunId: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve a test job streams identified by runbook name and stream id. - * - * @param {string} resourceGroupName The resource group name. + * Get a single software update configuration Run by Id. * - * @param {string} automationAccountName The automation account name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} runbookName The runbook name. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} jobStreamId The job stream id. + * @param {uuid} softwareUpdateConfigurationRunId The Id of the software update + * configuration run. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -7893,7 +8309,7 @@ export interface TestJobStreams { * * {Promise} A promise is returned. * - * @resolve {JobStream} - The deserialized result object. + * @resolve {SoftwareUpdateConfigurationRun} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -7901,54 +8317,73 @@ export interface TestJobStreams { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {JobStream} [result] - The deserialized result object if an error did not occur. - * See {@link JobStream} for more information. + * {SoftwareUpdateConfigurationRun} [result] - The deserialized result object if an error did not occur. + * See {@link SoftwareUpdateConfigurationRun} 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, automationAccountName: string, runbookName: string, jobStreamId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, automationAccountName: string, runbookName: string, jobStreamId: string, callback: ServiceCallback): void; - get(resourceGroupName: string, automationAccountName: string, runbookName: string, jobStreamId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + getById(resourceGroupName: string, automationAccountName: string, softwareUpdateConfigurationRunId: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + getById(resourceGroupName: string, automationAccountName: string, softwareUpdateConfigurationRunId: string, callback: ServiceCallback): void; + getById(resourceGroupName: string, automationAccountName: string, softwareUpdateConfigurationRunId: string, options: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve a list of test job streams identified by runbook name. - * - * @param {string} resourceGroupName The resource group name. + * Return list of software update configuration runs * - * @param {string} automationAccountName The automation account name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} runbookName The runbook name. + * @param {string} automationAccountName The name of the automation account. * * @param {object} [options] Optional Parameters. * - * @param {string} [options.filter] The filter to apply on the operation. + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @param {string} [options.filter] The filter to apply on the operation. You + * can use the following filters: 'properties/osType', 'properties/status', + * 'properties/startTime', and 'properties/softwareUpdateConfiguration/name' + * + * @param {string} [options.skip] number of entries you skip before returning + * results + * + * @param {string} [options.top] Maximum number of entries returned in the + * results collection * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByTestJobWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + listWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { clientRequestId? : string, filter? : string, skip? : string, top? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve a list of test job streams identified by runbook name. + * Return list of software update configuration runs * - * @param {string} resourceGroupName The resource group name. - * - * @param {string} automationAccountName The automation account name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} runbookName The runbook name. + * @param {string} automationAccountName The name of the automation account. * * @param {object} [options] Optional Parameters. * - * @param {string} [options.filter] The filter to apply on the operation. + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @param {string} [options.filter] The filter to apply on the operation. You + * can use the following filters: 'properties/osType', 'properties/status', + * 'properties/startTime', and 'properties/softwareUpdateConfiguration/name' + * + * @param {string} [options.skip] number of entries you skip before returning + * results + * + * @param {string} [options.top] Maximum number of entries returned in the + * results collection * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -7960,7 +8395,7 @@ export interface TestJobStreams { * * {Promise} A promise is returned. * - * @resolve {JobStreamListResult} - The deserialized result object. + * @resolve {SoftwareUpdateConfigurationRunListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -7968,45 +8403,69 @@ export interface TestJobStreams { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {JobStreamListResult} [result] - The deserialized result object if an error did not occur. - * See {@link JobStreamListResult} for more information. + * {SoftwareUpdateConfigurationRunListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SoftwareUpdateConfigurationRunListResult} + * 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. */ - listByTestJob(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; - listByTestJob(resourceGroupName: string, automationAccountName: string, runbookName: string, callback: ServiceCallback): void; - listByTestJob(resourceGroupName: string, automationAccountName: string, runbookName: string, options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + list(resourceGroupName: string, automationAccountName: string, options?: { clientRequestId? : string, filter? : string, skip? : string, top? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, automationAccountName: string, options: { clientRequestId? : string, filter? : string, skip? : string, top? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * SoftwareUpdateConfigurationMachineRuns + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface SoftwareUpdateConfigurationMachineRuns { /** - * Retrieve a list of test job streams identified by runbook name. + * Get a single software update configuration machine run by Id. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {uuid} softwareUpdateConfigurationMachineRunId The Id of the software + * update configuration machine run. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByTestJobNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getByIdWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, softwareUpdateConfigurationMachineRunId: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve a list of test job streams identified by runbook name. + * Get a single software update configuration machine run by Id. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {uuid} softwareUpdateConfigurationMachineRunId The Id of the software + * update configuration machine run. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -8017,7 +8476,7 @@ export interface TestJobStreams { * * {Promise} A promise is returned. * - * @resolve {JobStreamListResult} - The deserialized result object. + * @resolve {SoftwareUpdateConfigurationMachineRun} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -8025,83 +8484,73 @@ export interface TestJobStreams { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {JobStreamListResult} [result] - The deserialized result object if an error did not occur. - * See {@link JobStreamListResult} for more information. + * {SoftwareUpdateConfigurationMachineRun} [result] - The deserialized result object if an error did not occur. + * See {@link SoftwareUpdateConfigurationMachineRun} 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. */ - listByTestJobNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByTestJobNext(nextPageLink: string, callback: ServiceCallback): void; - listByTestJobNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * TestJobs - * __NOTE__: An instance of this class is automatically created for an - * instance of the AutomationClient. - */ -export interface TestJobs { + getById(resourceGroupName: string, automationAccountName: string, softwareUpdateConfigurationMachineRunId: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + getById(resourceGroupName: string, automationAccountName: string, softwareUpdateConfigurationMachineRunId: string, callback: ServiceCallback): void; + getById(resourceGroupName: string, automationAccountName: string, softwareUpdateConfigurationMachineRunId: string, options: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Create a test job of the runbook. - * - * @param {string} resourceGroupName The resource group name. + * Return list of software update configuration machine runs * - * @param {string} automationAccountName The automation account name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} runbookName The parameters supplied to the create test job - * operation. + * @param {string} automationAccountName The name of the automation account. * - * @param {object} parameters The parameters supplied to the create test job - * operation. + * @param {object} [options] Optional Parameters. * - * @param {string} parameters.runbookName Gets or sets the runbook name. + * @param {string} [options.clientRequestId] Identifies this specific client + * request. * - * @param {object} [parameters.parameters] Gets or sets the parameters of the - * test job. + * @param {string} [options.filter] The filter to apply on the operation. You + * can use the following filters: 'properties/osType', 'properties/status', + * 'properties/startTime', and 'properties/softwareUpdateConfiguration/name' * - * @param {string} [parameters.runOn] Gets or sets the runOn which specifies - * the group name where the job is to be executed. + * @param {string} [options.skip] number of entries you skip before returning + * results * - * @param {object} [options] Optional Parameters. + * @param {string} [options.top] Maximum number of entries returned in the + * results collection * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, parameters: models.TestJobCreateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { clientRequestId? : string, filter? : string, skip? : string, top? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Create a test job of the runbook. - * - * @param {string} resourceGroupName The resource group name. + * Return list of software update configuration machine runs * - * @param {string} automationAccountName The automation account name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} runbookName The parameters supplied to the create test job - * operation. + * @param {string} automationAccountName The name of the automation account. * - * @param {object} parameters The parameters supplied to the create test job - * operation. + * @param {object} [options] Optional Parameters. * - * @param {string} parameters.runbookName Gets or sets the runbook name. + * @param {string} [options.clientRequestId] Identifies this specific client + * request. * - * @param {object} [parameters.parameters] Gets or sets the parameters of the - * test job. + * @param {string} [options.filter] The filter to apply on the operation. You + * can use the following filters: 'properties/osType', 'properties/status', + * 'properties/startTime', and 'properties/softwareUpdateConfiguration/name' * - * @param {string} [parameters.runOn] Gets or sets the runOn which specifies - * the group name where the job is to be executed. + * @param {string} [options.skip] number of entries you skip before returning + * results * - * @param {object} [options] Optional Parameters. + * @param {string} [options.top] Maximum number of entries returned in the + * results collection * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -8113,7 +8562,7 @@ export interface TestJobs { * * {Promise} A promise is returned. * - * @resolve {TestJob} - The deserialized result object. + * @resolve {SoftwareUpdateConfigurationMachineRunListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -8121,26 +8570,65 @@ export interface TestJobs { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {TestJob} [result] - The deserialized result object if an error did not occur. - * See {@link TestJob} for more information. + * {SoftwareUpdateConfigurationMachineRunListResult} [result] - The deserialized result object if an error did not occur. + * See {@link + * SoftwareUpdateConfigurationMachineRunListResult} 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, automationAccountName: string, runbookName: string, parameters: models.TestJobCreateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - create(resourceGroupName: string, automationAccountName: string, runbookName: string, parameters: models.TestJobCreateParameters, callback: ServiceCallback): void; - create(resourceGroupName: string, automationAccountName: string, runbookName: string, parameters: models.TestJobCreateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + list(resourceGroupName: string, automationAccountName: string, options?: { clientRequestId? : string, filter? : string, skip? : string, top? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, automationAccountName: string, options: { clientRequestId? : string, filter? : string, skip? : string, top? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * SourceControlOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface SourceControlOperations { /** - * Retrieve the test job for the specified runbook. + * Create a source control. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} runbookName The runbook name. + * @param {string} sourceControlName The source control name. + * + * @param {object} parameters The parameters supplied to the create or update + * source control operation. + * + * @param {string} [parameters.repoUrl] Gets or sets the repo url of the source + * control. + * + * @param {string} [parameters.branch] Gets or sets the repo branch of the + * source control. Include branch as empty string for VsoTfvc. + * + * @param {string} [parameters.folderPath] Gets or sets the folder path of the + * source control. Path must be relative. + * + * @param {boolean} [parameters.autoSync] Gets or sets auto async of the source + * control. Default is false. + * + * @param {boolean} [parameters.publishRunbook] Gets or sets the auto publish + * of the source control. Default is true. + * + * @param {string} [parameters.sourceType] The source type. Must be one of + * VsoGit, VsoTfvc, GitHub, case sensitive. Possible values include: 'VsoGit', + * 'VsoTfvc', 'GitHub' + * + * @param {string} [parameters.securityToken] Gets or sets the authorization + * token for the repo of the source control. + * + * @param {string} [parameters.description] Gets or sets the user description + * of the source control. * * @param {object} [options] Optional Parameters. * @@ -8149,20 +8637,48 @@ export interface TestJobs { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, sourceControlName: string, parameters: models.SourceControlCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve the test job for the specified runbook. + * Create a source control. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} runbookName The runbook name. + * @param {string} sourceControlName The source control name. + * + * @param {object} parameters The parameters supplied to the create or update + * source control operation. + * + * @param {string} [parameters.repoUrl] Gets or sets the repo url of the source + * control. + * + * @param {string} [parameters.branch] Gets or sets the repo branch of the + * source control. Include branch as empty string for VsoTfvc. + * + * @param {string} [parameters.folderPath] Gets or sets the folder path of the + * source control. Path must be relative. + * + * @param {boolean} [parameters.autoSync] Gets or sets auto async of the source + * control. Default is false. + * + * @param {boolean} [parameters.publishRunbook] Gets or sets the auto publish + * of the source control. Default is true. + * + * @param {string} [parameters.sourceType] The source type. Must be one of + * VsoGit, VsoTfvc, GitHub, case sensitive. Possible values include: 'VsoGit', + * 'VsoTfvc', 'GitHub' + * + * @param {string} [parameters.securityToken] Gets or sets the authorization + * token for the repo of the source control. + * + * @param {string} [parameters.description] Gets or sets the user description + * of the source control. * * @param {object} [options] Optional Parameters. * @@ -8176,7 +8692,7 @@ export interface TestJobs { * * {Promise} A promise is returned. * - * @resolve {TestJob} - The deserialized result object. + * @resolve {SourceControl} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -8184,26 +8700,47 @@ export interface TestJobs { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {TestJob} [result] - The deserialized result object if an error did not occur. - * See {@link TestJob} for more information. + * {SourceControl} [result] - The deserialized result object if an error did not occur. + * See {@link SourceControl} 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, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, automationAccountName: string, runbookName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, automationAccountName: string, runbookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, automationAccountName: string, sourceControlName: string, parameters: models.SourceControlCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, automationAccountName: string, sourceControlName: string, parameters: models.SourceControlCreateOrUpdateParameters, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, automationAccountName: string, sourceControlName: string, parameters: models.SourceControlCreateOrUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Resume the test job. + * Update a source control. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} runbookName The runbook name. + * @param {string} sourceControlName The source control name. + * + * @param {object} parameters The parameters supplied to the update source + * control operation. + * + * @param {string} [parameters.branch] Gets or sets the repo branch of the + * source control. + * + * @param {string} [parameters.folderPath] Gets or sets the folder path of the + * source control. Path must be relative. + * + * @param {boolean} [parameters.autoSync] Gets or sets auto async of the source + * control. Default is false. + * + * @param {boolean} [parameters.publishRunbook] Gets or sets the auto publish + * of the source control. Default is true. + * + * @param {string} [parameters.securityToken] Gets or sets the authorization + * token for the repo of the source control. + * + * @param {string} [parameters.description] Gets or sets the user description + * of the source control. * * @param {object} [options] Optional Parameters. * @@ -8212,20 +8749,41 @@ export interface TestJobs { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - resumeWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + updateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, sourceControlName: string, parameters: models.SourceControlUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Resume the test job. + * Update a source control. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} runbookName The runbook name. + * @param {string} sourceControlName The source control name. + * + * @param {object} parameters The parameters supplied to the update source + * control operation. + * + * @param {string} [parameters.branch] Gets or sets the repo branch of the + * source control. + * + * @param {string} [parameters.folderPath] Gets or sets the folder path of the + * source control. Path must be relative. + * + * @param {boolean} [parameters.autoSync] Gets or sets auto async of the source + * control. Default is false. + * + * @param {boolean} [parameters.publishRunbook] Gets or sets the auto publish + * of the source control. Default is true. + * + * @param {string} [parameters.securityToken] Gets or sets the authorization + * token for the repo of the source control. + * + * @param {string} [parameters.description] Gets or sets the user description + * of the source control. * * @param {object} [options] Optional Parameters. * @@ -8239,7 +8797,7 @@ export interface TestJobs { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {SourceControl} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -8247,25 +8805,26 @@ export interface TestJobs { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {SourceControl} [result] - The deserialized result object if an error did not occur. + * See {@link SourceControl} 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. */ - resume(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - resume(resourceGroupName: string, automationAccountName: string, runbookName: string, callback: ServiceCallback): void; - resume(resourceGroupName: string, automationAccountName: string, runbookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + update(resourceGroupName: string, automationAccountName: string, sourceControlName: string, parameters: models.SourceControlUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, automationAccountName: string, sourceControlName: string, parameters: models.SourceControlUpdateParameters, callback: ServiceCallback): void; + update(resourceGroupName: string, automationAccountName: string, sourceControlName: string, parameters: models.SourceControlUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Stop the test job. + * Delete the source control. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} runbookName The runbook name. + * @param {string} sourceControlName The name of source control. * * @param {object} [options] Optional Parameters. * @@ -8278,16 +8837,16 @@ export interface TestJobs { * * @reject {Error|ServiceError} - The error object. */ - stopWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteMethodWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, sourceControlName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Stop the test job. + * Delete the source control. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} runbookName The runbook name. + * @param {string} sourceControlName The name of source control. * * @param {object} [options] Optional Parameters. * @@ -8315,19 +8874,19 @@ export interface TestJobs { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - stop(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - stop(resourceGroupName: string, automationAccountName: string, runbookName: string, callback: ServiceCallback): void; - stop(resourceGroupName: string, automationAccountName: string, runbookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, automationAccountName: string, sourceControlName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, automationAccountName: string, sourceControlName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, automationAccountName: string, sourceControlName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Suspend the test job. + * Retrieve the source control identified by source control name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} runbookName The runbook name. + * @param {string} sourceControlName The name of source control. * * @param {object} [options] Optional Parameters. * @@ -8336,20 +8895,20 @@ export interface TestJobs { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - suspendWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, sourceControlName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Suspend the test job. + * Retrieve the source control identified by source control name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} runbookName The runbook name. + * @param {string} sourceControlName The name of source control. * * @param {object} [options] Optional Parameters. * @@ -8363,7 +8922,7 @@ export interface TestJobs { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {SourceControl} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -8371,69 +8930,87 @@ export interface TestJobs { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {SourceControl} [result] - The deserialized result object if an error did not occur. + * See {@link SourceControl} 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. */ - suspend(resourceGroupName: string, automationAccountName: string, runbookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - suspend(resourceGroupName: string, automationAccountName: string, runbookName: string, callback: ServiceCallback): void; - suspend(resourceGroupName: string, automationAccountName: string, runbookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} + get(resourceGroupName: string, automationAccountName: string, sourceControlName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, sourceControlName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, sourceControlName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -/** - * @class - * ScheduleOperations - * __NOTE__: An instance of this class is automatically created for an - * instance of the AutomationClient. - */ -export interface ScheduleOperations { + /** + * Retrieve a list of source controls. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Create a schedule. + * Retrieve a list of source controls. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} scheduleName The schedule name. + * @param {object} [options] Optional Parameters. * - * @param {object} parameters The parameters supplied to the create or update - * schedule operation. + * @param {string} [options.filter] The filter to apply on the operation. * - * @param {string} parameters.name Gets or sets the name of the schedule. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {string} [parameters.description] Gets or sets the description of the - * schedule. + * @param {ServiceCallback} [optionalCallback] - The optional callback. * - * @param {date} parameters.startTime Gets or sets the start time of the - * schedule. + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. * - * @param {date} [parameters.expiryTime] Gets or sets the end time of the - * schedule. + * {Promise} A promise is returned. * - * @param {object} [parameters.interval] Gets or sets the interval of the - * schedule. + * @resolve {SourceControlListResult} - The deserialized result object. * - * @param {string} parameters.frequency Gets or sets the frequency of the - * schedule. Possible values include: 'OneTime', 'Day', 'Hour', 'Week', 'Month' + * @reject {Error|ServiceError} - The error object. * - * @param {string} [parameters.timeZone] Gets or sets the time zone of the - * schedule. + * {ServiceCallback} optionalCallback(err, result, request, response) * - * @param {object} [parameters.advancedSchedule] Gets or sets the - * AdvancedSchedule. + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * @param {array} [parameters.advancedSchedule.weekDays] Days of the week that - * the job should execute on. + * {SourceControlListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SourceControlListResult} for more + * information. * - * @param {array} [parameters.advancedSchedule.monthDays] Days of the month - * that the job should execute on. Must be between 1 and 31. + * {WebResource} [request] - The HTTP Request object if an error did not occur. * - * @param {array} [parameters.advancedSchedule.monthlyOccurrences] Occurrences - * of days within a month. + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of source controls. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -8442,55 +9019,94 @@ export interface ScheduleOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, scheduleName: string, parameters: models.ScheduleCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Create a schedule. + * Retrieve a list of source controls. * - * @param {string} resourceGroupName The resource group name. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * - * @param {string} automationAccountName The automation account name. + * @param {object} [options] Optional Parameters. * - * @param {string} scheduleName The schedule name. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {object} parameters The parameters supplied to the create or update - * schedule operation. + * @param {ServiceCallback} [optionalCallback] - The optional callback. * - * @param {string} parameters.name Gets or sets the name of the schedule. + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. * - * @param {string} [parameters.description] Gets or sets the description of the - * schedule. + * {Promise} A promise is returned. * - * @param {date} parameters.startTime Gets or sets the start time of the - * schedule. + * @resolve {SourceControlListResult} - The deserialized result object. * - * @param {date} [parameters.expiryTime] Gets or sets the end time of the - * schedule. + * @reject {Error|ServiceError} - The error object. * - * @param {object} [parameters.interval] Gets or sets the interval of the - * schedule. + * {ServiceCallback} optionalCallback(err, result, request, response) * - * @param {string} parameters.frequency Gets or sets the frequency of the - * schedule. Possible values include: 'OneTime', 'Day', 'Hour', 'Week', 'Month' + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * @param {string} [parameters.timeZone] Gets or sets the time zone of the - * schedule. + * {SourceControlListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SourceControlListResult} for more + * information. * - * @param {object} [parameters.advancedSchedule] Gets or sets the - * AdvancedSchedule. + * {WebResource} [request] - The HTTP Request object if an error did not occur. * - * @param {array} [parameters.advancedSchedule.weekDays] Days of the week that - * the job should execute on. + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * SourceControlSyncJobOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface SourceControlSyncJobOperations { + + + /** + * Creates the sync job for a source control. * - * @param {array} [parameters.advancedSchedule.monthDays] Days of the month - * that the job should execute on. Must be between 1 and 31. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {array} [parameters.advancedSchedule.monthlyOccurrences] Occurrences - * of days within a month. + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {uuid} sourceControlSyncJobId The source control sync job id. + * + * @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, automationAccountName: string, sourceControlName: string, sourceControlSyncJobId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates the sync job for a source control. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {uuid} sourceControlSyncJobId The source control sync job id. * * @param {object} [options] Optional Parameters. * @@ -8504,7 +9120,7 @@ export interface ScheduleOperations { * * {Promise} A promise is returned. * - * @resolve {Schedule} - The deserialized result object. + * @resolve {SourceControlSyncJob} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -8512,37 +9128,28 @@ export interface ScheduleOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Schedule} [result] - The deserialized result object if an error did not occur. - * See {@link Schedule} for more information. + * {SourceControlSyncJob} [result] - The deserialized result object if an error did not occur. + * See {@link SourceControlSyncJob} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - createOrUpdate(resourceGroupName: string, automationAccountName: string, scheduleName: string, parameters: models.ScheduleCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, automationAccountName: string, scheduleName: string, parameters: models.ScheduleCreateOrUpdateParameters, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, automationAccountName: string, scheduleName: string, parameters: models.ScheduleCreateOrUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + create(resourceGroupName: string, automationAccountName: string, sourceControlName: string, sourceControlSyncJobId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, automationAccountName: string, sourceControlName: string, sourceControlSyncJobId: string, callback: ServiceCallback): void; + create(resourceGroupName: string, automationAccountName: string, sourceControlName: string, sourceControlSyncJobId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Update the schedule identified by schedule name. - * - * @param {string} resourceGroupName The resource group name. - * - * @param {string} automationAccountName The automation account name. - * - * @param {string} scheduleName The schedule name. + * Retrieve the source control sync job identified by job id. * - * @param {object} parameters The parameters supplied to the update schedule - * operation. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} parameters.name Gets or sets the name of the schedule. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} [parameters.description] Gets or sets the description of the - * schedule. + * @param {string} sourceControlName The source control name. * - * @param {boolean} [parameters.isEnabled] Gets or sets a value indicating - * whether this schedule is enabled. + * @param {uuid} sourceControlSyncJobId The source control sync job id. * * @param {object} [options] Optional Parameters. * @@ -8551,31 +9158,22 @@ export interface ScheduleOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - updateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, scheduleName: string, parameters: models.ScheduleUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, sourceControlName: string, sourceControlSyncJobId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Update the schedule identified by schedule name. - * - * @param {string} resourceGroupName The resource group name. - * - * @param {string} automationAccountName The automation account name. - * - * @param {string} scheduleName The schedule name. + * Retrieve the source control sync job identified by job id. * - * @param {object} parameters The parameters supplied to the update schedule - * operation. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} parameters.name Gets or sets the name of the schedule. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} [parameters.description] Gets or sets the description of the - * schedule. + * @param {string} sourceControlName The source control name. * - * @param {boolean} [parameters.isEnabled] Gets or sets a value indicating - * whether this schedule is enabled. + * @param {uuid} sourceControlSyncJobId The source control sync job id. * * @param {object} [options] Optional Parameters. * @@ -8589,7 +9187,7 @@ export interface ScheduleOperations { * * {Promise} A promise is returned. * - * @resolve {Schedule} - The deserialized result object. + * @resolve {SourceControlSyncJobById} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -8597,51 +9195,56 @@ export interface ScheduleOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Schedule} [result] - The deserialized result object if an error did not occur. - * See {@link Schedule} for more information. + * {SourceControlSyncJobById} [result] - The deserialized result object if an error did not occur. + * See {@link SourceControlSyncJobById} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - update(resourceGroupName: string, automationAccountName: string, scheduleName: string, parameters: models.ScheduleUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - update(resourceGroupName: string, automationAccountName: string, scheduleName: string, parameters: models.ScheduleUpdateParameters, callback: ServiceCallback): void; - update(resourceGroupName: string, automationAccountName: string, scheduleName: string, parameters: models.ScheduleUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, sourceControlName: string, sourceControlSyncJobId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, sourceControlName: string, sourceControlSyncJobId: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, sourceControlName: string, sourceControlSyncJobId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve the schedule identified by schedule name. + * Retrieve a list of source control sync jobs. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} scheduleName The schedule name. + * @param {string} sourceControlName The source control name. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.filter] The filter to apply on the operation. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, scheduleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, sourceControlName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve the schedule identified by schedule name. + * Retrieve a list of source control sync jobs. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} scheduleName The schedule name. + * @param {string} sourceControlName The source control name. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.filter] The filter to apply on the operation. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -8652,7 +9255,7 @@ export interface ScheduleOperations { * * {Promise} A promise is returned. * - * @resolve {Schedule} - The deserialized result object. + * @resolve {SourceControlSyncJobListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -8660,26 +9263,24 @@ export interface ScheduleOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Schedule} [result] - The deserialized result object if an error did not occur. - * See {@link Schedule} for more information. + * {SourceControlSyncJobListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SourceControlSyncJobListResult} 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, automationAccountName: string, scheduleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, automationAccountName: string, scheduleName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, automationAccountName: string, scheduleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, sourceControlName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, sourceControlName: string, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, sourceControlName: string, options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Delete the schedule identified by schedule name. - * - * @param {string} resourceGroupName The resource group name. - * - * @param {string} automationAccountName The automation account name. + * Retrieve a list of source control sync jobs. * - * @param {string} scheduleName The schedule name. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -8688,20 +9289,17 @@ export interface ScheduleOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, scheduleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Delete the schedule identified by schedule name. - * - * @param {string} resourceGroupName The resource group name. + * Retrieve a list of source control sync jobs. * - * @param {string} automationAccountName The automation account name. - * - * @param {string} scheduleName The schedule name. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -8715,7 +9313,7 @@ export interface ScheduleOperations { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {SourceControlSyncJobListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -8723,46 +9321,67 @@ export interface ScheduleOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {SourceControlSyncJobListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SourceControlSyncJobListResult} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - deleteMethod(resourceGroupName: string, automationAccountName: string, scheduleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, automationAccountName: string, scheduleName: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, automationAccountName: string, scheduleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * JobOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface JobOperations { /** - * Retrieve a list of schedules. + * Retrieve the job output identified by job name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The name of the job to be created. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getOutputWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, jobName: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve a list of schedules. + * Retrieve the job output identified by job name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The name of the job to be created. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -8773,7 +9392,7 @@ export interface ScheduleOperations { * * {Promise} A promise is returned. * - * @resolve {ScheduleListResult} - The deserialized result object. + * @resolve {String} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -8781,45 +9400,56 @@ export interface ScheduleOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ScheduleListResult} [result] - The deserialized result object if an error did not occur. - * See {@link ScheduleListResult} for more information. + * {String} [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. */ - listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; - listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + getOutput(resourceGroupName: string, automationAccountName: string, jobName: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + getOutput(resourceGroupName: string, automationAccountName: string, jobName: string, callback: ServiceCallback): void; + getOutput(resourceGroupName: string, automationAccountName: string, jobName: string, options: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve a list of schedules. + * Retrieve the runbook content of the job identified by job name. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getRunbookContentWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, jobName: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve a list of schedules. + * Retrieve the runbook content of the job identified by job name. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -8830,7 +9460,7 @@ export interface ScheduleOperations { * * {Promise} A promise is returned. * - * @resolve {ScheduleListResult} - The deserialized result object. + * @resolve {String} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -8838,86 +9468,56 @@ export interface ScheduleOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ScheduleListResult} [result] - The deserialized result object if an error did not occur. - * See {@link ScheduleListResult} for more information. + * {String} [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. */ - listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; - listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * VariableOperations - * __NOTE__: An instance of this class is automatically created for an - * instance of the AutomationClient. - */ -export interface VariableOperations { + getRunbookContent(resourceGroupName: string, automationAccountName: string, jobName: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + getRunbookContent(resourceGroupName: string, automationAccountName: string, jobName: string, callback: ServiceCallback): void; + getRunbookContent(resourceGroupName: string, automationAccountName: string, jobName: string, options: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Create a variable. - * - * @param {string} resourceGroupName The resource group name. - * - * @param {string} automationAccountName The automation account name. - * - * @param {string} variableName The variable name. + * Suspend the job identified by job name. * - * @param {object} parameters The parameters supplied to the create or update - * variable operation. - * - * @param {string} parameters.name Gets or sets the name of the variable. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} [parameters.value] Gets or sets the value of the variable. - * - * @param {string} [parameters.description] Gets or sets the description of the - * variable. + * @param {string} automationAccountName The name of the automation account. * - * @param {boolean} [parameters.isEncrypted] Gets or sets the encrypted flag of - * the variable. + * @param {string} jobName The job name. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, variableName: string, parameters: models.VariableCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + suspendWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, jobName: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Create a variable. - * - * @param {string} resourceGroupName The resource group name. - * - * @param {string} automationAccountName The automation account name. - * - * @param {string} variableName The variable name. - * - * @param {object} parameters The parameters supplied to the create or update - * variable operation. + * Suspend the job identified by job name. * - * @param {string} parameters.name Gets or sets the name of the variable. - * - * @param {string} [parameters.value] Gets or sets the value of the variable. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} [parameters.description] Gets or sets the description of the - * variable. + * @param {string} automationAccountName The name of the automation account. * - * @param {boolean} [parameters.isEncrypted] Gets or sets the encrypted flag of - * the variable. + * @param {string} jobName The job name. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -8928,7 +9528,7 @@ export interface VariableOperations { * * {Promise} A promise is returned. * - * @resolve {Variable} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -8936,71 +9536,56 @@ export interface VariableOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Variable} [result] - The deserialized result object if an error did not occur. - * See {@link Variable} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - createOrUpdate(resourceGroupName: string, automationAccountName: string, variableName: string, parameters: models.VariableCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, automationAccountName: string, variableName: string, parameters: models.VariableCreateOrUpdateParameters, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, automationAccountName: string, variableName: string, parameters: models.VariableCreateOrUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + suspend(resourceGroupName: string, automationAccountName: string, jobName: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + suspend(resourceGroupName: string, automationAccountName: string, jobName: string, callback: ServiceCallback): void; + suspend(resourceGroupName: string, automationAccountName: string, jobName: string, options: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Update a variable. + * Stop the job identified by jobName. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} variableName The variable name. + * @param {string} jobName The job name. * - * @param {object} parameters The parameters supplied to the update variable - * operation. + * @param {object} [options] Optional Parameters. * - * @param {string} parameters.name Gets or sets the name of the variable. - * - * @param {string} [parameters.value] Gets or sets the value of the variable. - * - * @param {string} [parameters.description] Gets or sets the description of the - * variable. - * - * @param {object} [options] Optional Parameters. + * @param {string} [options.clientRequestId] Identifies this specific client + * request. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - updateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, variableName: string, parameters: models.VariableUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + stopWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, jobName: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Update a variable. - * - * @param {string} resourceGroupName The resource group name. - * - * @param {string} automationAccountName The automation account name. - * - * @param {string} variableName The variable name. - * - * @param {object} parameters The parameters supplied to the update variable - * operation. + * Stop the job identified by jobName. * - * @param {string} parameters.name Gets or sets the name of the variable. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} [parameters.value] Gets or sets the value of the variable. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} [parameters.description] Gets or sets the description of the - * variable. + * @param {string} jobName The job name. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -9011,7 +9596,7 @@ export interface VariableOperations { * * {Promise} A promise is returned. * - * @resolve {Variable} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -9019,51 +9604,56 @@ export interface VariableOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Variable} [result] - The deserialized result object if an error did not occur. - * See {@link Variable} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - update(resourceGroupName: string, automationAccountName: string, variableName: string, parameters: models.VariableUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - update(resourceGroupName: string, automationAccountName: string, variableName: string, parameters: models.VariableUpdateParameters, callback: ServiceCallback): void; - update(resourceGroupName: string, automationAccountName: string, variableName: string, parameters: models.VariableUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + stop(resourceGroupName: string, automationAccountName: string, jobName: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + stop(resourceGroupName: string, automationAccountName: string, jobName: string, callback: ServiceCallback): void; + stop(resourceGroupName: string, automationAccountName: string, jobName: string, options: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Delete the variable. + * Retrieve the job identified by job name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} variableName The name of variable. + * @param {string} jobName The job name. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, variableName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, jobName: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Delete the variable. + * Retrieve the job identified by job name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} variableName The name of variable. + * @param {string} jobName The job name. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -9074,7 +9664,7 @@ export interface VariableOperations { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {Job} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -9082,50 +9672,85 @@ export interface VariableOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {Job} [result] - The deserialized result object if an error did not occur. + * See {@link Job} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - deleteMethod(resourceGroupName: string, automationAccountName: string, variableName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, automationAccountName: string, variableName: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, automationAccountName: string, variableName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, jobName: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, jobName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, jobName: string, options: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve the variable identified by variable name. + * Create a job of the runbook. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} variableName The name of variable. + * @param {string} jobName The job name. + * + * @param {object} parameters The parameters supplied to the create job + * operation. + * + * @param {object} parameters.runbook Gets or sets the runbook. + * + * @param {string} [parameters.runbook.name] Gets or sets the name of the + * runbook. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * job. + * + * @param {string} [parameters.runOn] Gets or sets the runOn which specifies + * the group name where the job is to be executed. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, variableName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, jobName: string, parameters: models.JobCreateParameters, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve the variable identified by variable name. + * Create a job of the runbook. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} variableName The name of variable. + * @param {string} jobName The job name. + * + * @param {object} parameters The parameters supplied to the create job + * operation. + * + * @param {object} parameters.runbook Gets or sets the runbook. + * + * @param {string} [parameters.runbook.name] Gets or sets the name of the + * runbook. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * job. + * + * @param {string} [parameters.runOn] Gets or sets the runOn which specifies + * the group name where the job is to be executed. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -9136,7 +9761,7 @@ export interface VariableOperations { * * {Promise} A promise is returned. * - * @resolve {Variable} - The deserialized result object. + * @resolve {Job} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -9144,47 +9769,57 @@ export interface VariableOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Variable} [result] - The deserialized result object if an error did not occur. - * See {@link Variable} for more information. + * {Job} [result] - The deserialized result object if an error did not occur. + * See {@link Job} 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, automationAccountName: string, variableName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, automationAccountName: string, variableName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, automationAccountName: string, variableName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + create(resourceGroupName: string, automationAccountName: string, jobName: string, parameters: models.JobCreateParameters, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, automationAccountName: string, jobName: string, parameters: models.JobCreateParameters, callback: ServiceCallback): void; + create(resourceGroupName: string, automationAccountName: string, jobName: string, parameters: models.JobCreateParameters, options: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve a list of variables. + * Retrieve a list of jobs. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { filter? : string, clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve a list of variables. + * Retrieve a list of jobs. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -9195,7 +9830,7 @@ export interface VariableOperations { * * {Promise} A promise is returned. * - * @resolve {VariableListResult} - The deserialized result object. + * @resolve {JobListResultV2} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -9203,45 +9838,57 @@ export interface VariableOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {VariableListResult} [result] - The deserialized result object if an error did not occur. - * See {@link VariableListResult} for more information. + * {JobListResultV2} [result] - The deserialized result object if an error did not occur. + * See {@link JobListResultV2} 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. */ - listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; - listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { filter? : string, clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { filter? : string, clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve a list of variables. + * Resume the job identified by jobName. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + resumeWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, jobName: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve a list of variables. + * Resume the job identified by jobName. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} jobName The job name. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -9252,7 +9899,7 @@ export interface VariableOperations { * * {Promise} A promise is returned. * - * @resolve {VariableListResult} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -9260,56 +9907,50 @@ export interface VariableOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {VariableListResult} [result] - The deserialized result object if an error did not occur. - * See {@link VariableListResult} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; - listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * WebhookOperations - * __NOTE__: An instance of this class is automatically created for an - * instance of the AutomationClient. - */ -export interface WebhookOperations { + resume(resourceGroupName: string, automationAccountName: string, jobName: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + resume(resourceGroupName: string, automationAccountName: string, jobName: string, callback: ServiceCallback): void; + resume(resourceGroupName: string, automationAccountName: string, jobName: string, options: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Generates a Uri for use in creating a webhook. - * - * @param {string} resourceGroupName The resource group name. + * Retrieve a list of jobs. * - * @param {string} automationAccountName The automation account name. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - generateUriWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Generates a Uri for use in creating a webhook. - * - * @param {string} resourceGroupName The resource group name. + * Retrieve a list of jobs. * - * @param {string} automationAccountName The automation account name. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -9320,7 +9961,7 @@ export interface WebhookOperations { * * {Promise} A promise is returned. * - * @resolve {String} - The deserialized result object. + * @resolve {JobListResultV2} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -9328,50 +9969,70 @@ export interface WebhookOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {String} [result] - The deserialized result object if an error did not occur. + * {JobListResultV2} [result] - The deserialized result object if an error did not occur. + * See {@link JobListResultV2} 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. */ - generateUri(resourceGroupName: string, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - generateUri(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; - generateUri(resourceGroupName: string, automationAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * JobStreamOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface JobStreamOperations { /** - * Delete the webhook by name. + * Retrieve the job stream identified by job stream id. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} webhookName The webhook name. + * @param {string} jobName The job name. + * + * @param {string} jobStreamId The job stream id. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, webhookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, jobName: string, jobStreamId: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Delete the webhook by name. + * Retrieve the job stream identified by job stream id. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} webhookName The webhook name. + * @param {string} jobName The job name. + * + * @param {string} jobStreamId The job stream id. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -9382,7 +10043,7 @@ export interface WebhookOperations { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {JobStream} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -9390,50 +10051,61 @@ export interface WebhookOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {JobStream} [result] - The deserialized result object if an error did not occur. + * See {@link JobStream} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - deleteMethod(resourceGroupName: string, automationAccountName: string, webhookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, automationAccountName: string, webhookName: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, automationAccountName: string, webhookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, jobName: string, jobStreamId: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, jobName: string, jobStreamId: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, jobName: string, jobStreamId: string, options: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve the webhook identified by webhook name. + * Retrieve a list of jobs streams identified by job name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} webhookName The webhook name. + * @param {string} jobName The job name. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, webhookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByJobWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, jobName: string, options?: { filter? : string, clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve the webhook identified by webhook name. + * Retrieve a list of jobs streams identified by job name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} webhookName The webhook name. + * @param {string} jobName The job name. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -9444,7 +10116,7 @@ export interface WebhookOperations { * * {Promise} A promise is returned. * - * @resolve {Webhook} - The deserialized result object. + * @resolve {JobStreamListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -9452,48 +10124,1578 @@ export interface WebhookOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Webhook} [result] - The deserialized result object if an error did not occur. - * See {@link Webhook} for more information. + * {JobStreamListResult} [result] - The deserialized result object if an error did not occur. + * See {@link JobStreamListResult} 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, automationAccountName: string, webhookName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, automationAccountName: string, webhookName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, automationAccountName: string, webhookName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByJob(resourceGroupName: string, automationAccountName: string, jobName: string, options?: { filter? : string, clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByJob(resourceGroupName: string, automationAccountName: string, jobName: string, callback: ServiceCallback): void; + listByJob(resourceGroupName: string, automationAccountName: string, jobName: string, options: { filter? : string, clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Create the webhook identified by webhook name. + * Retrieve a list of jobs streams identified by job name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * - * @param {string} automationAccountName The automation account name. + * @param {object} [options] Optional Parameters. * - * @param {string} webhookName The webhook name. + * @param {string} [options.clientRequestId] Identifies this specific client + * request. * - * @param {object} parameters The create or update parameters for webhook. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {string} parameters.name Gets or sets the name of the webhook. + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByJobNextWithHttpOperationResponse(nextPageLink: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of jobs streams identified by job name. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 {JobStreamListResult} - 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. + * + * {JobStreamListResult} [result] - The deserialized result object if an error did not occur. + * See {@link JobStreamListResult} 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. + */ + listByJobNext(nextPageLink: string, options?: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByJobNext(nextPageLink: string, callback: ServiceCallback): void; + listByJobNext(nextPageLink: string, options: { clientRequestId? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * AgentRegistrationInformation + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface AgentRegistrationInformation { + + + /** + * Retrieve the automation agent registration information. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @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, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the automation agent registration information. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @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 {AgentRegistration} - 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. + * + * {AgentRegistration} [result] - The deserialized result object if an error did not occur. + * See {@link AgentRegistration} 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, automationAccountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Regenerate a primary or secondary agent registration key + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} parameters The name of the agent registration key to be + * regenerated + * + * @param {string} parameters.keyName Gets or sets the agent registration key + * name - primary or secondary. Possible values include: 'primary', 'secondary' + * + * @param {string} [parameters.name] Gets or sets the name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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. + */ + regenerateKeyWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, parameters: models.AgentRegistrationRegenerateKeyParameter, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Regenerate a primary or secondary agent registration key + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} parameters The name of the agent registration key to be + * regenerated + * + * @param {string} parameters.keyName Gets or sets the agent registration key + * name - primary or secondary. Possible values include: 'primary', 'secondary' + * + * @param {string} [parameters.name] Gets or sets the name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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 {AgentRegistration} - 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. + * + * {AgentRegistration} [result] - The deserialized result object if an error did not occur. + * See {@link AgentRegistration} 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. + */ + regenerateKey(resourceGroupName: string, automationAccountName: string, parameters: models.AgentRegistrationRegenerateKeyParameter, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + regenerateKey(resourceGroupName: string, automationAccountName: string, parameters: models.AgentRegistrationRegenerateKeyParameter, callback: ServiceCallback): void; + regenerateKey(resourceGroupName: string, automationAccountName: string, parameters: models.AgentRegistrationRegenerateKeyParameter, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * DscNodeOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface DscNodeOperations { + + + /** + * Delete the dsc node identified by node id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId The node id. + * + * @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, automationAccountName: string, nodeId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete the dsc node identified by node id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId The node id. + * + * @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 {DscNode} - 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. + * + * {DscNode} [result] - The deserialized result object if an error did not occur. + * See {@link DscNode} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, automationAccountName: string, nodeId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, automationAccountName: string, nodeId: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, automationAccountName: string, nodeId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve the dsc node identified by node id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId The node id. + * + * @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, automationAccountName: string, nodeId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the dsc node identified by node id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId The node id. + * + * @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 {DscNode} - 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. + * + * {DscNode} [result] - The deserialized result object if an error did not occur. + * See {@link DscNode} 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, automationAccountName: string, nodeId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, nodeId: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, nodeId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Update the dsc node. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId Parameters supplied to the update dsc node. + * + * @param {object} dscNodeUpdateParameters Parameters supplied to the update + * dsc node. + * + * @param {string} [dscNodeUpdateParameters.nodeId] Gets or sets the id of the + * dsc node. + * + * @param {object} [dscNodeUpdateParameters.nodeConfiguration] Gets or sets the + * configuration of the node. + * + * @param {string} [dscNodeUpdateParameters.nodeConfiguration.name] Gets or + * sets the name of the dsc nodeconfiguration. + * + * @param {object} [dscNodeUpdateParameters.properties] + * + * @param {string} [dscNodeUpdateParameters.properties.name] Gets or sets the + * name of the dsc nodeconfiguration. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, nodeId: string, dscNodeUpdateParameters: models.DscNodeUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Update the dsc node. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId Parameters supplied to the update dsc node. + * + * @param {object} dscNodeUpdateParameters Parameters supplied to the update + * dsc node. + * + * @param {string} [dscNodeUpdateParameters.nodeId] Gets or sets the id of the + * dsc node. + * + * @param {object} [dscNodeUpdateParameters.nodeConfiguration] Gets or sets the + * configuration of the node. + * + * @param {string} [dscNodeUpdateParameters.nodeConfiguration.name] Gets or + * sets the name of the dsc nodeconfiguration. + * + * @param {object} [dscNodeUpdateParameters.properties] + * + * @param {string} [dscNodeUpdateParameters.properties.name] Gets or sets the + * name of the dsc nodeconfiguration. + * + * @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 {DscNode} - 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. + * + * {DscNode} [result] - The deserialized result object if an error did not occur. + * See {@link DscNode} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, automationAccountName: string, nodeId: string, dscNodeUpdateParameters: models.DscNodeUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, automationAccountName: string, nodeId: string, dscNodeUpdateParameters: models.DscNodeUpdateParameters, callback: ServiceCallback): void; + update(resourceGroupName: string, automationAccountName: string, nodeId: string, dscNodeUpdateParameters: models.DscNodeUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of dsc nodes. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of dsc nodes. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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 {DscNodeListResult} - 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. + * + * {DscNodeListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DscNodeListResult} 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. + */ + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of dsc nodes. + * + * @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. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of dsc nodes. + * + * @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 {DscNodeListResult} - 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. + * + * {DscNodeListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DscNodeListResult} 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. + */ + listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * NodeReports + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface NodeReports { + + + /** + * Retrieve the Dsc node report list by node id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId The parameters supplied to the list operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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. + */ + listByNodeWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, nodeId: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the Dsc node report list by node id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId The parameters supplied to the list operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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 {DscNodeReportListResult} - 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. + * + * {DscNodeReportListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DscNodeReportListResult} 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. + */ + listByNode(resourceGroupName: string, automationAccountName: string, nodeId: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByNode(resourceGroupName: string, automationAccountName: string, nodeId: string, callback: ServiceCallback): void; + listByNode(resourceGroupName: string, automationAccountName: string, nodeId: string, options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve the Dsc node report data by node id and report id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId The Dsc node id. + * + * @param {string} reportId The report id. + * + * @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, automationAccountName: string, nodeId: string, reportId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the Dsc node report data by node id and report id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId The Dsc node id. + * + * @param {string} reportId The report id. + * + * @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 {DscNodeReport} - 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. + * + * {DscNodeReport} [result] - The deserialized result object if an error did not occur. + * See {@link DscNodeReport} 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, automationAccountName: string, nodeId: string, reportId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, nodeId: string, reportId: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, nodeId: string, reportId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve the Dsc node reports by node id and report id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId The Dsc node id. + * + * @param {string} reportId The report id. + * + * @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. + */ + getContentWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, nodeId: string, reportId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the Dsc node reports by node id and report id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeId The Dsc node id. + * + * @param {string} reportId The report id. + * + * @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 {Object} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Object} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + getContent(resourceGroupName: string, automationAccountName: string, nodeId: string, reportId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getContent(resourceGroupName: string, automationAccountName: string, nodeId: string, reportId: string, callback: ServiceCallback): void; + getContent(resourceGroupName: string, automationAccountName: string, nodeId: string, reportId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve the Dsc node report list by node id. + * + * @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. + */ + listByNodeNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the Dsc node report list by node id. + * + * @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 {DscNodeReportListResult} - 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. + * + * {DscNodeReportListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DscNodeReportListResult} 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. + */ + listByNodeNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByNodeNext(nextPageLink: string, callback: ServiceCallback): void; + listByNodeNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * DscCompilationJobOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface DscCompilationJobOperations { + + + /** + * Creates the Dsc compilation job of the configuration. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} compilationJobName The the DSC configuration Id. + * + * @param {object} parameters The parameters supplied to the create compilation + * job operation. + * + * @param {object} parameters.configuration Gets or sets the configuration. + * + * @param {string} [parameters.configuration.name] Gets or sets the name of the + * Dsc configuration. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * job. + * + * @param {boolean} [parameters.newNodeConfigurationBuildVersionRequired] If a + * new build version of NodeConfiguration is required. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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, automationAccountName: string, compilationJobName: string, parameters: models.DscCompilationJobCreateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates the Dsc compilation job of the configuration. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} compilationJobName The the DSC configuration Id. + * + * @param {object} parameters The parameters supplied to the create compilation + * job operation. + * + * @param {object} parameters.configuration Gets or sets the configuration. + * + * @param {string} [parameters.configuration.name] Gets or sets the name of the + * Dsc configuration. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * job. + * + * @param {boolean} [parameters.newNodeConfigurationBuildVersionRequired] If a + * new build version of NodeConfiguration is required. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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 {DscCompilationJob} - 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. + * + * {DscCompilationJob} [result] - The deserialized result object if an error did not occur. + * See {@link DscCompilationJob} 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, automationAccountName: string, compilationJobName: string, parameters: models.DscCompilationJobCreateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, automationAccountName: string, compilationJobName: string, parameters: models.DscCompilationJobCreateParameters, callback: ServiceCallback): void; + create(resourceGroupName: string, automationAccountName: string, compilationJobName: string, parameters: models.DscCompilationJobCreateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve the Dsc configuration compilation job identified by job id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} compilationJobName The the DSC configuration Id. + * + * @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, automationAccountName: string, compilationJobName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the Dsc configuration compilation job identified by job id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} compilationJobName The the DSC configuration Id. + * + * @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 {DscCompilationJob} - 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. + * + * {DscCompilationJob} [result] - The deserialized result object if an error did not occur. + * See {@link DscCompilationJob} 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, automationAccountName: string, compilationJobName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, compilationJobName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, compilationJobName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of dsc compilation jobs. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of dsc compilation jobs. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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 {DscCompilationJobListResult} - 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. + * + * {DscCompilationJobListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DscCompilationJobListResult} 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. + */ + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve the job stream identified by job stream id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {uuid} jobId The job id. + * + * @param {string} jobStreamId The job stream id. + * + * @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. + */ + getStreamWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, jobId: string, jobStreamId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the job stream identified by job stream id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {uuid} jobId The job id. + * + * @param {string} jobStreamId The job stream id. + * + * @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 {JobStream} - 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. + * + * {JobStream} [result] - The deserialized result object if an error did not occur. + * See {@link JobStream} 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. + */ + getStream(resourceGroupName: string, automationAccountName: string, jobId: string, jobStreamId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getStream(resourceGroupName: string, automationAccountName: string, jobId: string, jobStreamId: string, callback: ServiceCallback): void; + getStream(resourceGroupName: string, automationAccountName: string, jobId: string, jobStreamId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates the Dsc compilation job of the configuration. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} compilationJobName The the DSC configuration Id. + * + * @param {object} parameters The parameters supplied to the create compilation + * job operation. + * + * @param {object} parameters.configuration Gets or sets the configuration. + * + * @param {string} [parameters.configuration.name] Gets or sets the name of the + * Dsc configuration. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * job. + * + * @param {boolean} [parameters.newNodeConfigurationBuildVersionRequired] If a + * new build version of NodeConfiguration is required. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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. + */ + beginCreateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, compilationJobName: string, parameters: models.DscCompilationJobCreateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates the Dsc compilation job of the configuration. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} compilationJobName The the DSC configuration Id. + * + * @param {object} parameters The parameters supplied to the create compilation + * job operation. + * + * @param {object} parameters.configuration Gets or sets the configuration. + * + * @param {string} [parameters.configuration.name] Gets or sets the name of the + * Dsc configuration. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * job. + * + * @param {boolean} [parameters.newNodeConfigurationBuildVersionRequired] If a + * new build version of NodeConfiguration is required. + * + * @param {string} [parameters.name] Gets or sets name of the resource. + * + * @param {string} [parameters.location] Gets or sets the location of the + * resource. + * + * @param {object} [parameters.tags] Gets or sets the tags attached to the + * resource. + * + * @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 {DscCompilationJob} - 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. + * + * {DscCompilationJob} [result] - The deserialized result object if an error did not occur. + * See {@link DscCompilationJob} 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. + */ + beginCreate(resourceGroupName: string, automationAccountName: string, compilationJobName: string, parameters: models.DscCompilationJobCreateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreate(resourceGroupName: string, automationAccountName: string, compilationJobName: string, parameters: models.DscCompilationJobCreateParameters, callback: ServiceCallback): void; + beginCreate(resourceGroupName: string, automationAccountName: string, compilationJobName: string, parameters: models.DscCompilationJobCreateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of dsc compilation jobs. + * + * @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. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of dsc compilation jobs. + * + * @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 {DscCompilationJobListResult} - 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. + * + * {DscCompilationJobListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DscCompilationJobListResult} 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. + */ + listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * DscCompilationJobStream + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface DscCompilationJobStream { + + + /** + * Retrieve all the job streams for the compilation Job. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {uuid} jobId The job id. + * + * @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. + */ + listByJobWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, jobId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve all the job streams for the compilation Job. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {uuid} jobId The job id. + * + * @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 {JobStreamListResult} - 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. + * + * {JobStreamListResult} [result] - The deserialized result object if an error did not occur. + * See {@link JobStreamListResult} 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. + */ + listByJob(resourceGroupName: string, automationAccountName: string, jobId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByJob(resourceGroupName: string, automationAccountName: string, jobId: string, callback: ServiceCallback): void; + listByJob(resourceGroupName: string, automationAccountName: string, jobId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * DscNodeConfigurationOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface DscNodeConfigurationOperations { + + + /** + * Delete the Dsc node configurations by node configuration. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeConfigurationName The Dsc node configuration 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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, nodeConfigurationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete the Dsc node configurations by node configuration. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeConfigurationName The Dsc node configuration 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 {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, automationAccountName: string, nodeConfigurationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, automationAccountName: string, nodeConfigurationName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, automationAccountName: string, nodeConfigurationName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve the Dsc node configurations by node configuration. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeConfigurationName The Dsc node configuration 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. + */ + getWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, nodeConfigurationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the Dsc node configurations by node configuration. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeConfigurationName The Dsc node configuration 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 {DscNodeConfiguration} - 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. + * + * {DscNodeConfiguration} [result] - The deserialized result object if an error did not occur. + * See {@link DscNodeConfiguration} 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, automationAccountName: string, nodeConfigurationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, nodeConfigurationName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, nodeConfigurationName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create the node configuration identified by node configuration name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} nodeConfigurationName The Dsc node configuration name. + * + * @param {object} parameters The create or update parameters for + * configuration. + * + * @param {object} parameters.source Gets or sets the source. + * + * @param {object} [parameters.source.hash] Gets or sets the hash. + * + * @param {string} parameters.source.hash.algorithm Gets or sets the content + * hash algorithm used to hash the content. * - * @param {boolean} [parameters.isEnabled] Gets or sets the value of the - * enabled flag of webhook. + * @param {string} parameters.source.hash.value Gets or sets expected hash + * value of the content. * - * @param {string} [parameters.uri] Gets or sets the uri. + * @param {string} [parameters.source.type] Gets or sets the content source + * type. Possible values include: 'embeddedContent', 'uri' * - * @param {date} [parameters.expiryTime] Gets or sets the expiry time. + * @param {string} [parameters.source.value] Gets or sets the value of the + * content. This is based on the content source type. * - * @param {object} [parameters.parameters] Gets or sets the parameters of the - * job. + * @param {string} [parameters.source.version] Gets or sets the version of the + * content. * - * @param {object} [parameters.runbook] Gets or sets the runbook. + * @param {string} parameters.name Gets or sets the type of the parameter. * - * @param {string} [parameters.runbook.name] Gets or sets the name of the - * runbook. + * @param {object} parameters.configuration Gets or sets the configuration of + * the node. * - * @param {string} [parameters.runOn] Gets or sets the name of the hybrid - * worker group the webhook job will run on. + * @param {string} [parameters.configuration.name] Gets or sets the name of the + * Dsc configuration. + * + * @param {boolean} [parameters.incrementNodeConfigurationBuild] If a new build + * version of NodeConfiguration is required. * * @param {object} [options] Optional Parameters. * @@ -9502,42 +11704,53 @@ export interface WebhookOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, webhookName: string, parameters: models.WebhookCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, nodeConfigurationName: string, parameters: models.DscNodeConfigurationCreateOrUpdateParametersProperties, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Create the webhook identified by webhook name. + * Create the node configuration identified by node configuration name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} webhookName The webhook name. + * @param {string} nodeConfigurationName The Dsc node configuration name. * - * @param {object} parameters The create or update parameters for webhook. + * @param {object} parameters The create or update parameters for + * configuration. * - * @param {string} parameters.name Gets or sets the name of the webhook. + * @param {object} parameters.source Gets or sets the source. * - * @param {boolean} [parameters.isEnabled] Gets or sets the value of the - * enabled flag of webhook. + * @param {object} [parameters.source.hash] Gets or sets the hash. * - * @param {string} [parameters.uri] Gets or sets the uri. + * @param {string} parameters.source.hash.algorithm Gets or sets the content + * hash algorithm used to hash the content. * - * @param {date} [parameters.expiryTime] Gets or sets the expiry time. + * @param {string} parameters.source.hash.value Gets or sets expected hash + * value of the content. * - * @param {object} [parameters.parameters] Gets or sets the parameters of the - * job. + * @param {string} [parameters.source.type] Gets or sets the content source + * type. Possible values include: 'embeddedContent', 'uri' * - * @param {object} [parameters.runbook] Gets or sets the runbook. + * @param {string} [parameters.source.value] Gets or sets the value of the + * content. This is based on the content source type. * - * @param {string} [parameters.runbook.name] Gets or sets the name of the - * runbook. + * @param {string} [parameters.source.version] Gets or sets the version of the + * content. * - * @param {string} [parameters.runOn] Gets or sets the name of the hybrid - * worker group the webhook job will run on. + * @param {string} parameters.name Gets or sets the type of the parameter. + * + * @param {object} parameters.configuration Gets or sets the configuration of + * the node. + * + * @param {string} [parameters.configuration.name] Gets or sets the name of the + * Dsc configuration. + * + * @param {boolean} [parameters.incrementNodeConfigurationBuild] If a new build + * version of NodeConfiguration is required. * * @param {object} [options] Optional Parameters. * @@ -9551,7 +11764,7 @@ export interface WebhookOperations { * * {Promise} A promise is returned. * - * @resolve {Webhook} - The deserialized result object. + * @resolve {DscNodeConfiguration} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -9559,83 +11772,51 @@ export interface WebhookOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Webhook} [result] - The deserialized result object if an error did not occur. - * See {@link Webhook} for more information. + * {DscNodeConfiguration} [result] - The deserialized result object if an error did not occur. + * See {@link DscNodeConfiguration} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - createOrUpdate(resourceGroupName: string, automationAccountName: string, webhookName: string, parameters: models.WebhookCreateOrUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, automationAccountName: string, webhookName: string, parameters: models.WebhookCreateOrUpdateParameters, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, automationAccountName: string, webhookName: string, parameters: models.WebhookCreateOrUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, automationAccountName: string, nodeConfigurationName: string, parameters: models.DscNodeConfigurationCreateOrUpdateParametersProperties, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, automationAccountName: string, nodeConfigurationName: string, parameters: models.DscNodeConfigurationCreateOrUpdateParametersProperties, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, automationAccountName: string, nodeConfigurationName: string, parameters: models.DscNodeConfigurationCreateOrUpdateParametersProperties, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Update the webhook identified by webhook name. - * - * @param {string} resourceGroupName The resource group name. - * - * @param {string} automationAccountName The automation account name. - * - * @param {string} webhookName The webhook name. - * - * @param {object} parameters The update parameters for webhook. - * - * @param {string} parameters.name Gets or sets the name of the webhook. - * - * @param {boolean} [parameters.isEnabled] Gets or sets the value of the - * enabled flag of webhook. - * - * @param {string} [parameters.runOn] Gets or sets the name of the hybrid - * worker group the webhook job will run on. + * Retrieve a list of dsc node configurations. * - * @param {object} [parameters.parameters] Gets or sets the parameters of the - * job. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} [parameters.description] Gets or sets the description of the - * webhook. + * @param {string} automationAccountName The name of the automation account. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.filter] The filter to apply on the operation. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - updateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, webhookName: string, parameters: models.WebhookUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Update the webhook identified by webhook name. - * - * @param {string} resourceGroupName The resource group name. - * - * @param {string} automationAccountName The automation account name. - * - * @param {string} webhookName The webhook name. - * - * @param {object} parameters The update parameters for webhook. - * - * @param {string} parameters.name Gets or sets the name of the webhook. - * - * @param {boolean} [parameters.isEnabled] Gets or sets the value of the - * enabled flag of webhook. - * - * @param {string} [parameters.runOn] Gets or sets the name of the hybrid - * worker group the webhook job will run on. + * Retrieve a list of dsc node configurations. * - * @param {object} [parameters.parameters] Gets or sets the parameters of the - * job. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} [parameters.description] Gets or sets the description of the - * webhook. + * @param {string} automationAccountName The name of the automation account. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.filter] The filter to apply on the operation. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -9646,7 +11827,7 @@ export interface WebhookOperations { * * {Promise} A promise is returned. * - * @resolve {Webhook} - The deserialized result object. + * @resolve {DscNodeConfigurationListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -9654,50 +11835,117 @@ export interface WebhookOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Webhook} [result] - The deserialized result object if an error did not occur. - * See {@link Webhook} for more information. + * {DscNodeConfigurationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DscNodeConfigurationListResult} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - update(resourceGroupName: string, automationAccountName: string, webhookName: string, parameters: models.WebhookUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - update(resourceGroupName: string, automationAccountName: string, webhookName: string, parameters: models.WebhookUpdateParameters, callback: ServiceCallback): void; - update(resourceGroupName: string, automationAccountName: string, webhookName: string, parameters: models.WebhookUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; + listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve a list of webhooks. + * Create the node configuration identified by node configuration name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {object} [options] Optional Parameters. + * @param {string} nodeConfigurationName The Dsc node configuration name. * - * @param {string} [options.filter] The filter to apply on the operation. + * @param {object} parameters The create or update parameters for + * configuration. + * + * @param {object} parameters.source Gets or sets the source. + * + * @param {object} [parameters.source.hash] Gets or sets the hash. + * + * @param {string} parameters.source.hash.algorithm Gets or sets the content + * hash algorithm used to hash the content. + * + * @param {string} parameters.source.hash.value Gets or sets expected hash + * value of the content. + * + * @param {string} [parameters.source.type] Gets or sets the content source + * type. Possible values include: 'embeddedContent', 'uri' + * + * @param {string} [parameters.source.value] Gets or sets the value of the + * content. This is based on the content source type. + * + * @param {string} [parameters.source.version] Gets or sets the version of the + * content. + * + * @param {string} parameters.name Gets or sets the type of the parameter. + * + * @param {object} parameters.configuration Gets or sets the configuration of + * the node. + * + * @param {string} [parameters.configuration.name] Gets or sets the name of the + * Dsc configuration. + * + * @param {boolean} [parameters.incrementNodeConfigurationBuild] If a new build + * version of NodeConfiguration is required. + * + * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByAutomationAccountWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, nodeConfigurationName: string, parameters: models.DscNodeConfigurationCreateOrUpdateParametersProperties, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve a list of webhooks. + * Create the node configuration identified by node configuration name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {object} [options] Optional Parameters. + * @param {string} nodeConfigurationName The Dsc node configuration name. * - * @param {string} [options.filter] The filter to apply on the operation. + * @param {object} parameters The create or update parameters for + * configuration. + * + * @param {object} parameters.source Gets or sets the source. + * + * @param {object} [parameters.source.hash] Gets or sets the hash. + * + * @param {string} parameters.source.hash.algorithm Gets or sets the content + * hash algorithm used to hash the content. + * + * @param {string} parameters.source.hash.value Gets or sets expected hash + * value of the content. + * + * @param {string} [parameters.source.type] Gets or sets the content source + * type. Possible values include: 'embeddedContent', 'uri' + * + * @param {string} [parameters.source.value] Gets or sets the value of the + * content. This is based on the content source type. + * + * @param {string} [parameters.source.version] Gets or sets the version of the + * content. + * + * @param {string} parameters.name Gets or sets the type of the parameter. + * + * @param {object} parameters.configuration Gets or sets the configuration of + * the node. + * + * @param {string} [parameters.configuration.name] Gets or sets the name of the + * Dsc configuration. + * + * @param {boolean} [parameters.incrementNodeConfigurationBuild] If a new build + * version of NodeConfiguration is required. + * + * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -9709,7 +11957,7 @@ export interface WebhookOperations { * * {Promise} A promise is returned. * - * @resolve {WebhookListResult} - The deserialized result object. + * @resolve {DscNodeConfiguration} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -9717,20 +11965,20 @@ export interface WebhookOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {WebhookListResult} [result] - The deserialized result object if an error did not occur. - * See {@link WebhookListResult} for more information. + * {DscNodeConfiguration} [result] - The deserialized result object if an error did not occur. + * See {@link DscNodeConfiguration} 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. */ - listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; - listByAutomationAccount(resourceGroupName: string, automationAccountName: string, callback: ServiceCallback): void; - listByAutomationAccount(resourceGroupName: string, automationAccountName: string, options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, automationAccountName: string, nodeConfigurationName: string, parameters: models.DscNodeConfigurationCreateOrUpdateParametersProperties, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, automationAccountName: string, nodeConfigurationName: string, parameters: models.DscNodeConfigurationCreateOrUpdateParametersProperties, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, automationAccountName: string, nodeConfigurationName: string, parameters: models.DscNodeConfigurationCreateOrUpdateParametersProperties, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Retrieve a list of webhooks. + * Retrieve a list of dsc node configurations. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -9742,14 +11990,14 @@ export interface WebhookOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Retrieve a list of webhooks. + * Retrieve a list of dsc node configurations. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -9766,7 +12014,7 @@ export interface WebhookOperations { * * {Promise} A promise is returned. * - * @resolve {WebhookListResult} - The deserialized result object. + * @resolve {DscNodeConfigurationListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -9774,14 +12022,15 @@ export interface WebhookOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {WebhookListResult} [result] - The deserialized result object if an error did not occur. - * See {@link WebhookListResult} for more information. + * {DscNodeConfigurationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DscNodeConfigurationListResult} 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. */ - listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; - listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; + listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } diff --git a/lib/services/automationManagement/lib/operations/index.js b/lib/services/automationManagement/lib/operations/index.js index b644c547af..63aeffd32f 100644 --- a/lib/services/automationManagement/lib/operations/index.js +++ b/lib/services/automationManagement/lib/operations/index.js @@ -18,20 +18,15 @@ exports.AutomationAccountOperations = require('./automationAccountOperations'); exports.Operations = require('./operations'); exports.StatisticsOperations = require('./statisticsOperations'); exports.Usages = require('./usages'); +exports.Keys = require('./keys'); exports.CertificateOperations = require('./certificateOperations'); exports.ConnectionOperations = require('./connectionOperations'); exports.ConnectionTypeOperations = require('./connectionTypeOperations'); exports.CredentialOperations = require('./credentialOperations'); -exports.DscCompilationJobOperations = require('./dscCompilationJobOperations'); exports.DscConfigurationOperations = require('./dscConfigurationOperations'); -exports.AgentRegistrationInformation = require('./agentRegistrationInformation'); -exports.DscNodeOperations = require('./dscNodeOperations'); -exports.NodeReports = require('./nodeReports'); -exports.DscNodeConfigurationOperations = require('./dscNodeConfigurationOperations'); exports.HybridRunbookWorkerGroupOperations = require('./hybridRunbookWorkerGroupOperations'); -exports.JobOperations = require('./jobOperations'); -exports.JobStreamOperations = require('./jobStreamOperations'); exports.JobScheduleOperations = require('./jobScheduleOperations'); +exports.LinkedWorkspaceOperations = require('./linkedWorkspaceOperations'); exports.ActivityOperations = require('./activityOperations'); exports.ModuleOperations = require('./moduleOperations'); exports.ObjectDataTypes = require('./objectDataTypes'); @@ -39,7 +34,20 @@ exports.Fields = require('./fields'); exports.RunbookDraftOperations = require('./runbookDraftOperations'); exports.RunbookOperations = require('./runbookOperations'); exports.TestJobStreams = require('./testJobStreams'); -exports.TestJobs = require('./testJobs'); +exports.TestJobOperations = require('./testJobOperations'); exports.ScheduleOperations = require('./scheduleOperations'); exports.VariableOperations = require('./variableOperations'); exports.WebhookOperations = require('./webhookOperations'); +exports.SoftwareUpdateConfigurations = require('./softwareUpdateConfigurations'); +exports.SoftwareUpdateConfigurationRuns = require('./softwareUpdateConfigurationRuns'); +exports.SoftwareUpdateConfigurationMachineRuns = require('./softwareUpdateConfigurationMachineRuns'); +exports.SourceControlOperations = require('./sourceControlOperations'); +exports.SourceControlSyncJobOperations = require('./sourceControlSyncJobOperations'); +exports.JobOperations = require('./jobOperations'); +exports.JobStreamOperations = require('./jobStreamOperations'); +exports.AgentRegistrationInformation = require('./agentRegistrationInformation'); +exports.DscNodeOperations = require('./dscNodeOperations'); +exports.NodeReports = require('./nodeReports'); +exports.DscCompilationJobOperations = require('./dscCompilationJobOperations'); +exports.DscCompilationJobStream = require('./dscCompilationJobStream'); +exports.DscNodeConfigurationOperations = require('./dscNodeConfigurationOperations'); diff --git a/lib/services/automationManagement/lib/operations/jobOperations.js b/lib/services/automationManagement/lib/operations/jobOperations.js index adea536863..df4b700f0b 100644 --- a/lib/services/automationManagement/lib/operations/jobOperations.js +++ b/lib/services/automationManagement/lib/operations/jobOperations.js @@ -15,16 +15,19 @@ const msRestAzure = require('ms-rest-azure'); const WebResource = msRest.WebResource; /** - * Retrieve the job output identified by job id. + * Retrieve the job output identified by job name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} jobId The job id. + * @param {string} jobName The name of the job to be created. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -34,13 +37,13 @@ const WebResource = msRest.WebResource; * * {Error} err - The Error object if an error occurred, null otherwise. * - * {object} [result] - The deserialized result object if an error did not occur. + * {string} [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 _getOutput(resourceGroupName, automationAccountName, jobId, options, callback) { +function _getOutput(resourceGroupName, automationAccountName, jobName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -50,12 +53,25 @@ function _getOutput(resourceGroupName, automationAccountName, jobId, options, ca if (!callback) { throw new Error('callback cannot be null.'); } + let clientRequestId = (options && options.clientRequestId !== undefined) ? options.clientRequestId : undefined; + let apiVersion = '2017-05-15-preview'; // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -64,14 +80,11 @@ function _getOutput(resourceGroupName, automationAccountName, jobId, options, ca if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); } - if (jobId === null || jobId === undefined || typeof jobId.valueOf() !== 'string') { - throw new Error('jobId cannot be null or undefined and it must be of type string.'); - } - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + if (jobName === null || jobName === undefined || typeof jobName.valueOf() !== 'string') { + throw new Error('jobName cannot be null or undefined and it must be of type string.'); } - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + if (clientRequestId !== null && clientRequestId !== undefined && typeof clientRequestId.valueOf() !== 'string') { + throw new Error('clientRequestId 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.'); @@ -82,13 +95,13 @@ function _getOutput(resourceGroupName, automationAccountName, jobId, options, ca // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobId}/output'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/output'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); - requestUrl = requestUrl.replace('{jobId}', encodeURIComponent(jobId)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{jobName}', encodeURIComponent(jobName)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -103,6 +116,9 @@ function _getOutput(resourceGroupName, automationAccountName, jobId, options, ca if (this.client.generateClientRequestId) { httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); } + if (clientRequestId !== undefined && clientRequestId !== null) { + httpRequest.headers['clientRequestId'] = clientRequestId; + } if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { httpRequest.headers['accept-language'] = this.client.acceptLanguage; } @@ -115,30 +131,27 @@ function _getOutput(resourceGroupName, automationAccountName, jobId, options, ca } httpRequest.body = null; // Send Request - httpRequest.streamedResponse = true; return client.pipeline(httpRequest, (err, response, responseBody) => { if (err) { return callback(err); } - let statusCode = response.statusCode; if (statusCode !== 200) { - let error = new Error(`Unexpected status code: ${statusCode}`); + 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 { - if (responseBody !== undefined) parsedErrorResponse = JSON.parse(responseBody); + 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.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['ErrorResponse']().mapper(); + let resultMapper = new client.models['CloudError']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -148,24 +161,51 @@ function _getOutput(resourceGroupName, automationAccountName, jobId, options, ca } return callback(error); } - // Create Result - let result = response; + 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 = { + required: false, + serializedName: 'parsedResponse', + type: { + name: 'String' + } + }; + 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); }); } /** - * Retrieve the runbook content of the job identified by job id. + * Retrieve the runbook content of the job identified by job name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} jobId The job id. + * @param {string} jobName The job name. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -175,13 +215,13 @@ function _getOutput(resourceGroupName, automationAccountName, jobId, options, ca * * {Error} err - The Error object if an error occurred, null otherwise. * - * {object} [result] - The deserialized result object if an error did not occur. + * {string} [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 _getRunbookContent(resourceGroupName, automationAccountName, jobId, options, callback) { +function _getRunbookContent(resourceGroupName, automationAccountName, jobName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -191,12 +231,25 @@ function _getRunbookContent(resourceGroupName, automationAccountName, jobId, opt if (!callback) { throw new Error('callback cannot be null.'); } + let clientRequestId = (options && options.clientRequestId !== undefined) ? options.clientRequestId : undefined; + let apiVersion = '2017-05-15-preview'; // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -205,14 +258,11 @@ function _getRunbookContent(resourceGroupName, automationAccountName, jobId, opt if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); } - if (jobId === null || jobId === undefined || typeof jobId.valueOf() !== 'string') { - throw new Error('jobId cannot be null or undefined and it must be of type string.'); + if (jobName === null || jobName === undefined || typeof jobName.valueOf() !== 'string') { + throw new Error('jobName cannot be null or undefined and it must be of type string.'); } - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + if (clientRequestId !== null && clientRequestId !== undefined && typeof clientRequestId.valueOf() !== 'string') { + throw new Error('clientRequestId 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.'); @@ -223,13 +273,13 @@ function _getRunbookContent(resourceGroupName, automationAccountName, jobId, opt // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobId}/runbookContent'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/runbookContent'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); - requestUrl = requestUrl.replace('{jobId}', encodeURIComponent(jobId)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{jobName}', encodeURIComponent(jobName)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -244,6 +294,9 @@ function _getRunbookContent(resourceGroupName, automationAccountName, jobId, opt if (this.client.generateClientRequestId) { httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); } + if (clientRequestId !== undefined && clientRequestId !== null) { + httpRequest.headers['clientRequestId'] = clientRequestId; + } if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { httpRequest.headers['accept-language'] = this.client.acceptLanguage; } @@ -256,30 +309,27 @@ function _getRunbookContent(resourceGroupName, automationAccountName, jobId, opt } httpRequest.body = null; // Send Request - httpRequest.streamedResponse = true; return client.pipeline(httpRequest, (err, response, responseBody) => { if (err) { return callback(err); } - let statusCode = response.statusCode; if (statusCode !== 200) { - let error = new Error(`Unexpected status code: ${statusCode}`); + 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 { - if (responseBody !== undefined) parsedErrorResponse = JSON.parse(responseBody); + 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.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['ErrorResponse']().mapper(); + let resultMapper = new client.models['CloudError']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -289,24 +339,51 @@ function _getRunbookContent(resourceGroupName, automationAccountName, jobId, opt } return callback(error); } - // Create Result - let result = response; + 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 = { + required: false, + serializedName: 'parsedResponse', + type: { + name: 'String' + } + }; + 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); }); } /** - * Suspend the job identified by jobId. + * Suspend the job identified by job name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {uuid} jobId The job id. + * @param {string} jobName The job name. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -322,7 +399,7 @@ function _getRunbookContent(resourceGroupName, automationAccountName, jobId, opt * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _suspend(resourceGroupName, automationAccountName, jobId, options, callback) { +function _suspend(resourceGroupName, automationAccountName, jobName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -332,12 +409,25 @@ function _suspend(resourceGroupName, automationAccountName, jobId, options, call if (!callback) { throw new Error('callback cannot be null.'); } + let clientRequestId = (options && options.clientRequestId !== undefined) ? options.clientRequestId : undefined; + let apiVersion = '2017-05-15-preview'; // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -346,14 +436,11 @@ function _suspend(resourceGroupName, automationAccountName, jobId, options, call if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); } - if (jobId === null || jobId === undefined || typeof jobId.valueOf() !== 'string' || !msRest.isValidUuid(jobId)) { - throw new Error('jobId cannot be null or undefined and it must be of type string and must be a valid uuid.'); - } - 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 (jobName === null || jobName === undefined || typeof jobName.valueOf() !== 'string') { + throw new Error('jobName cannot be null or undefined and it must be of type string.'); } - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + if (clientRequestId !== null && clientRequestId !== undefined && typeof clientRequestId.valueOf() !== 'string') { + throw new Error('clientRequestId 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.'); @@ -364,13 +451,13 @@ function _suspend(resourceGroupName, automationAccountName, jobId, options, call // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobId}/suspend'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/suspend'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); - requestUrl = requestUrl.replace('{jobId}', encodeURIComponent(jobId.toString())); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{jobName}', encodeURIComponent(jobName)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -385,6 +472,9 @@ function _suspend(resourceGroupName, automationAccountName, jobId, options, call if (this.client.generateClientRequestId) { httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); } + if (clientRequestId !== undefined && clientRequestId !== null) { + httpRequest.headers['clientRequestId'] = clientRequestId; + } if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { httpRequest.headers['accept-language'] = this.client.acceptLanguage; } @@ -437,16 +527,19 @@ function _suspend(resourceGroupName, automationAccountName, jobId, options, call } /** - * Stop the job identified by jobId. + * Stop the job identified by jobName. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {uuid} jobId The job id. + * @param {string} jobName The job name. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -462,7 +555,7 @@ function _suspend(resourceGroupName, automationAccountName, jobId, options, call * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _stop(resourceGroupName, automationAccountName, jobId, options, callback) { +function _stop(resourceGroupName, automationAccountName, jobName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -472,12 +565,22 @@ function _stop(resourceGroupName, automationAccountName, jobId, options, callbac if (!callback) { throw new Error('callback cannot be null.'); } + let clientRequestId = (options && options.clientRequestId !== undefined) ? options.clientRequestId : undefined; + let apiVersion = '2017-05-15-preview'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -486,14 +589,14 @@ function _stop(resourceGroupName, automationAccountName, jobId, options, callbac if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); } - if (jobId === null || jobId === undefined || typeof jobId.valueOf() !== 'string' || !msRest.isValidUuid(jobId)) { - throw new Error('jobId cannot be null or undefined and it must be of type string and must be a valid uuid.'); + if (jobName === null || jobName === undefined || typeof jobName.valueOf() !== 'string') { + throw new Error('jobName cannot be null or undefined and it must be of type string.'); } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + if (clientRequestId !== null && clientRequestId !== undefined && typeof clientRequestId.valueOf() !== 'string') { + throw new Error('clientRequestId 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.'); @@ -504,13 +607,13 @@ function _stop(resourceGroupName, automationAccountName, jobId, options, callbac // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobId}/stop'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/stop'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); - requestUrl = requestUrl.replace('{jobId}', encodeURIComponent(jobId.toString())); + requestUrl = requestUrl.replace('{jobName}', encodeURIComponent(jobName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -525,6 +628,9 @@ function _stop(resourceGroupName, automationAccountName, jobId, options, callbac if (this.client.generateClientRequestId) { httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); } + if (clientRequestId !== undefined && clientRequestId !== null) { + httpRequest.headers['clientRequestId'] = clientRequestId; + } if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { httpRequest.headers['accept-language'] = this.client.acceptLanguage; } @@ -577,16 +683,19 @@ function _stop(resourceGroupName, automationAccountName, jobId, options, callbac } /** - * Retrieve the job identified by job id. + * Retrieve the job identified by job name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {uuid} jobId The job id. + * @param {string} jobName The job name. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -603,7 +712,7 @@ function _stop(resourceGroupName, automationAccountName, jobId, options, callbac * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _get(resourceGroupName, automationAccountName, jobId, options, callback) { +function _get(resourceGroupName, automationAccountName, jobName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -613,12 +722,25 @@ function _get(resourceGroupName, automationAccountName, jobId, options, callback if (!callback) { throw new Error('callback cannot be null.'); } + let clientRequestId = (options && options.clientRequestId !== undefined) ? options.clientRequestId : undefined; + let apiVersion = '2017-05-15-preview'; // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -627,14 +749,11 @@ function _get(resourceGroupName, automationAccountName, jobId, options, callback if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); } - if (jobId === null || jobId === undefined || typeof jobId.valueOf() !== 'string' || !msRest.isValidUuid(jobId)) { - throw new Error('jobId cannot be null or undefined and it must be of type string and must be a valid uuid.'); - } - 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 (jobName === null || jobName === undefined || typeof jobName.valueOf() !== 'string') { + throw new Error('jobName cannot be null or undefined and it must be of type string.'); } - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + if (clientRequestId !== null && clientRequestId !== undefined && typeof clientRequestId.valueOf() !== 'string') { + throw new Error('clientRequestId 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.'); @@ -645,13 +764,13 @@ function _get(resourceGroupName, automationAccountName, jobId, options, callback // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobId}'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); - requestUrl = requestUrl.replace('{jobId}', encodeURIComponent(jobId.toString())); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{jobName}', encodeURIComponent(jobName)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -666,6 +785,9 @@ function _get(resourceGroupName, automationAccountName, jobId, options, callback if (this.client.generateClientRequestId) { httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); } + if (clientRequestId !== undefined && clientRequestId !== null) { + httpRequest.headers['clientRequestId'] = clientRequestId; + } if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { httpRequest.headers['accept-language'] = this.client.acceptLanguage; } @@ -737,11 +859,11 @@ function _get(resourceGroupName, automationAccountName, jobId, options, callback /** * Create a job of the runbook. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {uuid} jobId The job id. + * @param {string} jobName The job name. * * @param {object} parameters The parameters supplied to the create job * operation. @@ -757,16 +879,11 @@ function _get(resourceGroupName, automationAccountName, jobId, options, callback * @param {string} [parameters.runOn] Gets or sets the runOn which specifies * the group name where the job is to be executed. * - * @param {string} [parameters.name] Gets or sets name of the resource. - * - * @param {string} [parameters.location] Gets or sets the location of the - * resource. - * - * @param {object} [parameters.tags] Gets or sets the tags attached to the - * resource. - * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -783,7 +900,7 @@ function _get(resourceGroupName, automationAccountName, jobId, options, callback * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _create(resourceGroupName, automationAccountName, jobId, parameters, options, callback) { +function _create(resourceGroupName, automationAccountName, jobName, parameters, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -793,12 +910,25 @@ function _create(resourceGroupName, automationAccountName, jobId, parameters, op if (!callback) { throw new Error('callback cannot be null.'); } + let clientRequestId = (options && options.clientRequestId !== undefined) ? options.clientRequestId : undefined; + let apiVersion = '2017-05-15-preview'; // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -807,17 +937,14 @@ function _create(resourceGroupName, automationAccountName, jobId, parameters, op if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); } - if (jobId === null || jobId === undefined || typeof jobId.valueOf() !== 'string' || !msRest.isValidUuid(jobId)) { - throw new Error('jobId cannot be null or undefined and it must be of type string and must be a valid uuid.'); + if (jobName === null || jobName === undefined || typeof jobName.valueOf() !== 'string') { + throw new Error('jobName cannot be null or undefined and it must be of type string.'); } if (parameters === null || parameters === undefined) { throw new Error('parameters cannot be null or undefined.'); } - 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + if (clientRequestId !== null && clientRequestId !== undefined && typeof clientRequestId.valueOf() !== 'string') { + throw new Error('clientRequestId 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.'); @@ -828,13 +955,13 @@ function _create(resourceGroupName, automationAccountName, jobId, parameters, op // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobId}'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); - requestUrl = requestUrl.replace('{jobId}', encodeURIComponent(jobId.toString())); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{jobName}', encodeURIComponent(jobName)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -849,6 +976,9 @@ function _create(resourceGroupName, automationAccountName, jobId, parameters, op if (this.client.generateClientRequestId) { httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); } + if (clientRequestId !== undefined && clientRequestId !== null) { + httpRequest.headers['clientRequestId'] = clientRequestId; + } if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { httpRequest.headers['accept-language'] = this.client.acceptLanguage; } @@ -934,14 +1064,17 @@ function _create(resourceGroupName, automationAccountName, jobId, parameters, op /** * Retrieve a list of jobs. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {object} [options] Optional Parameters. * * @param {string} [options.filter] The filter to apply on the operation. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -952,7 +1085,7 @@ function _create(resourceGroupName, automationAccountName, jobId, parameters, op * {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 JobListResult} for more information. + * See {@link JobListResultV2} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * @@ -969,12 +1102,22 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti throw new Error('callback cannot be null.'); } let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let clientRequestId = (options && options.clientRequestId !== undefined) ? options.clientRequestId : undefined; + let apiVersion = '2017-05-15-preview'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -989,8 +1132,8 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + if (clientRequestId !== null && clientRequestId !== undefined && typeof clientRequestId.valueOf() !== 'string') { + throw new Error('clientRequestId 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.'); @@ -1009,7 +1152,7 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti if (filter !== null && filter !== undefined) { queryParameters.push('$filter=' + encodeURIComponent(filter)); } - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1024,6 +1167,9 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti if (this.client.generateClientRequestId) { httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); } + if (clientRequestId !== undefined && clientRequestId !== null) { + httpRequest.headers['clientRequestId'] = clientRequestId; + } if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { httpRequest.headers['accept-language'] = this.client.acceptLanguage; } @@ -1077,7 +1223,7 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['JobListResult']().mapper(); + let resultMapper = new client.models['JobListResultV2']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -1093,16 +1239,19 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti } /** - * Resume the job identified by jobId. + * Resume the job identified by jobName. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {uuid} jobId The job id. + * @param {string} jobName The job name. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -1118,7 +1267,7 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _resume(resourceGroupName, automationAccountName, jobId, options, callback) { +function _resume(resourceGroupName, automationAccountName, jobName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -1128,12 +1277,22 @@ function _resume(resourceGroupName, automationAccountName, jobId, options, callb if (!callback) { throw new Error('callback cannot be null.'); } + let clientRequestId = (options && options.clientRequestId !== undefined) ? options.clientRequestId : undefined; + let apiVersion = '2017-05-15-preview'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -1142,14 +1301,14 @@ function _resume(resourceGroupName, automationAccountName, jobId, options, callb if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); } - if (jobId === null || jobId === undefined || typeof jobId.valueOf() !== 'string' || !msRest.isValidUuid(jobId)) { - throw new Error('jobId cannot be null or undefined and it must be of type string and must be a valid uuid.'); + if (jobName === null || jobName === undefined || typeof jobName.valueOf() !== 'string') { + throw new Error('jobName cannot be null or undefined and it must be of type string.'); } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + if (clientRequestId !== null && clientRequestId !== undefined && typeof clientRequestId.valueOf() !== 'string') { + throw new Error('clientRequestId 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.'); @@ -1160,13 +1319,13 @@ function _resume(resourceGroupName, automationAccountName, jobId, options, callb // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobId}/resume'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/resume'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); - requestUrl = requestUrl.replace('{jobId}', encodeURIComponent(jobId.toString())); + requestUrl = requestUrl.replace('{jobName}', encodeURIComponent(jobName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1181,6 +1340,9 @@ function _resume(resourceGroupName, automationAccountName, jobId, options, callb if (this.client.generateClientRequestId) { httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); } + if (clientRequestId !== undefined && clientRequestId !== null) { + httpRequest.headers['clientRequestId'] = clientRequestId; + } if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { httpRequest.headers['accept-language'] = this.client.acceptLanguage; } @@ -1240,6 +1402,9 @@ function _resume(resourceGroupName, automationAccountName, jobId, options, callb * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -1250,7 +1415,7 @@ function _resume(resourceGroupName, automationAccountName, jobId, options, callb * {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 JobListResult} for more information. + * See {@link JobListResultV2} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * @@ -1266,11 +1431,15 @@ function _listByAutomationAccountNext(nextPageLink, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } + let clientRequestId = (options && options.clientRequestId !== undefined) ? options.clientRequestId : undefined; // 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 (clientRequestId !== null && clientRequestId !== undefined && typeof clientRequestId.valueOf() !== 'string') { + throw new Error('clientRequestId 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.'); } @@ -1292,6 +1461,9 @@ function _listByAutomationAccountNext(nextPageLink, options, callback) { if (this.client.generateClientRequestId) { httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); } + if (clientRequestId !== undefined && clientRequestId !== null) { + httpRequest.headers['clientRequestId'] = clientRequestId; + } if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { httpRequest.headers['accept-language'] = this.client.acceptLanguage; } @@ -1345,7 +1517,7 @@ function _listByAutomationAccountNext(nextPageLink, options, callback) { parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['JobListResult']().mapper(); + let resultMapper = new client.models['JobListResultV2']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -1380,30 +1552,33 @@ class JobOperations { } /** - * Retrieve the job output identified by job id. + * Retrieve the job output identified by job name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} jobId The job id. + * @param {string} jobName The name of the job to be created. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - getOutputWithHttpOperationResponse(resourceGroupName, automationAccountName, jobId, options) { + getOutputWithHttpOperationResponse(resourceGroupName, automationAccountName, jobName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._getOutput(resourceGroupName, automationAccountName, jobId, options, (err, result, request, response) => { + self._getOutput(resourceGroupName, automationAccountName, jobName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -1414,16 +1589,19 @@ class JobOperations { } /** - * Retrieve the job output identified by job id. + * Retrieve the job output identified by job name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} jobId The job id. + * @param {string} jobName The name of the job to be created. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -1434,7 +1612,7 @@ class JobOperations { * * {Promise} A promise is returned * - * @resolve {Object} - The deserialized result object. + * @resolve {String} - The deserialized result object. * * @reject {Error} - The error object. * @@ -1442,13 +1620,13 @@ class JobOperations { * * {Error} err - The Error object if an error occurred, null otherwise. * - * {object} [result] - The deserialized result object if an error did not occur. + * {string} [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. */ - getOutput(resourceGroupName, automationAccountName, jobId, options, optionalCallback) { + getOutput(resourceGroupName, automationAccountName, jobName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -1457,42 +1635,45 @@ class JobOperations { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._getOutput(resourceGroupName, automationAccountName, jobId, options, (err, result, request, response) => { + self._getOutput(resourceGroupName, automationAccountName, jobName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._getOutput(resourceGroupName, automationAccountName, jobId, options, optionalCallback); + return self._getOutput(resourceGroupName, automationAccountName, jobName, options, optionalCallback); } } /** - * Retrieve the runbook content of the job identified by job id. + * Retrieve the runbook content of the job identified by job name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} jobId The job id. + * @param {string} jobName The job name. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - getRunbookContentWithHttpOperationResponse(resourceGroupName, automationAccountName, jobId, options) { + getRunbookContentWithHttpOperationResponse(resourceGroupName, automationAccountName, jobName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._getRunbookContent(resourceGroupName, automationAccountName, jobId, options, (err, result, request, response) => { + self._getRunbookContent(resourceGroupName, automationAccountName, jobName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -1503,16 +1684,19 @@ class JobOperations { } /** - * Retrieve the runbook content of the job identified by job id. + * Retrieve the runbook content of the job identified by job name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} jobId The job id. + * @param {string} jobName The job name. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -1523,7 +1707,7 @@ class JobOperations { * * {Promise} A promise is returned * - * @resolve {Object} - The deserialized result object. + * @resolve {String} - The deserialized result object. * * @reject {Error} - The error object. * @@ -1531,13 +1715,13 @@ class JobOperations { * * {Error} err - The Error object if an error occurred, null otherwise. * - * {object} [result] - The deserialized result object if an error did not occur. + * {string} [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. */ - getRunbookContent(resourceGroupName, automationAccountName, jobId, options, optionalCallback) { + getRunbookContent(resourceGroupName, automationAccountName, jobName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -1546,28 +1730,31 @@ class JobOperations { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._getRunbookContent(resourceGroupName, automationAccountName, jobId, options, (err, result, request, response) => { + self._getRunbookContent(resourceGroupName, automationAccountName, jobName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._getRunbookContent(resourceGroupName, automationAccountName, jobId, options, optionalCallback); + return self._getRunbookContent(resourceGroupName, automationAccountName, jobName, options, optionalCallback); } } /** - * Suspend the job identified by jobId. + * Suspend the job identified by job name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {uuid} jobId The job id. + * @param {string} jobName The job name. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -1577,11 +1764,11 @@ class JobOperations { * * @reject {Error} - The error object. */ - suspendWithHttpOperationResponse(resourceGroupName, automationAccountName, jobId, options) { + suspendWithHttpOperationResponse(resourceGroupName, automationAccountName, jobName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._suspend(resourceGroupName, automationAccountName, jobId, options, (err, result, request, response) => { + self._suspend(resourceGroupName, automationAccountName, jobName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -1592,16 +1779,19 @@ class JobOperations { } /** - * Suspend the job identified by jobId. + * Suspend the job identified by job name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {uuid} jobId The job id. + * @param {string} jobName The job name. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -1626,7 +1816,7 @@ class JobOperations { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - suspend(resourceGroupName, automationAccountName, jobId, options, optionalCallback) { + suspend(resourceGroupName, automationAccountName, jobName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -1635,28 +1825,31 @@ class JobOperations { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._suspend(resourceGroupName, automationAccountName, jobId, options, (err, result, request, response) => { + self._suspend(resourceGroupName, automationAccountName, jobName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._suspend(resourceGroupName, automationAccountName, jobId, options, optionalCallback); + return self._suspend(resourceGroupName, automationAccountName, jobName, options, optionalCallback); } } /** - * Stop the job identified by jobId. + * Stop the job identified by jobName. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {uuid} jobId The job id. + * @param {string} jobName The job name. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -1666,11 +1859,11 @@ class JobOperations { * * @reject {Error} - The error object. */ - stopWithHttpOperationResponse(resourceGroupName, automationAccountName, jobId, options) { + stopWithHttpOperationResponse(resourceGroupName, automationAccountName, jobName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._stop(resourceGroupName, automationAccountName, jobId, options, (err, result, request, response) => { + self._stop(resourceGroupName, automationAccountName, jobName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -1681,16 +1874,19 @@ class JobOperations { } /** - * Stop the job identified by jobId. + * Stop the job identified by jobName. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {uuid} jobId The job id. + * @param {string} jobName The job name. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -1715,7 +1911,7 @@ class JobOperations { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - stop(resourceGroupName, automationAccountName, jobId, options, optionalCallback) { + stop(resourceGroupName, automationAccountName, jobName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -1724,28 +1920,31 @@ class JobOperations { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._stop(resourceGroupName, automationAccountName, jobId, options, (err, result, request, response) => { + self._stop(resourceGroupName, automationAccountName, jobName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._stop(resourceGroupName, automationAccountName, jobId, options, optionalCallback); + return self._stop(resourceGroupName, automationAccountName, jobName, options, optionalCallback); } } /** - * Retrieve the job identified by job id. + * Retrieve the job identified by job name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {uuid} jobId The job id. + * @param {string} jobName The job name. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -1755,11 +1954,11 @@ class JobOperations { * * @reject {Error} - The error object. */ - getWithHttpOperationResponse(resourceGroupName, automationAccountName, jobId, options) { + getWithHttpOperationResponse(resourceGroupName, automationAccountName, jobName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._get(resourceGroupName, automationAccountName, jobId, options, (err, result, request, response) => { + self._get(resourceGroupName, automationAccountName, jobName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -1770,16 +1969,19 @@ class JobOperations { } /** - * Retrieve the job identified by job id. + * Retrieve the job identified by job name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {uuid} jobId The job id. + * @param {string} jobName The job name. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -1805,7 +2007,7 @@ class JobOperations { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - get(resourceGroupName, automationAccountName, jobId, options, optionalCallback) { + get(resourceGroupName, automationAccountName, jobName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -1814,25 +2016,25 @@ class JobOperations { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._get(resourceGroupName, automationAccountName, jobId, options, (err, result, request, response) => { + self._get(resourceGroupName, automationAccountName, jobName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._get(resourceGroupName, automationAccountName, jobId, options, optionalCallback); + return self._get(resourceGroupName, automationAccountName, jobName, options, optionalCallback); } } /** * Create a job of the runbook. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {uuid} jobId The job id. + * @param {string} jobName The job name. * * @param {object} parameters The parameters supplied to the create job * operation. @@ -1848,16 +2050,11 @@ class JobOperations { * @param {string} [parameters.runOn] Gets or sets the runOn which specifies * the group name where the job is to be executed. * - * @param {string} [parameters.name] Gets or sets name of the resource. - * - * @param {string} [parameters.location] Gets or sets the location of the - * resource. - * - * @param {object} [parameters.tags] Gets or sets the tags attached to the - * resource. - * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -1867,11 +2064,11 @@ class JobOperations { * * @reject {Error} - The error object. */ - createWithHttpOperationResponse(resourceGroupName, automationAccountName, jobId, parameters, options) { + createWithHttpOperationResponse(resourceGroupName, automationAccountName, jobName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._create(resourceGroupName, automationAccountName, jobId, parameters, options, (err, result, request, response) => { + self._create(resourceGroupName, automationAccountName, jobName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -1884,11 +2081,11 @@ class JobOperations { /** * Create a job of the runbook. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {uuid} jobId The job id. + * @param {string} jobName The job name. * * @param {object} parameters The parameters supplied to the create job * operation. @@ -1904,16 +2101,11 @@ class JobOperations { * @param {string} [parameters.runOn] Gets or sets the runOn which specifies * the group name where the job is to be executed. * - * @param {string} [parameters.name] Gets or sets name of the resource. - * - * @param {string} [parameters.location] Gets or sets the location of the - * resource. - * - * @param {object} [parameters.tags] Gets or sets the tags attached to the - * resource. - * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -1939,7 +2131,7 @@ class JobOperations { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - create(resourceGroupName, automationAccountName, jobId, parameters, options, optionalCallback) { + create(resourceGroupName, automationAccountName, jobName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -1948,34 +2140,37 @@ class JobOperations { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._create(resourceGroupName, automationAccountName, jobId, parameters, options, (err, result, request, response) => { + self._create(resourceGroupName, automationAccountName, jobName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._create(resourceGroupName, automationAccountName, jobId, parameters, options, optionalCallback); + return self._create(resourceGroupName, automationAccountName, jobName, parameters, options, optionalCallback); } } /** * Retrieve a list of jobs. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {object} [options] Optional Parameters. * * @param {string} [options.filter] The filter to apply on the operation. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ @@ -1996,14 +2191,17 @@ class JobOperations { /** * Retrieve a list of jobs. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {object} [options] Optional Parameters. * * @param {string} [options.filter] The filter to apply on the operation. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -2014,7 +2212,7 @@ class JobOperations { * * {Promise} A promise is returned * - * @resolve {JobListResult} - The deserialized result object. + * @resolve {JobListResultV2} - The deserialized result object. * * @reject {Error} - The error object. * @@ -2023,7 +2221,7 @@ class JobOperations { * {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 JobListResult} for more information. + * See {@link JobListResultV2} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * @@ -2050,16 +2248,19 @@ class JobOperations { } /** - * Resume the job identified by jobId. + * Resume the job identified by jobName. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {uuid} jobId The job id. + * @param {string} jobName The job name. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -2069,11 +2270,11 @@ class JobOperations { * * @reject {Error} - The error object. */ - resumeWithHttpOperationResponse(resourceGroupName, automationAccountName, jobId, options) { + resumeWithHttpOperationResponse(resourceGroupName, automationAccountName, jobName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._resume(resourceGroupName, automationAccountName, jobId, options, (err, result, request, response) => { + self._resume(resourceGroupName, automationAccountName, jobName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -2084,16 +2285,19 @@ class JobOperations { } /** - * Resume the job identified by jobId. + * Resume the job identified by jobName. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {uuid} jobId The job id. + * @param {string} jobName The job name. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -2118,7 +2322,7 @@ class JobOperations { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - resume(resourceGroupName, automationAccountName, jobId, options, optionalCallback) { + resume(resourceGroupName, automationAccountName, jobName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -2127,14 +2331,14 @@ class JobOperations { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._resume(resourceGroupName, automationAccountName, jobId, options, (err, result, request, response) => { + self._resume(resourceGroupName, automationAccountName, jobName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._resume(resourceGroupName, automationAccountName, jobId, options, optionalCallback); + return self._resume(resourceGroupName, automationAccountName, jobName, options, optionalCallback); } } @@ -2146,12 +2350,15 @@ class JobOperations { * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ @@ -2177,6 +2384,9 @@ class JobOperations { * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -2187,7 +2397,7 @@ class JobOperations { * * {Promise} A promise is returned * - * @resolve {JobListResult} - The deserialized result object. + * @resolve {JobListResultV2} - The deserialized result object. * * @reject {Error} - The error object. * @@ -2196,7 +2406,7 @@ class JobOperations { * {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 JobListResult} for more information. + * See {@link JobListResultV2} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * diff --git a/lib/services/automationManagement/lib/operations/jobScheduleOperations.js b/lib/services/automationManagement/lib/operations/jobScheduleOperations.js index 580185b3ab..0cda753c0a 100644 --- a/lib/services/automationManagement/lib/operations/jobScheduleOperations.js +++ b/lib/services/automationManagement/lib/operations/jobScheduleOperations.js @@ -17,7 +17,7 @@ const WebResource = msRest.WebResource; /** * Delete the job schedule identified by job schedule name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -50,12 +50,21 @@ function _deleteMethod(resourceGroupName, automationAccountName, jobScheduleId, if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -70,9 +79,6 @@ function _deleteMethod(resourceGroupName, automationAccountName, jobScheduleId, 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -88,7 +94,7 @@ function _deleteMethod(resourceGroupName, automationAccountName, jobScheduleId, requestUrl = requestUrl.replace('{jobScheduleId}', encodeURIComponent(jobScheduleId.toString())); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -157,7 +163,7 @@ function _deleteMethod(resourceGroupName, automationAccountName, jobScheduleId, /** * Retrieve the job schedule identified by job schedule name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -191,12 +197,21 @@ function _get(resourceGroupName, automationAccountName, jobScheduleId, options, if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -211,9 +226,6 @@ function _get(resourceGroupName, automationAccountName, jobScheduleId, options, 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -229,7 +241,7 @@ function _get(resourceGroupName, automationAccountName, jobScheduleId, options, requestUrl = requestUrl.replace('{jobScheduleId}', encodeURIComponent(jobScheduleId.toString())); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -315,7 +327,7 @@ function _get(resourceGroupName, automationAccountName, jobScheduleId, options, /** * Create a job schedule. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -368,12 +380,21 @@ function _create(resourceGroupName, automationAccountName, jobScheduleId, parame if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -391,9 +412,6 @@ function _create(resourceGroupName, automationAccountName, jobScheduleId, parame 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -409,7 +427,7 @@ function _create(resourceGroupName, automationAccountName, jobScheduleId, parame requestUrl = requestUrl.replace('{jobScheduleId}', encodeURIComponent(jobScheduleId.toString())); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -509,7 +527,7 @@ function _create(resourceGroupName, automationAccountName, jobScheduleId, parame /** * Retrieve a list of job schedules. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -541,12 +559,21 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -558,9 +585,6 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -575,7 +599,7 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -804,7 +828,7 @@ class JobScheduleOperations { /** * Delete the job schedule identified by job schedule name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -838,7 +862,7 @@ class JobScheduleOperations { /** * Delete the job schedule identified by job schedule name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -893,7 +917,7 @@ class JobScheduleOperations { /** * Retrieve the job schedule identified by job schedule name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -927,7 +951,7 @@ class JobScheduleOperations { /** * Retrieve the job schedule identified by job schedule name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -983,7 +1007,7 @@ class JobScheduleOperations { /** * Create a job schedule. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1036,7 +1060,7 @@ class JobScheduleOperations { /** * Create a job schedule. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1111,7 +1135,7 @@ class JobScheduleOperations { /** * Retrieve a list of job schedules. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1143,7 +1167,7 @@ class JobScheduleOperations { /** * Retrieve a list of job schedules. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * diff --git a/lib/services/automationManagement/lib/operations/jobStreamOperations.js b/lib/services/automationManagement/lib/operations/jobStreamOperations.js index 44e5c0dbfd..3ce20fe210 100644 --- a/lib/services/automationManagement/lib/operations/jobStreamOperations.js +++ b/lib/services/automationManagement/lib/operations/jobStreamOperations.js @@ -17,16 +17,19 @@ const WebResource = msRest.WebResource; /** * Retrieve the job stream identified by job stream id. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} jobId The job id. + * @param {string} jobName The job name. * * @param {string} jobStreamId The job stream id. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -43,7 +46,7 @@ const WebResource = msRest.WebResource; * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _get(resourceGroupName, automationAccountName, jobId, jobStreamId, options, callback) { +function _get(resourceGroupName, automationAccountName, jobName, jobStreamId, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -53,12 +56,25 @@ function _get(resourceGroupName, automationAccountName, jobId, jobStreamId, opti if (!callback) { throw new Error('callback cannot be null.'); } + let clientRequestId = (options && options.clientRequestId !== undefined) ? options.clientRequestId : undefined; + let apiVersion = '2017-05-15-preview'; // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -67,17 +83,14 @@ function _get(resourceGroupName, automationAccountName, jobId, jobStreamId, opti if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); } - if (jobId === null || jobId === undefined || typeof jobId.valueOf() !== 'string') { - throw new Error('jobId cannot be null or undefined and it must be of type string.'); + if (jobName === null || jobName === undefined || typeof jobName.valueOf() !== 'string') { + throw new Error('jobName cannot be null or undefined and it must be of type string.'); } if (jobStreamId === null || jobStreamId === undefined || typeof jobStreamId.valueOf() !== 'string') { throw new Error('jobStreamId cannot be null or undefined and it must be of type string.'); } - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + if (clientRequestId !== null && clientRequestId !== undefined && typeof clientRequestId.valueOf() !== 'string') { + throw new Error('clientRequestId 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.'); @@ -88,14 +101,14 @@ function _get(resourceGroupName, automationAccountName, jobId, jobStreamId, opti // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobId}/streams/{jobStreamId}'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/streams/{jobStreamId}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); - requestUrl = requestUrl.replace('{jobId}', encodeURIComponent(jobId)); + requestUrl = requestUrl.replace('{jobName}', encodeURIComponent(jobName)); requestUrl = requestUrl.replace('{jobStreamId}', encodeURIComponent(jobStreamId)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -110,6 +123,9 @@ function _get(resourceGroupName, automationAccountName, jobId, jobStreamId, opti if (this.client.generateClientRequestId) { httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); } + if (clientRequestId !== undefined && clientRequestId !== null) { + httpRequest.headers['clientRequestId'] = clientRequestId; + } if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { httpRequest.headers['accept-language'] = this.client.acceptLanguage; } @@ -179,18 +195,21 @@ function _get(resourceGroupName, automationAccountName, jobId, jobStreamId, opti } /** - * Retrieve a list of jobs streams identified by job id. + * Retrieve a list of jobs streams identified by job name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} jobId The job Id. + * @param {string} jobName The job name. * * @param {object} [options] Optional Parameters. * * @param {string} [options.filter] The filter to apply on the operation. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -207,7 +226,7 @@ function _get(resourceGroupName, automationAccountName, jobId, jobStreamId, opti * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _listByJob(resourceGroupName, automationAccountName, jobId, options, callback) { +function _listByJob(resourceGroupName, automationAccountName, jobName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -218,12 +237,22 @@ function _listByJob(resourceGroupName, automationAccountName, jobId, options, ca throw new Error('callback cannot be null.'); } let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let clientRequestId = (options && options.clientRequestId !== undefined) ? options.clientRequestId : undefined; + let apiVersion = '2017-05-15-preview'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -232,8 +261,8 @@ function _listByJob(resourceGroupName, automationAccountName, jobId, options, ca if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); } - if (jobId === null || jobId === undefined || typeof jobId.valueOf() !== 'string') { - throw new Error('jobId cannot be null or undefined and it must be of type string.'); + if (jobName === null || jobName === undefined || typeof jobName.valueOf() !== 'string') { + throw new Error('jobName cannot be null or undefined and it must be of type string.'); } if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { throw new Error('filter must be of type string.'); @@ -241,8 +270,8 @@ function _listByJob(resourceGroupName, automationAccountName, jobId, options, ca 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + if (clientRequestId !== null && clientRequestId !== undefined && typeof clientRequestId.valueOf() !== 'string') { + throw new Error('clientRequestId 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.'); @@ -253,16 +282,16 @@ function _listByJob(resourceGroupName, automationAccountName, jobId, options, ca // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobId}/streams'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/streams'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); - requestUrl = requestUrl.replace('{jobId}', encodeURIComponent(jobId)); + requestUrl = requestUrl.replace('{jobName}', encodeURIComponent(jobName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; if (filter !== null && filter !== undefined) { queryParameters.push('$filter=' + encodeURIComponent(filter)); } - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -277,6 +306,9 @@ function _listByJob(resourceGroupName, automationAccountName, jobId, options, ca if (this.client.generateClientRequestId) { httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); } + if (clientRequestId !== undefined && clientRequestId !== null) { + httpRequest.headers['clientRequestId'] = clientRequestId; + } if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { httpRequest.headers['accept-language'] = this.client.acceptLanguage; } @@ -346,13 +378,16 @@ function _listByJob(resourceGroupName, automationAccountName, jobId, options, ca } /** - * Retrieve a list of jobs streams identified by job id. + * Retrieve a list of jobs streams identified by job name. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -379,11 +414,15 @@ function _listByJobNext(nextPageLink, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } + let clientRequestId = (options && options.clientRequestId !== undefined) ? options.clientRequestId : undefined; // 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 (clientRequestId !== null && clientRequestId !== undefined && typeof clientRequestId.valueOf() !== 'string') { + throw new Error('clientRequestId 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.'); } @@ -405,6 +444,9 @@ function _listByJobNext(nextPageLink, options, callback) { if (this.client.generateClientRequestId) { httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); } + if (clientRequestId !== undefined && clientRequestId !== null) { + httpRequest.headers['clientRequestId'] = clientRequestId; + } if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { httpRequest.headers['accept-language'] = this.client.acceptLanguage; } @@ -489,16 +531,19 @@ class JobStreamOperations { /** * Retrieve the job stream identified by job stream id. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} jobId The job id. + * @param {string} jobName The job name. * * @param {string} jobStreamId The job stream id. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -508,11 +553,11 @@ class JobStreamOperations { * * @reject {Error} - The error object. */ - getWithHttpOperationResponse(resourceGroupName, automationAccountName, jobId, jobStreamId, options) { + getWithHttpOperationResponse(resourceGroupName, automationAccountName, jobName, jobStreamId, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._get(resourceGroupName, automationAccountName, jobId, jobStreamId, options, (err, result, request, response) => { + self._get(resourceGroupName, automationAccountName, jobName, jobStreamId, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -525,16 +570,19 @@ class JobStreamOperations { /** * Retrieve the job stream identified by job stream id. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} jobId The job id. + * @param {string} jobName The job name. * * @param {string} jobStreamId The job stream id. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -560,7 +608,7 @@ class JobStreamOperations { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - get(resourceGroupName, automationAccountName, jobId, jobStreamId, options, optionalCallback) { + get(resourceGroupName, automationAccountName, jobName, jobStreamId, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -569,30 +617,33 @@ class JobStreamOperations { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._get(resourceGroupName, automationAccountName, jobId, jobStreamId, options, (err, result, request, response) => { + self._get(resourceGroupName, automationAccountName, jobName, jobStreamId, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._get(resourceGroupName, automationAccountName, jobId, jobStreamId, options, optionalCallback); + return self._get(resourceGroupName, automationAccountName, jobName, jobStreamId, options, optionalCallback); } } /** - * Retrieve a list of jobs streams identified by job id. + * Retrieve a list of jobs streams identified by job name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} jobId The job Id. + * @param {string} jobName The job name. * * @param {object} [options] Optional Parameters. * * @param {string} [options.filter] The filter to apply on the operation. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -602,11 +653,11 @@ class JobStreamOperations { * * @reject {Error} - The error object. */ - listByJobWithHttpOperationResponse(resourceGroupName, automationAccountName, jobId, options) { + listByJobWithHttpOperationResponse(resourceGroupName, automationAccountName, jobName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._listByJob(resourceGroupName, automationAccountName, jobId, options, (err, result, request, response) => { + self._listByJob(resourceGroupName, automationAccountName, jobName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -617,18 +668,21 @@ class JobStreamOperations { } /** - * Retrieve a list of jobs streams identified by job id. + * Retrieve a list of jobs streams identified by job name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * - * @param {string} jobId The job Id. + * @param {string} jobName The job name. * * @param {object} [options] Optional Parameters. * * @param {string} [options.filter] The filter to apply on the operation. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -654,7 +708,7 @@ class JobStreamOperations { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - listByJob(resourceGroupName, automationAccountName, jobId, options, optionalCallback) { + listByJob(resourceGroupName, automationAccountName, jobName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -663,25 +717,28 @@ class JobStreamOperations { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._listByJob(resourceGroupName, automationAccountName, jobId, options, (err, result, request, response) => { + self._listByJob(resourceGroupName, automationAccountName, jobName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._listByJob(resourceGroupName, automationAccountName, jobId, options, optionalCallback); + return self._listByJob(resourceGroupName, automationAccountName, jobName, options, optionalCallback); } } /** - * Retrieve a list of jobs streams identified by job id. + * Retrieve a list of jobs streams identified by job name. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -706,13 +763,16 @@ class JobStreamOperations { } /** - * Retrieve a list of jobs streams identified by job id. + * Retrieve a list of jobs streams identified by job name. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * diff --git a/lib/services/automationManagement/lib/operations/keys.js b/lib/services/automationManagement/lib/operations/keys.js new file mode 100644 index 0000000000..2df8a00bf8 --- /dev/null +++ b/lib/services/automationManagement/lib/operations/keys.js @@ -0,0 +1,274 @@ +/* + * 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; + +/** + * Retrieve the automation keys for an account. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 KeyListResult} 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 _listByAutomationAccount(resourceGroupName, automationAccountName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/listKeys'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['KeyListResult']().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 Keys. */ +class Keys { + /** + * Create a Keys. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listByAutomationAccount = _listByAutomationAccount; + } + + /** + * Retrieve the automation keys for an account. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName, automationAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the automation keys for an account. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 {KeyListResult} - 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 KeyListResult} 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. + */ + listByAutomationAccount(resourceGroupName, automationAccountName, 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._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccount(resourceGroupName, automationAccountName, options, optionalCallback); + } + } + +} + +module.exports = Keys; diff --git a/lib/services/automationManagement/lib/operations/linkedWorkspaceOperations.js b/lib/services/automationManagement/lib/operations/linkedWorkspaceOperations.js new file mode 100644 index 0000000000..d000df7367 --- /dev/null +++ b/lib/services/automationManagement/lib/operations/linkedWorkspaceOperations.js @@ -0,0 +1,274 @@ +/* + * 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; + +/** + * Retrieve the linked workspace for the account id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 LinkedWorkspace} 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, automationAccountName, 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 apiVersion = '2015-10-31'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/linkedWorkspace'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LinkedWorkspace']().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 LinkedWorkspaceOperations. */ +class LinkedWorkspaceOperations { + /** + * Create a LinkedWorkspaceOperations. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + } + + /** + * Retrieve the linked workspace for the account id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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. + */ + getWithHttpOperationResponse(resourceGroupName, automationAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the linked workspace for the account id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account 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 {LinkedWorkspace} - 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 LinkedWorkspace} 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, automationAccountName, 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, automationAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, automationAccountName, options, optionalCallback); + } + } + +} + +module.exports = LinkedWorkspaceOperations; diff --git a/lib/services/automationManagement/lib/operations/moduleOperations.js b/lib/services/automationManagement/lib/operations/moduleOperations.js index 99ee8c08be..132b237c66 100644 --- a/lib/services/automationManagement/lib/operations/moduleOperations.js +++ b/lib/services/automationManagement/lib/operations/moduleOperations.js @@ -17,7 +17,7 @@ const WebResource = msRest.WebResource; /** * Delete the module by name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -50,12 +50,21 @@ function _deleteMethod(resourceGroupName, automationAccountName, moduleName, opt if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -70,9 +79,6 @@ function _deleteMethod(resourceGroupName, automationAccountName, moduleName, opt 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -88,7 +94,7 @@ function _deleteMethod(resourceGroupName, automationAccountName, moduleName, opt requestUrl = requestUrl.replace('{moduleName}', encodeURIComponent(moduleName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -157,7 +163,7 @@ function _deleteMethod(resourceGroupName, automationAccountName, moduleName, opt /** * Retrieve the module identified by module name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -191,12 +197,21 @@ function _get(resourceGroupName, automationAccountName, moduleName, options, cal if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -211,9 +226,6 @@ function _get(resourceGroupName, automationAccountName, moduleName, options, cal 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -229,7 +241,7 @@ function _get(resourceGroupName, automationAccountName, moduleName, options, cal requestUrl = requestUrl.replace('{moduleName}', encodeURIComponent(moduleName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -315,7 +327,7 @@ function _get(resourceGroupName, automationAccountName, moduleName, options, cal /** * Create or Update the module identified by module name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -375,12 +387,21 @@ function _createOrUpdate(resourceGroupName, automationAccountName, moduleName, p if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -398,9 +419,6 @@ function _createOrUpdate(resourceGroupName, automationAccountName, moduleName, p 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -416,7 +434,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, moduleName, p requestUrl = requestUrl.replace('{moduleName}', encodeURIComponent(moduleName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -462,7 +480,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, moduleName, p return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 201 && statusCode !== 200) { + if (statusCode !== 200 && statusCode !== 201) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -492,7 +510,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, moduleName, p let result = null; if (responseBody === '') responseBody = null; // Deserialize Response - if (statusCode === 201) { + if (statusCode === 200) { let parsedResponse = null; try { parsedResponse = JSON.parse(responseBody); @@ -509,7 +527,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, moduleName, p } } // Deserialize Response - if (statusCode === 200) { + if (statusCode === 201) { let parsedResponse = null; try { parsedResponse = JSON.parse(responseBody); @@ -533,7 +551,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, moduleName, p /** * Update the module identified by module name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -594,12 +612,21 @@ function _update(resourceGroupName, automationAccountName, moduleName, parameter if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -617,9 +644,6 @@ function _update(resourceGroupName, automationAccountName, moduleName, parameter 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -635,7 +659,7 @@ function _update(resourceGroupName, automationAccountName, moduleName, parameter requestUrl = requestUrl.replace('{moduleName}', encodeURIComponent(moduleName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -735,7 +759,7 @@ function _update(resourceGroupName, automationAccountName, moduleName, parameter /** * Retrieve a list of modules. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -767,12 +791,21 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -784,9 +817,6 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -801,7 +831,7 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1031,7 +1061,7 @@ class ModuleOperations { /** * Delete the module by name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1065,7 +1095,7 @@ class ModuleOperations { /** * Delete the module by name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1120,7 +1150,7 @@ class ModuleOperations { /** * Retrieve the module identified by module name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1154,7 +1184,7 @@ class ModuleOperations { /** * Retrieve the module identified by module name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1210,7 +1240,7 @@ class ModuleOperations { /** * Create or Update the module identified by module name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1270,7 +1300,7 @@ class ModuleOperations { /** * Create or Update the module identified by module name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1352,7 +1382,7 @@ class ModuleOperations { /** * Update the module identified by module name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1413,7 +1443,7 @@ class ModuleOperations { /** * Update the module identified by module name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1496,7 +1526,7 @@ class ModuleOperations { /** * Retrieve a list of modules. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1528,7 +1558,7 @@ class ModuleOperations { /** * Retrieve a list of modules. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * diff --git a/lib/services/automationManagement/lib/operations/nodeReports.js b/lib/services/automationManagement/lib/operations/nodeReports.js index 1a33c45841..337c9fd0a0 100644 --- a/lib/services/automationManagement/lib/operations/nodeReports.js +++ b/lib/services/automationManagement/lib/operations/nodeReports.js @@ -17,9 +17,9 @@ const WebResource = msRest.WebResource; /** * Retrieve the Dsc node report list by node id. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {string} nodeId The parameters supplied to the list operation. * @@ -55,12 +55,21 @@ function _listByNode(resourceGroupName, automationAccountName, nodeId, options, throw new Error('callback cannot be null.'); } let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let apiVersion = '2018-01-15'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -78,9 +87,6 @@ function _listByNode(resourceGroupName, automationAccountName, nodeId, options, 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -99,7 +105,7 @@ function _listByNode(resourceGroupName, automationAccountName, nodeId, options, if (filter !== null && filter !== undefined) { queryParameters.push('$filter=' + encodeURIComponent(filter)); } - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -185,9 +191,9 @@ function _listByNode(resourceGroupName, automationAccountName, nodeId, options, /** * Retrieve the Dsc node report data by node id and report id. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {string} nodeId The Dsc node id. * @@ -221,12 +227,21 @@ function _get(resourceGroupName, automationAccountName, nodeId, reportId, option if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2018-01-15'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -244,9 +259,6 @@ function _get(resourceGroupName, automationAccountName, nodeId, reportId, option 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -263,7 +275,7 @@ function _get(resourceGroupName, automationAccountName, nodeId, reportId, option requestUrl = requestUrl.replace('{reportId}', encodeURIComponent(reportId)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -349,9 +361,9 @@ function _get(resourceGroupName, automationAccountName, nodeId, reportId, option /** * Retrieve the Dsc node reports by node id and report id. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {string} nodeId The Dsc node id. * @@ -384,12 +396,21 @@ function _getContent(resourceGroupName, automationAccountName, nodeId, reportId, if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2018-01-15'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -407,9 +428,6 @@ function _getContent(resourceGroupName, automationAccountName, nodeId, reportId, 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -426,7 +444,7 @@ function _getContent(resourceGroupName, automationAccountName, nodeId, reportId, requestUrl = requestUrl.replace('{reportId}', encodeURIComponent(reportId)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -453,22 +471,20 @@ function _getContent(resourceGroupName, automationAccountName, nodeId, reportId, } httpRequest.body = null; // Send Request - httpRequest.streamedResponse = true; return client.pipeline(httpRequest, (err, response, responseBody) => { if (err) { return callback(err); } - let statusCode = response.statusCode; if (statusCode !== 200) { - let error = new Error(`Unexpected status code: ${statusCode}`); + 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 { - if (responseBody !== undefined) parsedErrorResponse = JSON.parse(responseBody); + parsedErrorResponse = JSON.parse(responseBody); if (parsedErrorResponse) { let internalError = null; if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; @@ -486,9 +502,33 @@ function _getContent(resourceGroupName, automationAccountName, nodeId, reportId, } return callback(error); } - // Create Result - let result = response; + 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 = { + required: false, + serializedName: 'parsedResponse', + type: { + name: 'Object' + } + }; + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + return callback(null, result, httpRequest, response); }); } @@ -639,9 +679,9 @@ class NodeReports { /** * Retrieve the Dsc node report list by node id. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {string} nodeId The parameters supplied to the list operation. * @@ -675,9 +715,9 @@ class NodeReports { /** * Retrieve the Dsc node report list by node id. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {string} nodeId The parameters supplied to the list operation. * @@ -734,9 +774,9 @@ class NodeReports { /** * Retrieve the Dsc node report data by node id and report id. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {string} nodeId The Dsc node id. * @@ -770,9 +810,9 @@ class NodeReports { /** * Retrieve the Dsc node report data by node id and report id. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {string} nodeId The Dsc node id. * @@ -828,9 +868,9 @@ class NodeReports { /** * Retrieve the Dsc node reports by node id and report id. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {string} nodeId The Dsc node id. * @@ -864,9 +904,9 @@ class NodeReports { /** * Retrieve the Dsc node reports by node id and report id. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * - * @param {string} automationAccountName The automation account name. + * @param {string} automationAccountName The name of the automation account. * * @param {string} nodeId The Dsc node id. * diff --git a/lib/services/automationManagement/lib/operations/objectDataTypes.js b/lib/services/automationManagement/lib/operations/objectDataTypes.js index 0155911b8c..602b0aff15 100644 --- a/lib/services/automationManagement/lib/operations/objectDataTypes.js +++ b/lib/services/automationManagement/lib/operations/objectDataTypes.js @@ -17,7 +17,7 @@ const WebResource = msRest.WebResource; /** * Retrieve a list of fields of a given type identified by module name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -53,12 +53,21 @@ function _listFieldsByModuleAndType(resourceGroupName, automationAccountName, mo if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -76,9 +85,6 @@ function _listFieldsByModuleAndType(resourceGroupName, automationAccountName, mo 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -95,7 +101,7 @@ function _listFieldsByModuleAndType(resourceGroupName, automationAccountName, mo requestUrl = requestUrl.replace('{typeName}', encodeURIComponent(typeName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -181,7 +187,7 @@ function _listFieldsByModuleAndType(resourceGroupName, automationAccountName, mo /** * Retrieve a list of fields of a given type across all accessible modules. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -215,12 +221,21 @@ function _listFieldsByType(resourceGroupName, automationAccountName, typeName, o if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -235,9 +250,6 @@ function _listFieldsByType(resourceGroupName, automationAccountName, typeName, o 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -253,7 +265,7 @@ function _listFieldsByType(resourceGroupName, automationAccountName, typeName, o requestUrl = requestUrl.replace('{typeName}', encodeURIComponent(typeName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -351,7 +363,7 @@ class ObjectDataTypes { /** * Retrieve a list of fields of a given type identified by module name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -387,7 +399,7 @@ class ObjectDataTypes { /** * Retrieve a list of fields of a given type identified by module name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -445,7 +457,7 @@ class ObjectDataTypes { /** * Retrieve a list of fields of a given type across all accessible modules. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -479,7 +491,7 @@ class ObjectDataTypes { /** * Retrieve a list of fields of a given type across all accessible modules. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * diff --git a/lib/services/automationManagement/lib/operations/operations.js b/lib/services/automationManagement/lib/operations/operations.js index 413be0f936..f7b6c1a8fb 100644 --- a/lib/services/automationManagement/lib/operations/operations.js +++ b/lib/services/automationManagement/lib/operations/operations.js @@ -45,11 +45,9 @@ function _list(options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -61,7 +59,7 @@ function _list(options, callback) { let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'providers/Microsoft.Automation/operations'; let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } diff --git a/lib/services/automationManagement/lib/operations/runbookDraftOperations.js b/lib/services/automationManagement/lib/operations/runbookDraftOperations.js index 314add164e..49787465b5 100644 --- a/lib/services/automationManagement/lib/operations/runbookDraftOperations.js +++ b/lib/services/automationManagement/lib/operations/runbookDraftOperations.js @@ -17,7 +17,7 @@ const WebResource = msRest.WebResource; /** * Retrieve the content of runbook draft identified by runbook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -34,7 +34,7 @@ const WebResource = msRest.WebResource; * * {Error} err - The Error object if an error occurred, null otherwise. * - * {object} [result] - The deserialized result object if an error did not occur. + * {string} [result] - The deserialized result object if an error did not occur. * * {object} [request] - The HTTP Request object if an error did not occur. * @@ -50,12 +50,24 @@ function _getContent(resourceGroupName, automationAccountName, runbookName, opti if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -67,12 +79,6 @@ function _getContent(resourceGroupName, automationAccountName, runbookName, opti if (runbookName === null || runbookName === undefined || typeof runbookName.valueOf() !== 'string') { throw new Error('runbookName cannot be null or undefined and it must be of type string.'); } - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -83,12 +89,12 @@ function _getContent(resourceGroupName, automationAccountName, runbookName, opti // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/content'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); requestUrl = requestUrl.replace('{runbookName}', encodeURIComponent(runbookName)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -115,30 +121,27 @@ function _getContent(resourceGroupName, automationAccountName, runbookName, opti } httpRequest.body = null; // Send Request - httpRequest.streamedResponse = true; return client.pipeline(httpRequest, (err, response, responseBody) => { if (err) { return callback(err); } - let statusCode = response.statusCode; if (statusCode !== 200) { - let error = new Error(`Unexpected status code: ${statusCode}`); + 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 { - if (responseBody !== undefined) parsedErrorResponse = JSON.parse(responseBody); + 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.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['ErrorResponse']().mapper(); + let resultMapper = new client.models['CloudError']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -148,24 +151,48 @@ function _getContent(resourceGroupName, automationAccountName, runbookName, opti } return callback(error); } - // Create Result - let result = response; + 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 = { + required: false, + serializedName: 'parsedResponse', + type: { + name: 'String' + } + }; + 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); }); } /** - * Updates the runbook draft with runbookStream as its content. + * Replaces the runbook draft content. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * * @param {string} runbookName The runbook name. * - * @param {object} runbookContent The runbook draft content. + * @param {string} runbookContent The runbook draft content. * * @param {object} [options] Optional Parameters. * @@ -178,13 +205,13 @@ function _getContent(resourceGroupName, automationAccountName, runbookName, opti * * {Error} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {string} [result] - The deserialized result object if an error did not occur. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _createOrUpdate(resourceGroupName, automationAccountName, runbookName, runbookContent, options, callback) { +function _replaceContent(resourceGroupName, automationAccountName, runbookName, runbookContent, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -197,7 +224,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, runbookName, } // Send request - this.beginCreateOrUpdate(resourceGroupName, automationAccountName, runbookName, runbookContent, options, (err, parsedResult, httpRequest, response) => { + this.beginReplaceContent(resourceGroupName, automationAccountName, runbookName, runbookContent, options, (err, parsedResult, httpRequest, response) => { if (err) return callback(err); let initialResult = new msRest.HttpOperationResponse(); @@ -216,6 +243,26 @@ function _createOrUpdate(resourceGroupName, automationAccountName, runbookName, if (responseBody === '') responseBody = null; // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = { + required: false, + serializedName: 'parsedResponse', + type: { + name: 'String' + } + }; + 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); }); @@ -225,7 +272,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, runbookName, /** * Retrieve the runbook draft identified by runbook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -259,12 +306,24 @@ function _get(resourceGroupName, automationAccountName, runbookName, options, ca if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -276,12 +335,6 @@ function _get(resourceGroupName, automationAccountName, runbookName, options, ca if (runbookName === null || runbookName === undefined || typeof runbookName.valueOf() !== 'string') { throw new Error('runbookName cannot be null or undefined and it must be of type string.'); } - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -292,12 +345,12 @@ function _get(resourceGroupName, automationAccountName, runbookName, options, ca // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); requestUrl = requestUrl.replace('{runbookName}', encodeURIComponent(runbookName)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -384,7 +437,7 @@ function _get(resourceGroupName, automationAccountName, runbookName, options, ca /** * Publish runbook draft. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -402,8 +455,7 @@ function _get(resourceGroupName, automationAccountName, runbookName, options, ca * * {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 Runbook} for more information. + * {string} [result] - The deserialized result object if an error did not occur. * * {object} [request] - The HTTP Request object if an error did not occur. * @@ -446,7 +498,13 @@ function _publish(resourceGroupName, automationAccountName, runbookName, options parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['Runbook']().mapper(); + let resultMapper = { + required: false, + serializedName: 'parsedResponse', + type: { + name: 'String' + } + }; result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -462,9 +520,9 @@ function _publish(resourceGroupName, automationAccountName, runbookName, options } /** - * Retrieve the runbook identified by runbook name. + * Undo draft edit to last known published state identified by runbook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -499,12 +557,24 @@ function _undoEdit(resourceGroupName, automationAccountName, runbookName, option if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -516,12 +586,6 @@ function _undoEdit(resourceGroupName, automationAccountName, runbookName, option if (runbookName === null || runbookName === undefined || typeof runbookName.valueOf() !== 'string') { throw new Error('runbookName cannot be null or undefined and it must be of type string.'); } - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -532,12 +596,12 @@ function _undoEdit(resourceGroupName, automationAccountName, runbookName, option // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/undoEdit'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); requestUrl = requestUrl.replace('{runbookName}', encodeURIComponent(runbookName)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -621,15 +685,15 @@ function _undoEdit(resourceGroupName, automationAccountName, runbookName, option } /** - * Updates the runbook draft with runbookStream as its content. + * Replaces the runbook draft content. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * * @param {string} runbookName The runbook name. * - * @param {object} runbookContent The runbook draft content. + * @param {string} runbookContent The runbook draft content. * * @param {object} [options] Optional Parameters. * @@ -642,13 +706,13 @@ function _undoEdit(resourceGroupName, automationAccountName, runbookName, option * * {Error} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {string} [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 _beginCreateOrUpdate(resourceGroupName, automationAccountName, runbookName, runbookContent, options, callback) { +function _beginReplaceContent(resourceGroupName, automationAccountName, runbookName, runbookContent, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -658,12 +722,24 @@ function _beginCreateOrUpdate(resourceGroupName, automationAccountName, runbookN if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -675,14 +751,8 @@ function _beginCreateOrUpdate(resourceGroupName, automationAccountName, runbookN if (runbookName === null || runbookName === undefined || typeof runbookName.valueOf() !== 'string') { throw new Error('runbookName cannot be null or undefined and it must be of type string.'); } - if (runbookContent === null || runbookContent === undefined) { - throw new Error('runbookContent cannot be null or undefined and it must be of type object.'); - } - 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + if (runbookContent === null || runbookContent === undefined || typeof runbookContent.valueOf() !== 'string') { + throw new Error('runbookContent 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.'); @@ -694,12 +764,12 @@ function _beginCreateOrUpdate(resourceGroupName, automationAccountName, runbookN // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/content'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); requestUrl = requestUrl.replace('{runbookName}', encodeURIComponent(runbookName)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -710,7 +780,7 @@ function _beginCreateOrUpdate(resourceGroupName, automationAccountName, runbookN httpRequest.url = requestUrl; httpRequest.headers = {}; // Set Headers - httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + httpRequest.headers['Content-Type'] = 'text/powershell'; if (this.client.generateClientRequestId) { httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); } @@ -725,7 +795,25 @@ function _beginCreateOrUpdate(resourceGroupName, automationAccountName, runbookN } } // Serialize Request - let requestContent = runbookContent; + let requestContent = null; + let requestModel = null; + try { + if (runbookContent !== null && runbookContent !== undefined) { + let requestModelMapper = { + required: true, + serializedName: 'runbookContent', + type: { + name: 'String' + } + }; + requestModel = client.serialize(requestModelMapper, runbookContent, 'runbookContent'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(runbookContent, null, 2)}.`); + return callback(serializationError); + } httpRequest.body = requestContent; // Send Request return client.pipeline(httpRequest, (err, response, responseBody) => { @@ -733,7 +821,7 @@ function _beginCreateOrUpdate(resourceGroupName, automationAccountName, runbookN return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 202 && statusCode !== 200) { + if (statusCode !== 200 && statusCode !== 202) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -762,6 +850,29 @@ function _beginCreateOrUpdate(resourceGroupName, automationAccountName, runbookN // 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 = { + required: false, + serializedName: 'parsedResponse', + type: { + name: 'String' + } + }; + 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); }); @@ -770,7 +881,7 @@ function _beginCreateOrUpdate(resourceGroupName, automationAccountName, runbookN /** * Publish runbook draft. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -788,8 +899,7 @@ function _beginCreateOrUpdate(resourceGroupName, automationAccountName, runbookN * * {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 Runbook} for more information. + * {string} [result] - The deserialized result object if an error did not occur. * * {object} [request] - The HTTP Request object if an error did not occur. * @@ -805,12 +915,24 @@ function _beginPublish(resourceGroupName, automationAccountName, runbookName, op if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -822,12 +944,6 @@ function _beginPublish(resourceGroupName, automationAccountName, runbookName, op if (runbookName === null || runbookName === undefined || typeof runbookName.valueOf() !== 'string') { throw new Error('runbookName cannot be null or undefined and it must be of type string.'); } - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -838,12 +954,12 @@ function _beginPublish(resourceGroupName, automationAccountName, runbookName, op // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/publish'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); requestUrl = requestUrl.replace('{runbookName}', encodeURIComponent(runbookName)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -875,7 +991,7 @@ function _beginPublish(resourceGroupName, automationAccountName, runbookName, op return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 202 && statusCode !== 200) { + if (statusCode !== 200 && statusCode !== 202) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -911,7 +1027,13 @@ function _beginPublish(resourceGroupName, automationAccountName, runbookName, op parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['Runbook']().mapper(); + let resultMapper = { + required: false, + serializedName: 'parsedResponse', + type: { + name: 'String' + } + }; result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -935,18 +1057,18 @@ class RunbookDraftOperations { constructor(client) { this.client = client; this._getContent = _getContent; - this._createOrUpdate = _createOrUpdate; + this._replaceContent = _replaceContent; this._get = _get; this._publish = _publish; this._undoEdit = _undoEdit; - this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginReplaceContent = _beginReplaceContent; this._beginPublish = _beginPublish; } /** * Retrieve the content of runbook draft identified by runbook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -959,7 +1081,7 @@ class RunbookDraftOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ @@ -980,7 +1102,7 @@ class RunbookDraftOperations { /** * Retrieve the content of runbook draft identified by runbook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -998,7 +1120,7 @@ class RunbookDraftOperations { * * {Promise} A promise is returned * - * @resolve {Object} - The deserialized result object. + * @resolve {String} - The deserialized result object. * * @reject {Error} - The error object. * @@ -1006,7 +1128,7 @@ class RunbookDraftOperations { * * {Error} err - The Error object if an error occurred, null otherwise. * - * {object} [result] - The deserialized result object if an error did not occur. + * {string} [result] - The deserialized result object if an error did not occur. * * {object} [request] - The HTTP Request object if an error did not occur. * @@ -1033,15 +1155,15 @@ class RunbookDraftOperations { } /** - * Updates the runbook draft with runbookStream as its content. + * Replaces the runbook draft content. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * * @param {string} runbookName The runbook name. * - * @param {object} runbookContent The runbook draft content. + * @param {string} runbookContent The runbook draft content. * * @param {object} [options] Optional Parameters. * @@ -1050,15 +1172,15 @@ class RunbookDraftOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - createOrUpdateWithHttpOperationResponse(resourceGroupName, automationAccountName, runbookName, runbookContent, options) { + replaceContentWithHttpOperationResponse(resourceGroupName, automationAccountName, runbookName, runbookContent, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._createOrUpdate(resourceGroupName, automationAccountName, runbookName, runbookContent, options, (err, result, request, response) => { + self._replaceContent(resourceGroupName, automationAccountName, runbookName, runbookContent, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -1069,15 +1191,15 @@ class RunbookDraftOperations { } /** - * Updates the runbook draft with runbookStream as its content. + * Replaces the runbook draft content. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * * @param {string} runbookName The runbook name. * - * @param {object} runbookContent The runbook draft content. + * @param {string} runbookContent The runbook draft content. * * @param {object} [options] Optional Parameters. * @@ -1091,7 +1213,7 @@ class RunbookDraftOperations { * * {Promise} A promise is returned * - * @resolve {null} - The deserialized result object. + * @resolve {String} - The deserialized result object. * * @reject {Error} - The error object. * @@ -1099,13 +1221,13 @@ class RunbookDraftOperations { * * {Error} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {string} [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. */ - createOrUpdate(resourceGroupName, automationAccountName, runbookName, runbookContent, options, optionalCallback) { + replaceContent(resourceGroupName, automationAccountName, runbookName, runbookContent, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -1114,21 +1236,21 @@ class RunbookDraftOperations { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._createOrUpdate(resourceGroupName, automationAccountName, runbookName, runbookContent, options, (err, result, request, response) => { + self._replaceContent(resourceGroupName, automationAccountName, runbookName, runbookContent, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._createOrUpdate(resourceGroupName, automationAccountName, runbookName, runbookContent, options, optionalCallback); + return self._replaceContent(resourceGroupName, automationAccountName, runbookName, runbookContent, options, optionalCallback); } } /** * Retrieve the runbook draft identified by runbook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1162,7 +1284,7 @@ class RunbookDraftOperations { /** * Retrieve the runbook draft identified by runbook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1218,7 +1340,7 @@ class RunbookDraftOperations { /** * Publish runbook draft. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1232,7 +1354,7 @@ class RunbookDraftOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ @@ -1253,7 +1375,7 @@ class RunbookDraftOperations { /** * Publish runbook draft. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1272,7 +1394,7 @@ class RunbookDraftOperations { * * {Promise} A promise is returned * - * @resolve {Runbook} - The deserialized result object. + * @resolve {String} - The deserialized result object. * * @reject {Error} - The error object. * @@ -1280,8 +1402,7 @@ class RunbookDraftOperations { * * {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 Runbook} for more information. + * {string} [result] - The deserialized result object if an error did not occur. * * {object} [request] - The HTTP Request object if an error did not occur. * @@ -1308,9 +1429,9 @@ class RunbookDraftOperations { } /** - * Retrieve the runbook identified by runbook name. + * Undo draft edit to last known published state identified by runbook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1342,9 +1463,9 @@ class RunbookDraftOperations { } /** - * Retrieve the runbook identified by runbook name. + * Undo draft edit to last known published state identified by runbook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1399,15 +1520,15 @@ class RunbookDraftOperations { } /** - * Updates the runbook draft with runbookStream as its content. + * Replaces the runbook draft content. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * * @param {string} runbookName The runbook name. * - * @param {object} runbookContent The runbook draft content. + * @param {string} runbookContent The runbook draft content. * * @param {object} [options] Optional Parameters. * @@ -1416,15 +1537,15 @@ class RunbookDraftOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, automationAccountName, runbookName, runbookContent, options) { + beginReplaceContentWithHttpOperationResponse(resourceGroupName, automationAccountName, runbookName, runbookContent, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._beginCreateOrUpdate(resourceGroupName, automationAccountName, runbookName, runbookContent, options, (err, result, request, response) => { + self._beginReplaceContent(resourceGroupName, automationAccountName, runbookName, runbookContent, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -1435,15 +1556,15 @@ class RunbookDraftOperations { } /** - * Updates the runbook draft with runbookStream as its content. + * Replaces the runbook draft content. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * * @param {string} runbookName The runbook name. * - * @param {object} runbookContent The runbook draft content. + * @param {string} runbookContent The runbook draft content. * * @param {object} [options] Optional Parameters. * @@ -1457,7 +1578,7 @@ class RunbookDraftOperations { * * {Promise} A promise is returned * - * @resolve {null} - The deserialized result object. + * @resolve {String} - The deserialized result object. * * @reject {Error} - The error object. * @@ -1465,13 +1586,13 @@ class RunbookDraftOperations { * * {Error} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {string} [result] - The deserialized result object if an error did not occur. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - beginCreateOrUpdate(resourceGroupName, automationAccountName, runbookName, runbookContent, options, optionalCallback) { + beginReplaceContent(resourceGroupName, automationAccountName, runbookName, runbookContent, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -1480,21 +1601,21 @@ class RunbookDraftOperations { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._beginCreateOrUpdate(resourceGroupName, automationAccountName, runbookName, runbookContent, options, (err, result, request, response) => { + self._beginReplaceContent(resourceGroupName, automationAccountName, runbookName, runbookContent, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._beginCreateOrUpdate(resourceGroupName, automationAccountName, runbookName, runbookContent, options, optionalCallback); + return self._beginReplaceContent(resourceGroupName, automationAccountName, runbookName, runbookContent, options, optionalCallback); } } /** * Publish runbook draft. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1508,7 +1629,7 @@ class RunbookDraftOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ @@ -1529,7 +1650,7 @@ class RunbookDraftOperations { /** * Publish runbook draft. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1548,7 +1669,7 @@ class RunbookDraftOperations { * * {Promise} A promise is returned * - * @resolve {Runbook} - The deserialized result object. + * @resolve {String} - The deserialized result object. * * @reject {Error} - The error object. * @@ -1556,8 +1677,7 @@ class RunbookDraftOperations { * * {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 Runbook} for more information. + * {string} [result] - The deserialized result object if an error did not occur. * * {object} [request] - The HTTP Request object if an error did not occur. * diff --git a/lib/services/automationManagement/lib/operations/runbookOperations.js b/lib/services/automationManagement/lib/operations/runbookOperations.js index 337773ce4f..5880429498 100644 --- a/lib/services/automationManagement/lib/operations/runbookOperations.js +++ b/lib/services/automationManagement/lib/operations/runbookOperations.js @@ -17,7 +17,7 @@ const WebResource = msRest.WebResource; /** * Retrieve the content of runbook identified by runbook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -34,7 +34,7 @@ const WebResource = msRest.WebResource; * * {Error} err - The Error object if an error occurred, null otherwise. * - * {object} [result] - The deserialized result object if an error did not occur. + * {string} [result] - The deserialized result object if an error did not occur. * * {object} [request] - The HTTP Request object if an error did not occur. * @@ -50,12 +50,24 @@ function _getContent(resourceGroupName, automationAccountName, runbookName, opti if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -67,12 +79,6 @@ function _getContent(resourceGroupName, automationAccountName, runbookName, opti if (runbookName === null || runbookName === undefined || typeof runbookName.valueOf() !== 'string') { throw new Error('runbookName cannot be null or undefined and it must be of type string.'); } - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -83,12 +89,12 @@ function _getContent(resourceGroupName, automationAccountName, runbookName, opti // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/content'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); requestUrl = requestUrl.replace('{runbookName}', encodeURIComponent(runbookName)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -115,30 +121,27 @@ function _getContent(resourceGroupName, automationAccountName, runbookName, opti } httpRequest.body = null; // Send Request - httpRequest.streamedResponse = true; return client.pipeline(httpRequest, (err, response, responseBody) => { if (err) { return callback(err); } - let statusCode = response.statusCode; if (statusCode !== 200) { - let error = new Error(`Unexpected status code: ${statusCode}`); + 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 { - if (responseBody !== undefined) parsedErrorResponse = JSON.parse(responseBody); + 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.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['ErrorResponse']().mapper(); + let resultMapper = new client.models['CloudError']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -148,9 +151,33 @@ function _getContent(resourceGroupName, automationAccountName, runbookName, opti } return callback(error); } - // Create Result - let result = response; + 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 = { + required: false, + serializedName: 'parsedResponse', + type: { + name: 'String' + } + }; + 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); }); } @@ -158,7 +185,7 @@ function _getContent(resourceGroupName, automationAccountName, runbookName, opti /** * Retrieve the runbook identified by runbook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -192,12 +219,24 @@ function _get(resourceGroupName, automationAccountName, runbookName, options, ca if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -209,12 +248,6 @@ function _get(resourceGroupName, automationAccountName, runbookName, options, ca if (runbookName === null || runbookName === undefined || typeof runbookName.valueOf() !== 'string') { throw new Error('runbookName cannot be null or undefined and it must be of type string.'); } - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -225,12 +258,12 @@ function _get(resourceGroupName, automationAccountName, runbookName, options, ca // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); requestUrl = requestUrl.replace('{runbookName}', encodeURIComponent(runbookName)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -316,7 +349,7 @@ function _get(resourceGroupName, automationAccountName, runbookName, options, ca /** * Create the runbook identified by runbook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -397,7 +430,8 @@ function _get(resourceGroupName, automationAccountName, runbookName, options, ca * * {Error} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Runbook} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * @@ -413,12 +447,24 @@ function _createOrUpdate(resourceGroupName, automationAccountName, runbookName, if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -433,12 +479,6 @@ function _createOrUpdate(resourceGroupName, automationAccountName, runbookName, if (parameters === null || parameters === undefined) { throw new Error('parameters cannot be null or undefined.'); } - 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -449,12 +489,12 @@ function _createOrUpdate(resourceGroupName, automationAccountName, runbookName, // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); requestUrl = requestUrl.replace('{runbookName}', encodeURIComponent(runbookName)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -529,6 +569,40 @@ function _createOrUpdate(resourceGroupName, automationAccountName, runbookName, // 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['Runbook']().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['Runbook']().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); }); @@ -537,7 +611,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, runbookName, /** * Update the runbook identified by runbook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -591,12 +665,24 @@ function _update(resourceGroupName, automationAccountName, runbookName, paramete if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -611,12 +697,6 @@ function _update(resourceGroupName, automationAccountName, runbookName, paramete if (parameters === null || parameters === undefined) { throw new Error('parameters cannot be null or undefined.'); } - 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -627,12 +707,12 @@ function _update(resourceGroupName, automationAccountName, runbookName, paramete // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); requestUrl = requestUrl.replace('{runbookName}', encodeURIComponent(runbookName)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -732,7 +812,7 @@ function _update(resourceGroupName, automationAccountName, runbookName, paramete /** * Delete the runbook by name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -765,12 +845,24 @@ function _deleteMethod(resourceGroupName, automationAccountName, runbookName, op if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -782,12 +874,6 @@ function _deleteMethod(resourceGroupName, automationAccountName, runbookName, op if (runbookName === null || runbookName === undefined || typeof runbookName.valueOf() !== 'string') { throw new Error('runbookName cannot be null or undefined and it must be of type string.'); } - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -798,12 +884,12 @@ function _deleteMethod(resourceGroupName, automationAccountName, runbookName, op // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); requestUrl = requestUrl.replace('{runbookName}', encodeURIComponent(runbookName)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -835,7 +921,7 @@ function _deleteMethod(resourceGroupName, automationAccountName, runbookName, op return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200) { + if (statusCode !== 200 && statusCode !== 204) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -872,7 +958,7 @@ function _deleteMethod(resourceGroupName, automationAccountName, runbookName, op /** * Retrieve a list of runbooks. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -904,12 +990,24 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -918,12 +1016,6 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); } - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -934,11 +1026,11 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1169,7 +1261,7 @@ class RunbookOperations { /** * Retrieve the content of runbook identified by runbook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1182,7 +1274,7 @@ class RunbookOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ @@ -1203,7 +1295,7 @@ class RunbookOperations { /** * Retrieve the content of runbook identified by runbook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1221,7 +1313,7 @@ class RunbookOperations { * * {Promise} A promise is returned * - * @resolve {Object} - The deserialized result object. + * @resolve {String} - The deserialized result object. * * @reject {Error} - The error object. * @@ -1229,7 +1321,7 @@ class RunbookOperations { * * {Error} err - The Error object if an error occurred, null otherwise. * - * {object} [result] - The deserialized result object if an error did not occur. + * {string} [result] - The deserialized result object if an error did not occur. * * {object} [request] - The HTTP Request object if an error did not occur. * @@ -1258,7 +1350,7 @@ class RunbookOperations { /** * Retrieve the runbook identified by runbook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1292,7 +1384,7 @@ class RunbookOperations { /** * Retrieve the runbook identified by runbook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1348,7 +1440,7 @@ class RunbookOperations { /** * Create the runbook identified by runbook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1425,7 +1517,7 @@ class RunbookOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ @@ -1446,7 +1538,7 @@ class RunbookOperations { /** * Create the runbook identified by runbook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1528,7 +1620,7 @@ class RunbookOperations { * * {Promise} A promise is returned * - * @resolve {null} - The deserialized result object. + * @resolve {Runbook} - The deserialized result object. * * @reject {Error} - The error object. * @@ -1536,7 +1628,8 @@ class RunbookOperations { * * {Error} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Runbook} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * @@ -1565,7 +1658,7 @@ class RunbookOperations { /** * Update the runbook identified by runbook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1619,7 +1712,7 @@ class RunbookOperations { /** * Update the runbook identified by runbook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1695,7 +1788,7 @@ class RunbookOperations { /** * Delete the runbook by name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1729,7 +1822,7 @@ class RunbookOperations { /** * Delete the runbook by name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1784,7 +1877,7 @@ class RunbookOperations { /** * Retrieve a list of runbooks. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1816,7 +1909,7 @@ class RunbookOperations { /** * Retrieve a list of runbooks. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * diff --git a/lib/services/automationManagement/lib/operations/scheduleOperations.js b/lib/services/automationManagement/lib/operations/scheduleOperations.js index fed9372728..2657038aae 100644 --- a/lib/services/automationManagement/lib/operations/scheduleOperations.js +++ b/lib/services/automationManagement/lib/operations/scheduleOperations.js @@ -17,7 +17,7 @@ const WebResource = msRest.WebResource; /** * Create a schedule. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -40,8 +40,8 @@ const WebResource = msRest.WebResource; * @param {object} [parameters.interval] Gets or sets the interval of the * schedule. * - * @param {string} parameters.frequency Gets or sets the frequency of the - * schedule. Possible values include: 'OneTime', 'Day', 'Hour', 'Week', 'Month' + * @param {string} parameters.frequency Possible values include: 'OneTime', + * 'Day', 'Hour', 'Week', 'Month' * * @param {string} [parameters.timeZone] Gets or sets the time zone of the * schedule. @@ -86,12 +86,21 @@ function _createOrUpdate(resourceGroupName, automationAccountName, scheduleName, if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -109,9 +118,6 @@ function _createOrUpdate(resourceGroupName, automationAccountName, scheduleName, 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -127,7 +133,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, scheduleName, requestUrl = requestUrl.replace('{scheduleName}', encodeURIComponent(scheduleName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -227,7 +233,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, scheduleName, /** * Update the schedule identified by schedule name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -236,7 +242,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, scheduleName, * @param {object} parameters The parameters supplied to the update schedule * operation. * - * @param {string} parameters.name Gets or sets the name of the schedule. + * @param {string} [parameters.name] Gets or sets the name of the schedule. * * @param {string} [parameters.description] Gets or sets the description of the * schedule. @@ -272,12 +278,21 @@ function _update(resourceGroupName, automationAccountName, scheduleName, paramet if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -295,9 +310,6 @@ function _update(resourceGroupName, automationAccountName, scheduleName, paramet 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -313,7 +325,7 @@ function _update(resourceGroupName, automationAccountName, scheduleName, paramet requestUrl = requestUrl.replace('{scheduleName}', encodeURIComponent(scheduleName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -413,7 +425,7 @@ function _update(resourceGroupName, automationAccountName, scheduleName, paramet /** * Retrieve the schedule identified by schedule name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -447,12 +459,21 @@ function _get(resourceGroupName, automationAccountName, scheduleName, options, c if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -467,9 +488,6 @@ function _get(resourceGroupName, automationAccountName, scheduleName, options, c 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -485,7 +503,7 @@ function _get(resourceGroupName, automationAccountName, scheduleName, options, c requestUrl = requestUrl.replace('{scheduleName}', encodeURIComponent(scheduleName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -571,7 +589,7 @@ function _get(resourceGroupName, automationAccountName, scheduleName, options, c /** * Delete the schedule identified by schedule name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -604,12 +622,21 @@ function _deleteMethod(resourceGroupName, automationAccountName, scheduleName, o if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -624,9 +651,6 @@ function _deleteMethod(resourceGroupName, automationAccountName, scheduleName, o 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -642,7 +666,7 @@ function _deleteMethod(resourceGroupName, automationAccountName, scheduleName, o requestUrl = requestUrl.replace('{scheduleName}', encodeURIComponent(scheduleName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -711,7 +735,7 @@ function _deleteMethod(resourceGroupName, automationAccountName, scheduleName, o /** * Retrieve a list of schedules. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -743,12 +767,21 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -760,9 +793,6 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -777,7 +807,7 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1007,7 +1037,7 @@ class ScheduleOperations { /** * Create a schedule. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1030,8 +1060,8 @@ class ScheduleOperations { * @param {object} [parameters.interval] Gets or sets the interval of the * schedule. * - * @param {string} parameters.frequency Gets or sets the frequency of the - * schedule. Possible values include: 'OneTime', 'Day', 'Hour', 'Week', 'Month' + * @param {string} parameters.frequency Possible values include: 'OneTime', + * 'Day', 'Hour', 'Week', 'Month' * * @param {string} [parameters.timeZone] Gets or sets the time zone of the * schedule. @@ -1076,7 +1106,7 @@ class ScheduleOperations { /** * Create a schedule. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1099,8 +1129,8 @@ class ScheduleOperations { * @param {object} [parameters.interval] Gets or sets the interval of the * schedule. * - * @param {string} parameters.frequency Gets or sets the frequency of the - * schedule. Possible values include: 'OneTime', 'Day', 'Hour', 'Week', 'Month' + * @param {string} parameters.frequency Possible values include: 'OneTime', + * 'Day', 'Hour', 'Week', 'Month' * * @param {string} [parameters.timeZone] Gets or sets the time zone of the * schedule. @@ -1167,7 +1197,7 @@ class ScheduleOperations { /** * Update the schedule identified by schedule name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1176,7 +1206,7 @@ class ScheduleOperations { * @param {object} parameters The parameters supplied to the update schedule * operation. * - * @param {string} parameters.name Gets or sets the name of the schedule. + * @param {string} [parameters.name] Gets or sets the name of the schedule. * * @param {string} [parameters.description] Gets or sets the description of the * schedule. @@ -1212,7 +1242,7 @@ class ScheduleOperations { /** * Update the schedule identified by schedule name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1221,7 +1251,7 @@ class ScheduleOperations { * @param {object} parameters The parameters supplied to the update schedule * operation. * - * @param {string} parameters.name Gets or sets the name of the schedule. + * @param {string} [parameters.name] Gets or sets the name of the schedule. * * @param {string} [parameters.description] Gets or sets the description of the * schedule. @@ -1279,7 +1309,7 @@ class ScheduleOperations { /** * Retrieve the schedule identified by schedule name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1313,7 +1343,7 @@ class ScheduleOperations { /** * Retrieve the schedule identified by schedule name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1369,7 +1399,7 @@ class ScheduleOperations { /** * Delete the schedule identified by schedule name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1403,7 +1433,7 @@ class ScheduleOperations { /** * Delete the schedule identified by schedule name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1458,7 +1488,7 @@ class ScheduleOperations { /** * Retrieve a list of schedules. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1490,7 +1520,7 @@ class ScheduleOperations { /** * Retrieve a list of schedules. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * diff --git a/lib/services/automationManagement/lib/operations/softwareUpdateConfigurationMachineRuns.js b/lib/services/automationManagement/lib/operations/softwareUpdateConfigurationMachineRuns.js new file mode 100644 index 0000000000..dd36c0ac40 --- /dev/null +++ b/lib/services/automationManagement/lib/operations/softwareUpdateConfigurationMachineRuns.js @@ -0,0 +1,619 @@ +/* + * 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; + +/** + * Get a single software update configuration machine run by Id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {uuid} softwareUpdateConfigurationMachineRunId The Id of the software + * update configuration machine run. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 SoftwareUpdateConfigurationMachineRun} 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 _getById(resourceGroupName, automationAccountName, softwareUpdateConfigurationMachineRunId, 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 clientRequestId = (options && options.clientRequestId !== undefined) ? options.clientRequestId : undefined; + let apiVersion = '2017-05-15-preview'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (softwareUpdateConfigurationMachineRunId === null || softwareUpdateConfigurationMachineRunId === undefined || typeof softwareUpdateConfigurationMachineRunId.valueOf() !== 'string' || !msRest.isValidUuid(softwareUpdateConfigurationMachineRunId)) { + throw new Error('softwareUpdateConfigurationMachineRunId cannot be null or undefined and it must be of type string and must be a valid uuid.'); + } + if (clientRequestId !== null && clientRequestId !== undefined && typeof clientRequestId.valueOf() !== 'string') { + throw new Error('clientRequestId 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.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurationMachineRuns/{softwareUpdateConfigurationMachineRunId}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{softwareUpdateConfigurationMachineRunId}', encodeURIComponent(softwareUpdateConfigurationMachineRunId.toString())); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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 (clientRequestId !== undefined && clientRequestId !== null) { + httpRequest.headers['clientRequestId'] = clientRequestId; + } + 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 !== 404) { + 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['SoftwareUpdateConfigurationMachineRun']().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); + }); +} + +/** + * Return list of software update configuration machine runs + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @param {string} [options.filter] The filter to apply on the operation. You + * can use the following filters: 'properties/osType', 'properties/status', + * 'properties/startTime', and 'properties/softwareUpdateConfiguration/name' + * + * @param {string} [options.skip] number of entries you skip before returning + * results + * + * @param {string} [options.top] Maximum number of entries returned in the + * results collection + * + * @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 + * SoftwareUpdateConfigurationMachineRunListResult} 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(resourceGroupName, automationAccountName, 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 clientRequestId = (options && options.clientRequestId !== undefined) ? options.clientRequestId : undefined; + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let skip = (options && options.skip !== undefined) ? options.skip : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let apiVersion = '2017-05-15-preview'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (clientRequestId !== null && clientRequestId !== undefined && typeof clientRequestId.valueOf() !== 'string') { + throw new Error('clientRequestId must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (skip !== null && skip !== undefined && typeof skip.valueOf() !== 'string') { + throw new Error('skip must be of type string.'); + } + if (top !== null && top !== undefined && typeof top.valueOf() !== 'string') { + throw new Error('top 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.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurationMachineRuns'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (skip !== null && skip !== undefined) { + queryParameters.push('$skip=' + encodeURIComponent(skip)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top)); + } + 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 (clientRequestId !== undefined && clientRequestId !== null) { + httpRequest.headers['clientRequestId'] = clientRequestId; + } + 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 !== 404) { + 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['SoftwareUpdateConfigurationMachineRunListResult']().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 SoftwareUpdateConfigurationMachineRuns. */ +class SoftwareUpdateConfigurationMachineRuns { + /** + * Create a SoftwareUpdateConfigurationMachineRuns. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._getById = _getById; + this._list = _list; + } + + /** + * Get a single software update configuration machine run by Id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {uuid} softwareUpdateConfigurationMachineRunId The Id of the software + * update configuration machine run. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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. + */ + getByIdWithHttpOperationResponse(resourceGroupName, automationAccountName, softwareUpdateConfigurationMachineRunId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getById(resourceGroupName, automationAccountName, softwareUpdateConfigurationMachineRunId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get a single software update configuration machine run by Id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {uuid} softwareUpdateConfigurationMachineRunId The Id of the software + * update configuration machine run. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 {SoftwareUpdateConfigurationMachineRun} - 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 SoftwareUpdateConfigurationMachineRun} 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. + */ + getById(resourceGroupName, automationAccountName, softwareUpdateConfigurationMachineRunId, 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._getById(resourceGroupName, automationAccountName, softwareUpdateConfigurationMachineRunId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getById(resourceGroupName, automationAccountName, softwareUpdateConfigurationMachineRunId, options, optionalCallback); + } + } + + /** + * Return list of software update configuration machine runs + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @param {string} [options.filter] The filter to apply on the operation. You + * can use the following filters: 'properties/osType', 'properties/status', + * 'properties/startTime', and 'properties/softwareUpdateConfiguration/name' + * + * @param {string} [options.skip] number of entries you skip before returning + * results + * + * @param {string} [options.top] Maximum number of entries returned in the + * results collection + * + * @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(resourceGroupName, automationAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Return list of software update configuration machine runs + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @param {string} [options.filter] The filter to apply on the operation. You + * can use the following filters: 'properties/osType', 'properties/status', + * 'properties/startTime', and 'properties/softwareUpdateConfiguration/name' + * + * @param {string} [options.skip] number of entries you skip before returning + * results + * + * @param {string} [options.top] Maximum number of entries returned in the + * results collection + * + * @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 {SoftwareUpdateConfigurationMachineRunListResult} - 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 + * SoftwareUpdateConfigurationMachineRunListResult} 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(resourceGroupName, automationAccountName, 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(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, automationAccountName, options, optionalCallback); + } + } + +} + +module.exports = SoftwareUpdateConfigurationMachineRuns; diff --git a/lib/services/automationManagement/lib/operations/softwareUpdateConfigurationRuns.js b/lib/services/automationManagement/lib/operations/softwareUpdateConfigurationRuns.js new file mode 100644 index 0000000000..825c7c999e --- /dev/null +++ b/lib/services/automationManagement/lib/operations/softwareUpdateConfigurationRuns.js @@ -0,0 +1,617 @@ +/* + * 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; + +/** + * Get a single software update configuration Run by Id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {uuid} softwareUpdateConfigurationRunId The Id of the software update + * configuration run. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 SoftwareUpdateConfigurationRun} 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 _getById(resourceGroupName, automationAccountName, softwareUpdateConfigurationRunId, 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 clientRequestId = (options && options.clientRequestId !== undefined) ? options.clientRequestId : undefined; + let apiVersion = '2017-05-15-preview'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (softwareUpdateConfigurationRunId === null || softwareUpdateConfigurationRunId === undefined || typeof softwareUpdateConfigurationRunId.valueOf() !== 'string' || !msRest.isValidUuid(softwareUpdateConfigurationRunId)) { + throw new Error('softwareUpdateConfigurationRunId cannot be null or undefined and it must be of type string and must be a valid uuid.'); + } + if (clientRequestId !== null && clientRequestId !== undefined && typeof clientRequestId.valueOf() !== 'string') { + throw new Error('clientRequestId 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.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurationRuns/{softwareUpdateConfigurationRunId}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{softwareUpdateConfigurationRunId}', encodeURIComponent(softwareUpdateConfigurationRunId.toString())); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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 (clientRequestId !== undefined && clientRequestId !== null) { + httpRequest.headers['clientRequestId'] = clientRequestId; + } + 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 !== 404) { + 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['SoftwareUpdateConfigurationRun']().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); + }); +} + +/** + * Return list of software update configuration runs + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @param {string} [options.filter] The filter to apply on the operation. You + * can use the following filters: 'properties/osType', 'properties/status', + * 'properties/startTime', and 'properties/softwareUpdateConfiguration/name' + * + * @param {string} [options.skip] number of entries you skip before returning + * results + * + * @param {string} [options.top] Maximum number of entries returned in the + * results collection + * + * @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 SoftwareUpdateConfigurationRunListResult} + * 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(resourceGroupName, automationAccountName, 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 clientRequestId = (options && options.clientRequestId !== undefined) ? options.clientRequestId : undefined; + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let skip = (options && options.skip !== undefined) ? options.skip : undefined; + let top = (options && options.top !== undefined) ? options.top : undefined; + let apiVersion = '2017-05-15-preview'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (clientRequestId !== null && clientRequestId !== undefined && typeof clientRequestId.valueOf() !== 'string') { + throw new Error('clientRequestId must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (skip !== null && skip !== undefined && typeof skip.valueOf() !== 'string') { + throw new Error('skip must be of type string.'); + } + if (top !== null && top !== undefined && typeof top.valueOf() !== 'string') { + throw new Error('top 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.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurationRuns'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + if (skip !== null && skip !== undefined) { + queryParameters.push('$skip=' + encodeURIComponent(skip)); + } + if (top !== null && top !== undefined) { + queryParameters.push('$top=' + encodeURIComponent(top)); + } + 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 (clientRequestId !== undefined && clientRequestId !== null) { + httpRequest.headers['clientRequestId'] = clientRequestId; + } + 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 !== 404) { + 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['SoftwareUpdateConfigurationRunListResult']().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 SoftwareUpdateConfigurationRuns. */ +class SoftwareUpdateConfigurationRuns { + /** + * Create a SoftwareUpdateConfigurationRuns. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._getById = _getById; + this._list = _list; + } + + /** + * Get a single software update configuration Run by Id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {uuid} softwareUpdateConfigurationRunId The Id of the software update + * configuration run. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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. + */ + getByIdWithHttpOperationResponse(resourceGroupName, automationAccountName, softwareUpdateConfigurationRunId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getById(resourceGroupName, automationAccountName, softwareUpdateConfigurationRunId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get a single software update configuration Run by Id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {uuid} softwareUpdateConfigurationRunId The Id of the software update + * configuration run. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 {SoftwareUpdateConfigurationRun} - 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 SoftwareUpdateConfigurationRun} 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. + */ + getById(resourceGroupName, automationAccountName, softwareUpdateConfigurationRunId, 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._getById(resourceGroupName, automationAccountName, softwareUpdateConfigurationRunId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getById(resourceGroupName, automationAccountName, softwareUpdateConfigurationRunId, options, optionalCallback); + } + } + + /** + * Return list of software update configuration runs + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @param {string} [options.filter] The filter to apply on the operation. You + * can use the following filters: 'properties/osType', 'properties/status', + * 'properties/startTime', and 'properties/softwareUpdateConfiguration/name' + * + * @param {string} [options.skip] number of entries you skip before returning + * results + * + * @param {string} [options.top] Maximum number of entries returned in the + * results collection + * + * @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(resourceGroupName, automationAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Return list of software update configuration runs + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @param {string} [options.filter] The filter to apply on the operation. You + * can use the following filters: 'properties/osType', 'properties/status', + * 'properties/startTime', and 'properties/softwareUpdateConfiguration/name' + * + * @param {string} [options.skip] number of entries you skip before returning + * results + * + * @param {string} [options.top] Maximum number of entries returned in the + * results collection + * + * @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 {SoftwareUpdateConfigurationRunListResult} - 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 SoftwareUpdateConfigurationRunListResult} + * 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(resourceGroupName, automationAccountName, 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(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, automationAccountName, options, optionalCallback); + } + } + +} + +module.exports = SoftwareUpdateConfigurationRuns; diff --git a/lib/services/automationManagement/lib/operations/softwareUpdateConfigurations.js b/lib/services/automationManagement/lib/operations/softwareUpdateConfigurations.js new file mode 100644 index 0000000000..a23fd6b9da --- /dev/null +++ b/lib/services/automationManagement/lib/operations/softwareUpdateConfigurations.js @@ -0,0 +1,1454 @@ +/* + * 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; + +/** + * Create a new software update configuration with the name given in the URI. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} softwareUpdateConfigurationName The name of the software + * update configuration to be created. + * + * @param {object} parameters Request body. + * + * @param {object} parameters.updateConfiguration update specific properties + * for the Software update configuration + * + * @param {string} parameters.updateConfiguration.operatingSystem operating + * system of target machines. Possible values include: 'Windows', 'Linux' + * + * @param {object} [parameters.updateConfiguration.windows] Windows specific + * update configuration. + * + * @param {string} + * [parameters.updateConfiguration.windows.includedUpdateClassifications] + * Update classification included in the software update configuration. A comma + * separated string with required values. Possible values include: + * 'Unclassified', 'Critical', 'Security', 'UpdateRollup', 'FeaturePack', + * 'ServicePack', 'Definition', 'Tools', 'Updates' + * + * @param {array} [parameters.updateConfiguration.windows.excludedKbNumbers] KB + * numbers excluded from the software update configuration. + * + * @param {object} [parameters.updateConfiguration.linux] Linux specific update + * configuration. + * + * @param {string} + * [parameters.updateConfiguration.linux.includedPackageClassifications] Update + * classifications included in the software update configuration. Possible + * values include: 'Unclassified', 'Critical', 'Security', 'Other' + * + * @param {array} + * [parameters.updateConfiguration.linux.excludedPackageNameMasks] packages + * excluded from the software update configuration. + * + * @param {moment.duration} [parameters.updateConfiguration.duration] Maximum + * time allowed for the software update configuration run. Duration needs to be + * specified using the format PT[n]H[n]M[n]S as per ISO8601 + * + * @param {array} [parameters.updateConfiguration.azureVirtualMachines] List of + * azure resource Ids for azure virtual machines targeted by the software + * update configuration. + * + * @param {array} [parameters.updateConfiguration.nonAzureComputerNames] List + * of names of non-azure machines targeted by the software update + * configuration. + * + * @param {object} parameters.scheduleInfo Schedule information for the + * Software update configuration + * + * @param {date} [parameters.scheduleInfo.startTime] Gets or sets the start + * time of the schedule. + * + * @param {date} [parameters.scheduleInfo.expiryTime] Gets or sets the end time + * of the schedule. + * + * @param {number} [parameters.scheduleInfo.expiryTimeOffsetMinutes] Gets or + * sets the expiry time's offset in minutes. + * + * @param {boolean} [parameters.scheduleInfo.isEnabled] Gets or sets a value + * indicating whether this schedule is enabled. + * + * @param {date} [parameters.scheduleInfo.nextRun] Gets or sets the next run + * time of the schedule. + * + * @param {number} [parameters.scheduleInfo.nextRunOffsetMinutes] Gets or sets + * the next run time's offset in minutes. + * + * @param {number} [parameters.scheduleInfo.interval] Gets or sets the interval + * of the schedule. + * + * @param {string} [parameters.scheduleInfo.frequency] Gets or sets the + * frequency of the schedule. Possible values include: 'OneTime', 'Day', + * 'Hour', 'Week', 'Month' + * + * @param {string} [parameters.scheduleInfo.timeZone] Gets or sets the time + * zone of the schedule. + * + * @param {object} [parameters.scheduleInfo.advancedSchedule] Gets or sets the + * advanced schedule. + * + * @param {array} [parameters.scheduleInfo.advancedSchedule.weekDays] Days of + * the week that the job should execute on. + * + * @param {array} [parameters.scheduleInfo.advancedSchedule.monthDays] Days of + * the month that the job should execute on. Must be between 1 and 31. + * + * @param {array} [parameters.scheduleInfo.advancedSchedule.monthlyOccurrences] + * Occurrences of days within a month. + * + * @param {date} [parameters.scheduleInfo.creationTime] Gets or sets the + * creation time. + * + * @param {date} [parameters.scheduleInfo.lastModifiedTime] Gets or sets the + * last modified time. + * + * @param {string} [parameters.scheduleInfo.description] Gets or sets the + * description. + * + * @param {object} [parameters.error] detailes of provisioning error + * + * @param {string} [parameters.error.code] Error code + * + * @param {string} [parameters.error.message] Error message indicating why the + * operation failed. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 SoftwareUpdateConfiguration} 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, automationAccountName, softwareUpdateConfigurationName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let clientRequestId = (options && options.clientRequestId !== undefined) ? options.clientRequestId : undefined; + let apiVersion = '2017-05-15-preview'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (softwareUpdateConfigurationName === null || softwareUpdateConfigurationName === undefined || typeof softwareUpdateConfigurationName.valueOf() !== 'string') { + throw new Error('softwareUpdateConfigurationName cannot be null or undefined and it must be of type string.'); + } + if (clientRequestId !== null && clientRequestId !== undefined && typeof clientRequestId.valueOf() !== 'string') { + throw new Error('clientRequestId must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters 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.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations/{softwareUpdateConfigurationName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{softwareUpdateConfigurationName}', encodeURIComponent(softwareUpdateConfigurationName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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 (clientRequestId !== undefined && clientRequestId !== null) { + httpRequest.headers['clientRequestId'] = clientRequestId; + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['SoftwareUpdateConfiguration']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201 && statusCode !== 400 && statusCode !== 404 && statusCode !== 409) { + 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['SoftwareUpdateConfiguration']().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['SoftwareUpdateConfiguration']().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); + }); +} + +/** + * Get a single software update configuration by name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} softwareUpdateConfigurationName The name of the software + * update configuration to be created. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 SoftwareUpdateConfiguration} 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 _getByName(resourceGroupName, automationAccountName, softwareUpdateConfigurationName, 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 clientRequestId = (options && options.clientRequestId !== undefined) ? options.clientRequestId : undefined; + let apiVersion = '2017-05-15-preview'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (softwareUpdateConfigurationName === null || softwareUpdateConfigurationName === undefined || typeof softwareUpdateConfigurationName.valueOf() !== 'string') { + throw new Error('softwareUpdateConfigurationName cannot be null or undefined and it must be of type string.'); + } + if (clientRequestId !== null && clientRequestId !== undefined && typeof clientRequestId.valueOf() !== 'string') { + throw new Error('clientRequestId 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.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations/{softwareUpdateConfigurationName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{softwareUpdateConfigurationName}', encodeURIComponent(softwareUpdateConfigurationName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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 (clientRequestId !== undefined && clientRequestId !== null) { + httpRequest.headers['clientRequestId'] = clientRequestId; + } + 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 !== 404) { + 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['SoftwareUpdateConfiguration']().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); + }); +} + +/** + * delete a specific software update configuration. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} softwareUpdateConfigurationName The name of the software + * update configuration to be created. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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, automationAccountName, softwareUpdateConfigurationName, 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 clientRequestId = (options && options.clientRequestId !== undefined) ? options.clientRequestId : undefined; + let apiVersion = '2017-05-15-preview'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (softwareUpdateConfigurationName === null || softwareUpdateConfigurationName === undefined || typeof softwareUpdateConfigurationName.valueOf() !== 'string') { + throw new Error('softwareUpdateConfigurationName cannot be null or undefined and it must be of type string.'); + } + if (clientRequestId !== null && clientRequestId !== undefined && typeof clientRequestId.valueOf() !== 'string') { + throw new Error('clientRequestId 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.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations/{softwareUpdateConfigurationName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{softwareUpdateConfigurationName}', encodeURIComponent(softwareUpdateConfigurationName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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 (clientRequestId !== undefined && clientRequestId !== null) { + httpRequest.headers['clientRequestId'] = clientRequestId; + } + 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 && statusCode !== 404) { + 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; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Get all software update configurations for the account. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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 SoftwareUpdateConfigurationListResult} 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(resourceGroupName, automationAccountName, 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 clientRequestId = (options && options.clientRequestId !== undefined) ? options.clientRequestId : undefined; + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let apiVersion = '2017-05-15-preview'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (clientRequestId !== null && clientRequestId !== undefined && typeof clientRequestId.valueOf() !== 'string') { + throw new Error('clientRequestId must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter 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.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + 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 (clientRequestId !== undefined && clientRequestId !== null) { + httpRequest.headers['clientRequestId'] = clientRequestId; + } + 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 !== 404) { + 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['SoftwareUpdateConfigurationListResult']().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 SoftwareUpdateConfigurations. */ +class SoftwareUpdateConfigurations { + /** + * Create a SoftwareUpdateConfigurations. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._create = _create; + this._getByName = _getByName; + this._deleteMethod = _deleteMethod; + this._list = _list; + } + + /** + * Create a new software update configuration with the name given in the URI. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} softwareUpdateConfigurationName The name of the software + * update configuration to be created. + * + * @param {object} parameters Request body. + * + * @param {object} parameters.updateConfiguration update specific properties + * for the Software update configuration + * + * @param {string} parameters.updateConfiguration.operatingSystem operating + * system of target machines. Possible values include: 'Windows', 'Linux' + * + * @param {object} [parameters.updateConfiguration.windows] Windows specific + * update configuration. + * + * @param {string} + * [parameters.updateConfiguration.windows.includedUpdateClassifications] + * Update classification included in the software update configuration. A comma + * separated string with required values. Possible values include: + * 'Unclassified', 'Critical', 'Security', 'UpdateRollup', 'FeaturePack', + * 'ServicePack', 'Definition', 'Tools', 'Updates' + * + * @param {array} [parameters.updateConfiguration.windows.excludedKbNumbers] KB + * numbers excluded from the software update configuration. + * + * @param {object} [parameters.updateConfiguration.linux] Linux specific update + * configuration. + * + * @param {string} + * [parameters.updateConfiguration.linux.includedPackageClassifications] Update + * classifications included in the software update configuration. Possible + * values include: 'Unclassified', 'Critical', 'Security', 'Other' + * + * @param {array} + * [parameters.updateConfiguration.linux.excludedPackageNameMasks] packages + * excluded from the software update configuration. + * + * @param {moment.duration} [parameters.updateConfiguration.duration] Maximum + * time allowed for the software update configuration run. Duration needs to be + * specified using the format PT[n]H[n]M[n]S as per ISO8601 + * + * @param {array} [parameters.updateConfiguration.azureVirtualMachines] List of + * azure resource Ids for azure virtual machines targeted by the software + * update configuration. + * + * @param {array} [parameters.updateConfiguration.nonAzureComputerNames] List + * of names of non-azure machines targeted by the software update + * configuration. + * + * @param {object} parameters.scheduleInfo Schedule information for the + * Software update configuration + * + * @param {date} [parameters.scheduleInfo.startTime] Gets or sets the start + * time of the schedule. + * + * @param {date} [parameters.scheduleInfo.expiryTime] Gets or sets the end time + * of the schedule. + * + * @param {number} [parameters.scheduleInfo.expiryTimeOffsetMinutes] Gets or + * sets the expiry time's offset in minutes. + * + * @param {boolean} [parameters.scheduleInfo.isEnabled] Gets or sets a value + * indicating whether this schedule is enabled. + * + * @param {date} [parameters.scheduleInfo.nextRun] Gets or sets the next run + * time of the schedule. + * + * @param {number} [parameters.scheduleInfo.nextRunOffsetMinutes] Gets or sets + * the next run time's offset in minutes. + * + * @param {number} [parameters.scheduleInfo.interval] Gets or sets the interval + * of the schedule. + * + * @param {string} [parameters.scheduleInfo.frequency] Gets or sets the + * frequency of the schedule. Possible values include: 'OneTime', 'Day', + * 'Hour', 'Week', 'Month' + * + * @param {string} [parameters.scheduleInfo.timeZone] Gets or sets the time + * zone of the schedule. + * + * @param {object} [parameters.scheduleInfo.advancedSchedule] Gets or sets the + * advanced schedule. + * + * @param {array} [parameters.scheduleInfo.advancedSchedule.weekDays] Days of + * the week that the job should execute on. + * + * @param {array} [parameters.scheduleInfo.advancedSchedule.monthDays] Days of + * the month that the job should execute on. Must be between 1 and 31. + * + * @param {array} [parameters.scheduleInfo.advancedSchedule.monthlyOccurrences] + * Occurrences of days within a month. + * + * @param {date} [parameters.scheduleInfo.creationTime] Gets or sets the + * creation time. + * + * @param {date} [parameters.scheduleInfo.lastModifiedTime] Gets or sets the + * last modified time. + * + * @param {string} [parameters.scheduleInfo.description] Gets or sets the + * description. + * + * @param {object} [parameters.error] detailes of provisioning error + * + * @param {string} [parameters.error.code] Error code + * + * @param {string} [parameters.error.message] Error message indicating why the + * operation failed. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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, automationAccountName, softwareUpdateConfigurationName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._create(resourceGroupName, automationAccountName, softwareUpdateConfigurationName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create a new software update configuration with the name given in the URI. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} softwareUpdateConfigurationName The name of the software + * update configuration to be created. + * + * @param {object} parameters Request body. + * + * @param {object} parameters.updateConfiguration update specific properties + * for the Software update configuration + * + * @param {string} parameters.updateConfiguration.operatingSystem operating + * system of target machines. Possible values include: 'Windows', 'Linux' + * + * @param {object} [parameters.updateConfiguration.windows] Windows specific + * update configuration. + * + * @param {string} + * [parameters.updateConfiguration.windows.includedUpdateClassifications] + * Update classification included in the software update configuration. A comma + * separated string with required values. Possible values include: + * 'Unclassified', 'Critical', 'Security', 'UpdateRollup', 'FeaturePack', + * 'ServicePack', 'Definition', 'Tools', 'Updates' + * + * @param {array} [parameters.updateConfiguration.windows.excludedKbNumbers] KB + * numbers excluded from the software update configuration. + * + * @param {object} [parameters.updateConfiguration.linux] Linux specific update + * configuration. + * + * @param {string} + * [parameters.updateConfiguration.linux.includedPackageClassifications] Update + * classifications included in the software update configuration. Possible + * values include: 'Unclassified', 'Critical', 'Security', 'Other' + * + * @param {array} + * [parameters.updateConfiguration.linux.excludedPackageNameMasks] packages + * excluded from the software update configuration. + * + * @param {moment.duration} [parameters.updateConfiguration.duration] Maximum + * time allowed for the software update configuration run. Duration needs to be + * specified using the format PT[n]H[n]M[n]S as per ISO8601 + * + * @param {array} [parameters.updateConfiguration.azureVirtualMachines] List of + * azure resource Ids for azure virtual machines targeted by the software + * update configuration. + * + * @param {array} [parameters.updateConfiguration.nonAzureComputerNames] List + * of names of non-azure machines targeted by the software update + * configuration. + * + * @param {object} parameters.scheduleInfo Schedule information for the + * Software update configuration + * + * @param {date} [parameters.scheduleInfo.startTime] Gets or sets the start + * time of the schedule. + * + * @param {date} [parameters.scheduleInfo.expiryTime] Gets or sets the end time + * of the schedule. + * + * @param {number} [parameters.scheduleInfo.expiryTimeOffsetMinutes] Gets or + * sets the expiry time's offset in minutes. + * + * @param {boolean} [parameters.scheduleInfo.isEnabled] Gets or sets a value + * indicating whether this schedule is enabled. + * + * @param {date} [parameters.scheduleInfo.nextRun] Gets or sets the next run + * time of the schedule. + * + * @param {number} [parameters.scheduleInfo.nextRunOffsetMinutes] Gets or sets + * the next run time's offset in minutes. + * + * @param {number} [parameters.scheduleInfo.interval] Gets or sets the interval + * of the schedule. + * + * @param {string} [parameters.scheduleInfo.frequency] Gets or sets the + * frequency of the schedule. Possible values include: 'OneTime', 'Day', + * 'Hour', 'Week', 'Month' + * + * @param {string} [parameters.scheduleInfo.timeZone] Gets or sets the time + * zone of the schedule. + * + * @param {object} [parameters.scheduleInfo.advancedSchedule] Gets or sets the + * advanced schedule. + * + * @param {array} [parameters.scheduleInfo.advancedSchedule.weekDays] Days of + * the week that the job should execute on. + * + * @param {array} [parameters.scheduleInfo.advancedSchedule.monthDays] Days of + * the month that the job should execute on. Must be between 1 and 31. + * + * @param {array} [parameters.scheduleInfo.advancedSchedule.monthlyOccurrences] + * Occurrences of days within a month. + * + * @param {date} [parameters.scheduleInfo.creationTime] Gets or sets the + * creation time. + * + * @param {date} [parameters.scheduleInfo.lastModifiedTime] Gets or sets the + * last modified time. + * + * @param {string} [parameters.scheduleInfo.description] Gets or sets the + * description. + * + * @param {object} [parameters.error] detailes of provisioning error + * + * @param {string} [parameters.error.code] Error code + * + * @param {string} [parameters.error.message] Error message indicating why the + * operation failed. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 {SoftwareUpdateConfiguration} - 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 SoftwareUpdateConfiguration} 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, automationAccountName, softwareUpdateConfigurationName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._create(resourceGroupName, automationAccountName, softwareUpdateConfigurationName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(resourceGroupName, automationAccountName, softwareUpdateConfigurationName, parameters, options, optionalCallback); + } + } + + /** + * Get a single software update configuration by name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} softwareUpdateConfigurationName The name of the software + * update configuration to be created. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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. + */ + getByNameWithHttpOperationResponse(resourceGroupName, automationAccountName, softwareUpdateConfigurationName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getByName(resourceGroupName, automationAccountName, softwareUpdateConfigurationName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get a single software update configuration by name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} softwareUpdateConfigurationName The name of the software + * update configuration to be created. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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 {SoftwareUpdateConfiguration} - 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 SoftwareUpdateConfiguration} 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. + */ + getByName(resourceGroupName, automationAccountName, softwareUpdateConfigurationName, 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._getByName(resourceGroupName, automationAccountName, softwareUpdateConfigurationName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getByName(resourceGroupName, automationAccountName, softwareUpdateConfigurationName, options, optionalCallback); + } + } + + /** + * delete a specific software update configuration. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} softwareUpdateConfigurationName The name of the software + * update configuration to be created. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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, automationAccountName, softwareUpdateConfigurationName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, automationAccountName, softwareUpdateConfigurationName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * delete a specific software update configuration. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} softwareUpdateConfigurationName The name of the software + * update configuration to be created. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @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, automationAccountName, softwareUpdateConfigurationName, 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, automationAccountName, softwareUpdateConfigurationName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, automationAccountName, softwareUpdateConfigurationName, options, optionalCallback); + } + } + + /** + * Get all software update configurations for the account. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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(resourceGroupName, automationAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get all software update configurations for the account. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.clientRequestId] Identifies this specific client + * request. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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 {SoftwareUpdateConfigurationListResult} - 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 SoftwareUpdateConfigurationListResult} 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(resourceGroupName, automationAccountName, 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(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, automationAccountName, options, optionalCallback); + } + } + +} + +module.exports = SoftwareUpdateConfigurations; diff --git a/lib/services/automationManagement/lib/operations/sourceControlOperations.js b/lib/services/automationManagement/lib/operations/sourceControlOperations.js new file mode 100644 index 0000000000..8e34846c2e --- /dev/null +++ b/lib/services/automationManagement/lib/operations/sourceControlOperations.js @@ -0,0 +1,1703 @@ +/* + * 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; + +/** + * Create a source control. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {object} parameters The parameters supplied to the create or update + * source control operation. + * + * @param {string} [parameters.repoUrl] Gets or sets the repo url of the source + * control. + * + * @param {string} [parameters.branch] Gets or sets the repo branch of the + * source control. Include branch as empty string for VsoTfvc. + * + * @param {string} [parameters.folderPath] Gets or sets the folder path of the + * source control. Path must be relative. + * + * @param {boolean} [parameters.autoSync] Gets or sets auto async of the source + * control. Default is false. + * + * @param {boolean} [parameters.publishRunbook] Gets or sets the auto publish + * of the source control. Default is true. + * + * @param {string} [parameters.sourceType] The source type. Must be one of + * VsoGit, VsoTfvc, GitHub, case sensitive. Possible values include: 'VsoGit', + * 'VsoTfvc', 'GitHub' + * + * @param {string} [parameters.securityToken] Gets or sets the authorization + * token for the repo of the source control. + * + * @param {string} [parameters.description] Gets or sets the user description + * of the source control. + * + * @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 SourceControl} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, automationAccountName, sourceControlName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2017-05-15-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (sourceControlName === null || sourceControlName === undefined || typeof sourceControlName.valueOf() !== 'string') { + throw new Error('sourceControlName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{sourceControlName}', encodeURIComponent(sourceControlName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['SourceControlCreateOrUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['SourceControl']().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['SourceControl']().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); + }); +} + +/** + * Update a source control. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {object} parameters The parameters supplied to the update source + * control operation. + * + * @param {string} [parameters.branch] Gets or sets the repo branch of the + * source control. + * + * @param {string} [parameters.folderPath] Gets or sets the folder path of the + * source control. Path must be relative. + * + * @param {boolean} [parameters.autoSync] Gets or sets auto async of the source + * control. Default is false. + * + * @param {boolean} [parameters.publishRunbook] Gets or sets the auto publish + * of the source control. Default is true. + * + * @param {string} [parameters.securityToken] Gets or sets the authorization + * token for the repo of the source control. + * + * @param {string} [parameters.description] Gets or sets the user description + * of the source control. + * + * @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 SourceControl} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, automationAccountName, sourceControlName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2017-05-15-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (sourceControlName === null || sourceControlName === undefined || typeof sourceControlName.valueOf() !== 'string') { + throw new Error('sourceControlName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{sourceControlName}', encodeURIComponent(sourceControlName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['SourceControlUpdateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['SourceControl']().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); + }); +} + +/** + * Delete the source control. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The name of source control. + * + * @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, automationAccountName, sourceControlName, 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 apiVersion = '2017-05-15-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (sourceControlName === null || sourceControlName === undefined || typeof sourceControlName.valueOf() !== 'string') { + throw new Error('sourceControlName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{sourceControlName}', encodeURIComponent(sourceControlName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Retrieve the source control identified by source control name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The name of source control. + * + * @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 SourceControl} 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, automationAccountName, sourceControlName, 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 apiVersion = '2017-05-15-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (sourceControlName === null || sourceControlName === undefined || typeof sourceControlName.valueOf() !== 'string') { + throw new Error('sourceControlName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{sourceControlName}', encodeURIComponent(sourceControlName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['SourceControl']().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); + }); +} + +/** + * Retrieve a list of source controls. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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 SourceControlListResult} 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 _listByAutomationAccount(resourceGroupName, automationAccountName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let apiVersion = '2017-05-15-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['SourceControlListResult']().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); + }); +} + +/** + * Retrieve a list of source controls. + * + * @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 SourceControlListResult} 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 _listByAutomationAccountNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['SourceControlListResult']().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 SourceControlOperations. */ +class SourceControlOperations { + /** + * Create a SourceControlOperations. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._createOrUpdate = _createOrUpdate; + this._update = _update; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._listByAutomationAccount = _listByAutomationAccount; + this._listByAutomationAccountNext = _listByAutomationAccountNext; + } + + /** + * Create a source control. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {object} parameters The parameters supplied to the create or update + * source control operation. + * + * @param {string} [parameters.repoUrl] Gets or sets the repo url of the source + * control. + * + * @param {string} [parameters.branch] Gets or sets the repo branch of the + * source control. Include branch as empty string for VsoTfvc. + * + * @param {string} [parameters.folderPath] Gets or sets the folder path of the + * source control. Path must be relative. + * + * @param {boolean} [parameters.autoSync] Gets or sets auto async of the source + * control. Default is false. + * + * @param {boolean} [parameters.publishRunbook] Gets or sets the auto publish + * of the source control. Default is true. + * + * @param {string} [parameters.sourceType] The source type. Must be one of + * VsoGit, VsoTfvc, GitHub, case sensitive. Possible values include: 'VsoGit', + * 'VsoTfvc', 'GitHub' + * + * @param {string} [parameters.securityToken] Gets or sets the authorization + * token for the repo of the source control. + * + * @param {string} [parameters.description] Gets or sets the user description + * of the source control. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, automationAccountName, sourceControlName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, automationAccountName, sourceControlName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create a source control. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {object} parameters The parameters supplied to the create or update + * source control operation. + * + * @param {string} [parameters.repoUrl] Gets or sets the repo url of the source + * control. + * + * @param {string} [parameters.branch] Gets or sets the repo branch of the + * source control. Include branch as empty string for VsoTfvc. + * + * @param {string} [parameters.folderPath] Gets or sets the folder path of the + * source control. Path must be relative. + * + * @param {boolean} [parameters.autoSync] Gets or sets auto async of the source + * control. Default is false. + * + * @param {boolean} [parameters.publishRunbook] Gets or sets the auto publish + * of the source control. Default is true. + * + * @param {string} [parameters.sourceType] The source type. Must be one of + * VsoGit, VsoTfvc, GitHub, case sensitive. Possible values include: 'VsoGit', + * 'VsoTfvc', 'GitHub' + * + * @param {string} [parameters.securityToken] Gets or sets the authorization + * token for the repo of the source control. + * + * @param {string} [parameters.description] Gets or sets the user description + * of the source control. + * + * @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 {SourceControl} - 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 SourceControl} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, automationAccountName, sourceControlName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, automationAccountName, sourceControlName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, automationAccountName, sourceControlName, parameters, options, optionalCallback); + } + } + + /** + * Update a source control. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {object} parameters The parameters supplied to the update source + * control operation. + * + * @param {string} [parameters.branch] Gets or sets the repo branch of the + * source control. + * + * @param {string} [parameters.folderPath] Gets or sets the folder path of the + * source control. Path must be relative. + * + * @param {boolean} [parameters.autoSync] Gets or sets auto async of the source + * control. Default is false. + * + * @param {boolean} [parameters.publishRunbook] Gets or sets the auto publish + * of the source control. Default is true. + * + * @param {string} [parameters.securityToken] Gets or sets the authorization + * token for the repo of the source control. + * + * @param {string} [parameters.description] Gets or sets the user description + * of the source control. + * + * @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. + */ + updateWithHttpOperationResponse(resourceGroupName, automationAccountName, sourceControlName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, automationAccountName, sourceControlName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Update a source control. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {object} parameters The parameters supplied to the update source + * control operation. + * + * @param {string} [parameters.branch] Gets or sets the repo branch of the + * source control. + * + * @param {string} [parameters.folderPath] Gets or sets the folder path of the + * source control. Path must be relative. + * + * @param {boolean} [parameters.autoSync] Gets or sets auto async of the source + * control. Default is false. + * + * @param {boolean} [parameters.publishRunbook] Gets or sets the auto publish + * of the source control. Default is true. + * + * @param {string} [parameters.securityToken] Gets or sets the authorization + * token for the repo of the source control. + * + * @param {string} [parameters.description] Gets or sets the user description + * of the source control. + * + * @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 {SourceControl} - 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 SourceControl} 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. + */ + update(resourceGroupName, automationAccountName, sourceControlName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, automationAccountName, sourceControlName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, automationAccountName, sourceControlName, parameters, options, optionalCallback); + } + } + + /** + * Delete the source control. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The name of source control. + * + * @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, automationAccountName, sourceControlName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, automationAccountName, sourceControlName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Delete the source control. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The name of source control. + * + * @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, automationAccountName, sourceControlName, 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, automationAccountName, sourceControlName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, automationAccountName, sourceControlName, options, optionalCallback); + } + } + + /** + * Retrieve the source control identified by source control name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The name of source control. + * + * @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, automationAccountName, sourceControlName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, automationAccountName, sourceControlName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the source control identified by source control name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The name of source control. + * + * @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 {SourceControl} - 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 SourceControl} 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, automationAccountName, sourceControlName, 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, automationAccountName, sourceControlName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, automationAccountName, sourceControlName, options, optionalCallback); + } + } + + /** + * Retrieve a list of source controls. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName, automationAccountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of source controls. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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 {SourceControlListResult} - 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 SourceControlListResult} 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. + */ + listByAutomationAccount(resourceGroupName, automationAccountName, 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._listByAutomationAccount(resourceGroupName, automationAccountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccount(resourceGroupName, automationAccountName, options, optionalCallback); + } + } + + /** + * Retrieve a list of source controls. + * + * @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. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccountNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of source controls. + * + * @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 {SourceControlListResult} - 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 SourceControlListResult} 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. + */ + listByAutomationAccountNext(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._listByAutomationAccountNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccountNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = SourceControlOperations; diff --git a/lib/services/automationManagement/lib/operations/sourceControlSyncJobOperations.js b/lib/services/automationManagement/lib/operations/sourceControlSyncJobOperations.js new file mode 100644 index 0000000000..a3c6ac5ef3 --- /dev/null +++ b/lib/services/automationManagement/lib/operations/sourceControlSyncJobOperations.js @@ -0,0 +1,1046 @@ +/* + * 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; + +/** + * Creates the sync job for a source control. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {uuid} sourceControlSyncJobId The source control sync job id. + * + * @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 SourceControlSyncJob} 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, automationAccountName, sourceControlName, sourceControlSyncJobId, 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 apiVersion = '2017-05-15-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (sourceControlName === null || sourceControlName === undefined || typeof sourceControlName.valueOf() !== 'string') { + throw new Error('sourceControlName cannot be null or undefined and it must be of type string.'); + } + if (sourceControlSyncJobId === null || sourceControlSyncJobId === undefined || typeof sourceControlSyncJobId.valueOf() !== 'string' || !msRest.isValidUuid(sourceControlSyncJobId)) { + throw new Error('sourceControlSyncJobId cannot be null or undefined and it must be of type string and must be a valid uuid.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs/{sourceControlSyncJobId}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{sourceControlName}', encodeURIComponent(sourceControlName)); + requestUrl = requestUrl.replace('{sourceControlSyncJobId}', encodeURIComponent(sourceControlSyncJobId.toString())); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['SourceControlSyncJob']().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); + }); +} + +/** + * Retrieve the source control sync job identified by job id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {uuid} sourceControlSyncJobId The source control sync job id. + * + * @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 SourceControlSyncJobById} 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, automationAccountName, sourceControlName, sourceControlSyncJobId, 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 apiVersion = '2017-05-15-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (sourceControlName === null || sourceControlName === undefined || typeof sourceControlName.valueOf() !== 'string') { + throw new Error('sourceControlName cannot be null or undefined and it must be of type string.'); + } + if (sourceControlSyncJobId === null || sourceControlSyncJobId === undefined || typeof sourceControlSyncJobId.valueOf() !== 'string' || !msRest.isValidUuid(sourceControlSyncJobId)) { + throw new Error('sourceControlSyncJobId cannot be null or undefined and it must be of type string and must be a valid uuid.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs/{sourceControlSyncJobId}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{sourceControlName}', encodeURIComponent(sourceControlName)); + requestUrl = requestUrl.replace('{sourceControlSyncJobId}', encodeURIComponent(sourceControlSyncJobId.toString())); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['SourceControlSyncJobById']().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); + }); +} + +/** + * Retrieve a list of source control sync jobs. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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 SourceControlSyncJobListResult} 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 _listByAutomationAccount(resourceGroupName, automationAccountName, sourceControlName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let apiVersion = '2017-05-15-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (sourceControlName === null || sourceControlName === undefined || typeof sourceControlName.valueOf() !== 'string') { + throw new Error('sourceControlName cannot be null or undefined and it must be of type string.'); + } + if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { + throw new Error('filter must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{sourceControlName}', encodeURIComponent(sourceControlName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + if (filter !== null && filter !== undefined) { + queryParameters.push('$filter=' + encodeURIComponent(filter)); + } + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['SourceControlSyncJobListResult']().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); + }); +} + +/** + * Retrieve a list of source control sync jobs. + * + * @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 SourceControlSyncJobListResult} 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 _listByAutomationAccountNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['SourceControlSyncJobListResult']().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 SourceControlSyncJobOperations. */ +class SourceControlSyncJobOperations { + /** + * Create a SourceControlSyncJobOperations. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._create = _create; + this._get = _get; + this._listByAutomationAccount = _listByAutomationAccount; + this._listByAutomationAccountNext = _listByAutomationAccountNext; + } + + /** + * Creates the sync job for a source control. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {uuid} sourceControlSyncJobId The source control sync job id. + * + * @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, automationAccountName, sourceControlName, sourceControlSyncJobId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._create(resourceGroupName, automationAccountName, sourceControlName, sourceControlSyncJobId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates the sync job for a source control. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {uuid} sourceControlSyncJobId The source control sync job id. + * + * @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 {SourceControlSyncJob} - 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 SourceControlSyncJob} 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, automationAccountName, sourceControlName, sourceControlSyncJobId, 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, automationAccountName, sourceControlName, sourceControlSyncJobId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(resourceGroupName, automationAccountName, sourceControlName, sourceControlSyncJobId, options, optionalCallback); + } + } + + /** + * Retrieve the source control sync job identified by job id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {uuid} sourceControlSyncJobId The source control sync job id. + * + * @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, automationAccountName, sourceControlName, sourceControlSyncJobId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, automationAccountName, sourceControlName, sourceControlSyncJobId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the source control sync job identified by job id. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {uuid} sourceControlSyncJobId The source control sync job id. + * + * @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 {SourceControlSyncJobById} - 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 SourceControlSyncJobById} 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, automationAccountName, sourceControlName, sourceControlSyncJobId, 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, automationAccountName, sourceControlName, sourceControlSyncJobId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, automationAccountName, sourceControlName, sourceControlSyncJobId, options, optionalCallback); + } + } + + /** + * Retrieve a list of source control sync jobs. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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. + */ + listByAutomationAccountWithHttpOperationResponse(resourceGroupName, automationAccountName, sourceControlName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccount(resourceGroupName, automationAccountName, sourceControlName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of source control sync jobs. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The name of the automation account. + * + * @param {string} sourceControlName The source control name. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.filter] The filter to apply on the operation. + * + * @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 {SourceControlSyncJobListResult} - 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 SourceControlSyncJobListResult} 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. + */ + listByAutomationAccount(resourceGroupName, automationAccountName, sourceControlName, 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._listByAutomationAccount(resourceGroupName, automationAccountName, sourceControlName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccount(resourceGroupName, automationAccountName, sourceControlName, options, optionalCallback); + } + } + + /** + * Retrieve a list of source control sync jobs. + * + * @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. + */ + listByAutomationAccountNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByAutomationAccountNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve a list of source control sync jobs. + * + * @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 {SourceControlSyncJobListResult} - 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 SourceControlSyncJobListResult} 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. + */ + listByAutomationAccountNext(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._listByAutomationAccountNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByAutomationAccountNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = SourceControlSyncJobOperations; diff --git a/lib/services/automationManagement/lib/operations/statisticsOperations.js b/lib/services/automationManagement/lib/operations/statisticsOperations.js index 272e88b58b..2d55cd9c03 100644 --- a/lib/services/automationManagement/lib/operations/statisticsOperations.js +++ b/lib/services/automationManagement/lib/operations/statisticsOperations.js @@ -52,6 +52,7 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti throw new Error('callback cannot be null.'); } let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -72,9 +73,6 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -92,7 +90,7 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti if (filter !== null && filter !== undefined) { queryParameters.push('$filter=' + encodeURIComponent(filter)); } - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } diff --git a/lib/services/automationManagement/lib/operations/testJobOperations.js b/lib/services/automationManagement/lib/operations/testJobOperations.js new file mode 100644 index 0000000000..ec509a1344 --- /dev/null +++ b/lib/services/automationManagement/lib/operations/testJobOperations.js @@ -0,0 +1,1294 @@ +/* + * 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; + +/** + * Create a test job of the runbook. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The parameters supplied to the create test job + * operation. + * + * @param {object} parameters The parameters supplied to the create test job + * operation. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * test job. + * + * @param {string} [parameters.runOn] Gets or sets the runOn which specifies + * the group name where the job is to be executed. + * + * @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 TestJob} 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, automationAccountName, runbookName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2015-10-31'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (runbookName === null || runbookName === undefined || typeof runbookName.valueOf() !== 'string') { + throw new Error('runbookName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters 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.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{runbookName}', encodeURIComponent(runbookName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['TestJobCreateParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['TestJob']().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); + }); +} + +/** + * Retrieve the test job for the specified runbook. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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 TestJob} 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, automationAccountName, runbookName, 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 apiVersion = '2015-10-31'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (runbookName === null || runbookName === undefined || typeof runbookName.valueOf() !== 'string') { + throw new Error('runbookName 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.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{runbookName}', encodeURIComponent(runbookName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['TestJob']().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); + }); +} + +/** + * Resume the test job. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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. + * + * {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 _resume(resourceGroupName, automationAccountName, runbookName, 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 apiVersion = '2015-10-31'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (runbookName === null || runbookName === undefined || typeof runbookName.valueOf() !== 'string') { + throw new Error('runbookName 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.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/resume'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{runbookName}', encodeURIComponent(runbookName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Stop the test job. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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. + * + * {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 _stop(resourceGroupName, automationAccountName, runbookName, 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 apiVersion = '2015-10-31'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (runbookName === null || runbookName === undefined || typeof runbookName.valueOf() !== 'string') { + throw new Error('runbookName 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.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/stop'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{runbookName}', encodeURIComponent(runbookName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Suspend the test job. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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. + * + * {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 _suspend(resourceGroupName, automationAccountName, runbookName, 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 apiVersion = '2015-10-31'; + // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (automationAccountName === null || automationAccountName === undefined || typeof automationAccountName.valueOf() !== 'string') { + throw new Error('automationAccountName cannot be null or undefined and it must be of type string.'); + } + if (runbookName === null || runbookName === undefined || typeof runbookName.valueOf() !== 'string') { + throw new Error('runbookName 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.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/suspend'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{runbookName}', encodeURIComponent(runbookName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a TestJobOperations. */ +class TestJobOperations { + /** + * Create a TestJobOperations. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._create = _create; + this._get = _get; + this._resume = _resume; + this._stop = _stop; + this._suspend = _suspend; + } + + /** + * Create a test job of the runbook. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The parameters supplied to the create test job + * operation. + * + * @param {object} parameters The parameters supplied to the create test job + * operation. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * test job. + * + * @param {string} [parameters.runOn] Gets or sets the runOn which specifies + * the group name where the job is to be executed. + * + * @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, automationAccountName, runbookName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._create(resourceGroupName, automationAccountName, runbookName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create a test job of the runbook. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The parameters supplied to the create test job + * operation. + * + * @param {object} parameters The parameters supplied to the create test job + * operation. + * + * @param {object} [parameters.parameters] Gets or sets the parameters of the + * test job. + * + * @param {string} [parameters.runOn] Gets or sets the runOn which specifies + * the group name where the job is to be executed. + * + * @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 {TestJob} - 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 TestJob} 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, automationAccountName, runbookName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._create(resourceGroupName, automationAccountName, runbookName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(resourceGroupName, automationAccountName, runbookName, parameters, options, optionalCallback); + } + } + + /** + * Retrieve the test job for the specified runbook. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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. + */ + getWithHttpOperationResponse(resourceGroupName, automationAccountName, runbookName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, automationAccountName, runbookName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the test job for the specified runbook. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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 {TestJob} - 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 TestJob} 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, automationAccountName, runbookName, 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, automationAccountName, runbookName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, automationAccountName, runbookName, options, optionalCallback); + } + } + + /** + * Resume the test job. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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. + */ + resumeWithHttpOperationResponse(resourceGroupName, automationAccountName, runbookName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._resume(resourceGroupName, automationAccountName, runbookName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Resume the test job. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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 {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. + */ + resume(resourceGroupName, automationAccountName, runbookName, 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._resume(resourceGroupName, automationAccountName, runbookName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._resume(resourceGroupName, automationAccountName, runbookName, options, optionalCallback); + } + } + + /** + * Stop the test job. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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. + */ + stopWithHttpOperationResponse(resourceGroupName, automationAccountName, runbookName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._stop(resourceGroupName, automationAccountName, runbookName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Stop the test job. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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 {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. + */ + stop(resourceGroupName, automationAccountName, runbookName, 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._stop(resourceGroupName, automationAccountName, runbookName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._stop(resourceGroupName, automationAccountName, runbookName, options, optionalCallback); + } + } + + /** + * Suspend the test job. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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. + */ + suspendWithHttpOperationResponse(resourceGroupName, automationAccountName, runbookName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._suspend(resourceGroupName, automationAccountName, runbookName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Suspend the test job. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} runbookName The runbook 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 {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. + */ + suspend(resourceGroupName, automationAccountName, runbookName, 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._suspend(resourceGroupName, automationAccountName, runbookName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._suspend(resourceGroupName, automationAccountName, runbookName, options, optionalCallback); + } + } + +} + +module.exports = TestJobOperations; diff --git a/lib/services/automationManagement/lib/operations/testJobStreams.js b/lib/services/automationManagement/lib/operations/testJobStreams.js index a63bd58c06..944809e85b 100644 --- a/lib/services/automationManagement/lib/operations/testJobStreams.js +++ b/lib/services/automationManagement/lib/operations/testJobStreams.js @@ -15,9 +15,10 @@ const msRestAzure = require('ms-rest-azure'); const WebResource = msRest.WebResource; /** - * Retrieve a test job streams identified by runbook name and stream id. + * Retrieve a test job stream of the test job identified by runbook name and + * stream id. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -53,12 +54,24 @@ function _get(resourceGroupName, automationAccountName, runbookName, jobStreamId if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -73,12 +86,6 @@ function _get(resourceGroupName, automationAccountName, runbookName, jobStreamId if (jobStreamId === null || jobStreamId === undefined || typeof jobStreamId.valueOf() !== 'string') { throw new Error('jobStreamId cannot be null or undefined and it must be of type string.'); } - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -89,13 +96,13 @@ function _get(resourceGroupName, automationAccountName, runbookName, jobStreamId // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/streams/{jobStreamId}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); requestUrl = requestUrl.replace('{runbookName}', encodeURIComponent(runbookName)); requestUrl = requestUrl.replace('{jobStreamId}', encodeURIComponent(jobStreamId)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -181,7 +188,7 @@ function _get(resourceGroupName, automationAccountName, runbookName, jobStreamId /** * Retrieve a list of test job streams identified by runbook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -218,12 +225,24 @@ function _listByTestJob(resourceGroupName, automationAccountName, runbookName, o throw new Error('callback cannot be null.'); } let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let apiVersion = '2015-10-31'; // 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 (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -238,12 +257,6 @@ function _listByTestJob(resourceGroupName, automationAccountName, runbookName, o if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { throw new Error('filter must be of type string.'); } - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -254,15 +267,15 @@ function _listByTestJob(resourceGroupName, automationAccountName, runbookName, o // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/testJob/streams'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); requestUrl = requestUrl.replace('{runbookName}', encodeURIComponent(runbookName)); - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; if (filter !== null && filter !== undefined) { queryParameters.push('$filter=' + encodeURIComponent(filter)); } - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -487,9 +500,10 @@ class TestJobStreams { } /** - * Retrieve a test job streams identified by runbook name and stream id. + * Retrieve a test job stream of the test job identified by runbook name and + * stream id. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -523,9 +537,10 @@ class TestJobStreams { } /** - * Retrieve a test job streams identified by runbook name and stream id. + * Retrieve a test job stream of the test job identified by runbook name and + * stream id. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -583,7 +598,7 @@ class TestJobStreams { /** * Retrieve a list of test job streams identified by runbook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -619,7 +634,7 @@ class TestJobStreams { /** * Retrieve a list of test job streams identified by runbook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * diff --git a/lib/services/automationManagement/lib/operations/usages.js b/lib/services/automationManagement/lib/operations/usages.js index 8cde8acc71..b68cfaf78b 100644 --- a/lib/services/automationManagement/lib/operations/usages.js +++ b/lib/services/automationManagement/lib/operations/usages.js @@ -49,6 +49,7 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -66,9 +67,6 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -83,7 +81,7 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } diff --git a/lib/services/automationManagement/lib/operations/variableOperations.js b/lib/services/automationManagement/lib/operations/variableOperations.js index aae112202b..02e2b78ede 100644 --- a/lib/services/automationManagement/lib/operations/variableOperations.js +++ b/lib/services/automationManagement/lib/operations/variableOperations.js @@ -17,7 +17,7 @@ const WebResource = msRest.WebResource; /** * Create a variable. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -64,12 +64,21 @@ function _createOrUpdate(resourceGroupName, automationAccountName, variableName, if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -87,9 +96,6 @@ function _createOrUpdate(resourceGroupName, automationAccountName, variableName, 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -105,7 +111,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, variableName, requestUrl = requestUrl.replace('{variableName}', encodeURIComponent(variableName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -222,7 +228,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, variableName, /** * Update a variable. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -231,7 +237,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, variableName, * @param {object} parameters The parameters supplied to the update variable * operation. * - * @param {string} parameters.name Gets or sets the name of the variable. + * @param {string} [parameters.name] Gets or sets the name of the variable. * * @param {string} [parameters.value] Gets or sets the value of the variable. * @@ -266,12 +272,21 @@ function _update(resourceGroupName, automationAccountName, variableName, paramet if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -289,9 +304,6 @@ function _update(resourceGroupName, automationAccountName, variableName, paramet 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -307,7 +319,7 @@ function _update(resourceGroupName, automationAccountName, variableName, paramet requestUrl = requestUrl.replace('{variableName}', encodeURIComponent(variableName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -407,7 +419,7 @@ function _update(resourceGroupName, automationAccountName, variableName, paramet /** * Delete the variable. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -440,12 +452,21 @@ function _deleteMethod(resourceGroupName, automationAccountName, variableName, o if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -460,9 +481,6 @@ function _deleteMethod(resourceGroupName, automationAccountName, variableName, o 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -478,7 +496,7 @@ function _deleteMethod(resourceGroupName, automationAccountName, variableName, o requestUrl = requestUrl.replace('{variableName}', encodeURIComponent(variableName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -547,7 +565,7 @@ function _deleteMethod(resourceGroupName, automationAccountName, variableName, o /** * Retrieve the variable identified by variable name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -581,12 +599,21 @@ function _get(resourceGroupName, automationAccountName, variableName, options, c if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -601,9 +628,6 @@ function _get(resourceGroupName, automationAccountName, variableName, options, c 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -619,7 +643,7 @@ function _get(resourceGroupName, automationAccountName, variableName, options, c requestUrl = requestUrl.replace('{variableName}', encodeURIComponent(variableName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -705,7 +729,7 @@ function _get(resourceGroupName, automationAccountName, variableName, options, c /** * Retrieve a list of variables. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -737,12 +761,21 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -754,9 +787,6 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -771,7 +801,7 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1001,7 +1031,7 @@ class VariableOperations { /** * Create a variable. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1048,7 +1078,7 @@ class VariableOperations { /** * Create a variable. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1117,7 +1147,7 @@ class VariableOperations { /** * Update a variable. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1126,7 +1156,7 @@ class VariableOperations { * @param {object} parameters The parameters supplied to the update variable * operation. * - * @param {string} parameters.name Gets or sets the name of the variable. + * @param {string} [parameters.name] Gets or sets the name of the variable. * * @param {string} [parameters.value] Gets or sets the value of the variable. * @@ -1161,7 +1191,7 @@ class VariableOperations { /** * Update a variable. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1170,7 +1200,7 @@ class VariableOperations { * @param {object} parameters The parameters supplied to the update variable * operation. * - * @param {string} parameters.name Gets or sets the name of the variable. + * @param {string} [parameters.name] Gets or sets the name of the variable. * * @param {string} [parameters.value] Gets or sets the value of the variable. * @@ -1227,7 +1257,7 @@ class VariableOperations { /** * Delete the variable. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1261,7 +1291,7 @@ class VariableOperations { /** * Delete the variable. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1316,7 +1346,7 @@ class VariableOperations { /** * Retrieve the variable identified by variable name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1350,7 +1380,7 @@ class VariableOperations { /** * Retrieve the variable identified by variable name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1406,7 +1436,7 @@ class VariableOperations { /** * Retrieve a list of variables. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1438,7 +1468,7 @@ class VariableOperations { /** * Retrieve a list of variables. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * diff --git a/lib/services/automationManagement/lib/operations/webhookOperations.js b/lib/services/automationManagement/lib/operations/webhookOperations.js index 1de71658e3..d80da18620 100644 --- a/lib/services/automationManagement/lib/operations/webhookOperations.js +++ b/lib/services/automationManagement/lib/operations/webhookOperations.js @@ -17,7 +17,7 @@ const WebResource = msRest.WebResource; /** * Generates a Uri for use in creating a webhook. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -48,12 +48,21 @@ function _generateUri(resourceGroupName, automationAccountName, options, callbac if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -65,9 +74,6 @@ function _generateUri(resourceGroupName, automationAccountName, options, callbac 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -82,7 +88,7 @@ function _generateUri(resourceGroupName, automationAccountName, options, callbac requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -174,7 +180,7 @@ function _generateUri(resourceGroupName, automationAccountName, options, callbac /** * Delete the webhook by name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -207,12 +213,21 @@ function _deleteMethod(resourceGroupName, automationAccountName, webhookName, op if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -227,9 +242,6 @@ function _deleteMethod(resourceGroupName, automationAccountName, webhookName, op 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -245,7 +257,7 @@ function _deleteMethod(resourceGroupName, automationAccountName, webhookName, op requestUrl = requestUrl.replace('{webhookName}', encodeURIComponent(webhookName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -314,7 +326,7 @@ function _deleteMethod(resourceGroupName, automationAccountName, webhookName, op /** * Retrieve the webhook identified by webhook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -348,12 +360,21 @@ function _get(resourceGroupName, automationAccountName, webhookName, options, ca if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -368,9 +389,6 @@ function _get(resourceGroupName, automationAccountName, webhookName, options, ca 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -386,7 +404,7 @@ function _get(resourceGroupName, automationAccountName, webhookName, options, ca requestUrl = requestUrl.replace('{webhookName}', encodeURIComponent(webhookName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -472,7 +490,7 @@ function _get(resourceGroupName, automationAccountName, webhookName, options, ca /** * Create the webhook identified by webhook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -528,12 +546,21 @@ function _createOrUpdate(resourceGroupName, automationAccountName, webhookName, if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -551,9 +578,6 @@ function _createOrUpdate(resourceGroupName, automationAccountName, webhookName, 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -569,7 +593,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, webhookName, requestUrl = requestUrl.replace('{webhookName}', encodeURIComponent(webhookName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -686,7 +710,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, webhookName, /** * Update the webhook identified by webhook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -694,7 +718,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, webhookName, * * @param {object} parameters The update parameters for webhook. * - * @param {string} parameters.name Gets or sets the name of the webhook. + * @param {string} [parameters.name] Gets or sets the name of the webhook. * * @param {boolean} [parameters.isEnabled] Gets or sets the value of the * enabled flag of webhook. @@ -736,12 +760,21 @@ function _update(resourceGroupName, automationAccountName, webhookName, paramete if (!callback) { throw new Error('callback cannot be null.'); } + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -759,9 +792,6 @@ function _update(resourceGroupName, automationAccountName, webhookName, paramete 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -777,7 +807,7 @@ function _update(resourceGroupName, automationAccountName, webhookName, paramete requestUrl = requestUrl.replace('{webhookName}', encodeURIComponent(webhookName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -877,7 +907,7 @@ function _update(resourceGroupName, automationAccountName, webhookName, paramete /** * Retrieve a list of webhooks. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -912,12 +942,21 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti throw new Error('callback cannot be null.'); } let filter = (options && options.filter !== undefined) ? options.filter : undefined; + let apiVersion = '2015-10-31'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } if (resourceGroupName.match(/^[-\w\._]+$/) === null) { throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); @@ -932,9 +971,6 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { - throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -952,7 +988,7 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti if (filter !== null && filter !== undefined) { queryParameters.push('$filter=' + encodeURIComponent(filter)); } - queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1183,7 +1219,7 @@ class WebhookOperations { /** * Generates a Uri for use in creating a webhook. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1215,7 +1251,7 @@ class WebhookOperations { /** * Generates a Uri for use in creating a webhook. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1268,7 +1304,7 @@ class WebhookOperations { /** * Delete the webhook by name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1302,7 +1338,7 @@ class WebhookOperations { /** * Delete the webhook by name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1357,7 +1393,7 @@ class WebhookOperations { /** * Retrieve the webhook identified by webhook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1391,7 +1427,7 @@ class WebhookOperations { /** * Retrieve the webhook identified by webhook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1447,7 +1483,7 @@ class WebhookOperations { /** * Create the webhook identified by webhook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1503,7 +1539,7 @@ class WebhookOperations { /** * Create the webhook identified by webhook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1581,7 +1617,7 @@ class WebhookOperations { /** * Update the webhook identified by webhook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1589,7 +1625,7 @@ class WebhookOperations { * * @param {object} parameters The update parameters for webhook. * - * @param {string} parameters.name Gets or sets the name of the webhook. + * @param {string} [parameters.name] Gets or sets the name of the webhook. * * @param {boolean} [parameters.isEnabled] Gets or sets the value of the * enabled flag of webhook. @@ -1631,7 +1667,7 @@ class WebhookOperations { /** * Update the webhook identified by webhook name. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1639,7 +1675,7 @@ class WebhookOperations { * * @param {object} parameters The update parameters for webhook. * - * @param {string} parameters.name Gets or sets the name of the webhook. + * @param {string} [parameters.name] Gets or sets the name of the webhook. * * @param {boolean} [parameters.isEnabled] Gets or sets the value of the * enabled flag of webhook. @@ -1703,7 +1739,7 @@ class WebhookOperations { /** * Retrieve a list of webhooks. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * @@ -1737,7 +1773,7 @@ class WebhookOperations { /** * Retrieve a list of webhooks. * - * @param {string} resourceGroupName The resource group name. + * @param {string} resourceGroupName Name of an Azure Resource group. * * @param {string} automationAccountName The automation account name. * diff --git a/lib/services/automationManagement/lib/package.json b/lib/services/automationManagement/lib/package.json new file mode 100644 index 0000000000..3159dd3077 --- /dev/null +++ b/lib/services/automationManagement/lib/package.json @@ -0,0 +1,22 @@ +{ + "name": "azure-arm-automation", + "author": "Microsoft Corporation", + "description": "AutomationClient Library with typescript type definitions for node", + "version": "", + "dependencies": { + "ms-rest": "^2.3.3", + "ms-rest-azure": "^2.5.5" + }, + "keywords": [ "node", "azure" ], + "license": "MIT", + "main": "./lib/automationClient.js", + "types": "./lib/automationClient.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" + } +}