diff --git a/lib/services/automationManagement/lib/automationClient.d.ts b/lib/services/automationManagement/lib/automationClient.d.ts index 27ddad23f6..56d13310df 100644 --- a/lib/services/automationManagement/lib/automationClient.d.ts +++ b/lib/services/automationManagement/lib/automationClient.d.ts @@ -83,6 +83,7 @@ export default class AutomationClient extends AzureServiceClient { softwareUpdateConfigurationMachineRuns: operations.SoftwareUpdateConfigurationMachineRuns; sourceControlOperations: operations.SourceControlOperations; sourceControlSyncJobOperations: operations.SourceControlSyncJobOperations; + sourceControlSyncJobStreams: operations.SourceControlSyncJobStreams; jobOperations: operations.JobOperations; jobStreamOperations: operations.JobStreamOperations; agentRegistrationInformation: operations.AgentRegistrationInformation; @@ -91,6 +92,7 @@ export default class AutomationClient extends AzureServiceClient { dscCompilationJobOperations: operations.DscCompilationJobOperations; dscCompilationJobStream: operations.DscCompilationJobStream; dscNodeConfigurationOperations: operations.DscNodeConfigurationOperations; + watcherOperations: operations.WatcherOperations; } export { AutomationClient, models as AutomationModels }; diff --git a/lib/services/automationManagement/lib/automationClient.js b/lib/services/automationManagement/lib/automationClient.js index 569bd56c6e..6376309468 100644 --- a/lib/services/automationManagement/lib/automationClient.js +++ b/lib/services/automationManagement/lib/automationClient.js @@ -100,6 +100,7 @@ class AutomationClient extends ServiceClient { this.softwareUpdateConfigurationMachineRuns = new operations.SoftwareUpdateConfigurationMachineRuns(this); this.sourceControlOperations = new operations.SourceControlOperations(this); this.sourceControlSyncJobOperations = new operations.SourceControlSyncJobOperations(this); + this.sourceControlSyncJobStreams = new operations.SourceControlSyncJobStreams(this); this.jobOperations = new operations.JobOperations(this); this.jobStreamOperations = new operations.JobStreamOperations(this); this.agentRegistrationInformation = new operations.AgentRegistrationInformation(this); @@ -108,6 +109,7 @@ class AutomationClient extends ServiceClient { this.dscCompilationJobOperations = new operations.DscCompilationJobOperations(this); this.dscCompilationJobStream = new operations.DscCompilationJobStream(this); this.dscNodeConfigurationOperations = new operations.DscNodeConfigurationOperations(this); + this.watcherOperations = new operations.WatcherOperations(this); this.models = models; msRest.addSerializationMixin(this); } diff --git a/lib/services/automationManagement/lib/models/dscCompilationJob.js b/lib/services/automationManagement/lib/models/dscCompilationJob.js index e33fe69c1f..f06abcded1 100644 --- a/lib/services/automationManagement/lib/models/dscCompilationJob.js +++ b/lib/services/automationManagement/lib/models/dscCompilationJob.js @@ -123,6 +123,7 @@ class DscCompilationJob extends models['ProxyResource'] { }, provisioningState: { required: false, + readOnly: true, serializedName: 'properties.provisioningState', type: { name: 'Composite', diff --git a/lib/services/automationManagement/lib/models/dscNodeConfigurationCreateOrUpdateParameters.js b/lib/services/automationManagement/lib/models/dscNodeConfigurationCreateOrUpdateParameters.js index 7b95ae3cac..385da63714 100644 --- a/lib/services/automationManagement/lib/models/dscNodeConfigurationCreateOrUpdateParameters.js +++ b/lib/services/automationManagement/lib/models/dscNodeConfigurationCreateOrUpdateParameters.js @@ -31,31 +31,12 @@ class DscNodeConfigurationCreateOrUpdateParameters { * @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 Name of the node configuration. * @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. - * @member {object} source1 Gets or sets the source. - * @member {object} [source1.hash] Gets or sets the hash. - * @member {string} [source1.hash.algorithm] Gets or sets the content hash - * algorithm used to hash the content. - * @member {string} [source1.hash.value] Gets or sets expected hash value of - * the content. - * @member {string} [source1.type] Gets or sets the content source type. - * Possible values include: 'embeddedContent', 'uri' - * @member {string} [source1.value] Gets or sets the value of the content. - * This is based on the content source type. - * @member {string} [source1.version] Gets or sets the version of the - * content. - * @member {string} name1 Gets or sets the type of the parameter. - * @member {object} configuration1 Gets or sets the configuration of the - * node. - * @member {string} [configuration1.name] Gets or sets the name of the Dsc - * configuration. * @member {boolean} [incrementNodeConfigurationBuild] If a new build version * of NodeConfiguration is required. + * @member {string} [name] Name of the node configuration. * @member {object} [tags] Gets or sets the tags attached to the resource. */ constructor() { @@ -77,62 +58,32 @@ class DscNodeConfigurationCreateOrUpdateParameters { modelProperties: { source: { required: true, - serializedName: 'source', + serializedName: 'properties.source', type: { name: 'Composite', className: 'ContentSource' } }, - name: { - required: true, - serializedName: 'name', - type: { - name: 'String' - } - }, configuration: { required: true, - serializedName: 'configuration', + serializedName: 'properties.configuration', type: { name: 'Composite', className: 'DscConfigurationAssociationProperty' } }, - newNodeConfigurationBuildVersionRequired: { + incrementNodeConfigurationBuild: { required: false, - serializedName: 'newNodeConfigurationBuildVersionRequired', + serializedName: 'properties.incrementNodeConfigurationBuild', type: { name: 'Boolean' } }, - source1: { - required: true, - serializedName: 'properties.source', - type: { - name: 'Composite', - className: 'ContentSource' - } - }, - name1: { - required: true, - serializedName: 'properties.name', - type: { - name: 'String' - } - }, - configuration1: { - required: true, - serializedName: 'properties.configuration', - type: { - name: 'Composite', - className: 'DscConfigurationAssociationProperty' - } - }, - incrementNodeConfigurationBuild: { + name: { required: false, - serializedName: 'properties.incrementNodeConfigurationBuild', + serializedName: 'name', type: { - name: 'Boolean' + name: 'String' } }, tags: { diff --git a/lib/services/automationManagement/lib/models/hybridRunbookWorkerGroup.js b/lib/services/automationManagement/lib/models/hybridRunbookWorkerGroup.js index e9637e1e56..a2208e0532 100644 --- a/lib/services/automationManagement/lib/models/hybridRunbookWorkerGroup.js +++ b/lib/services/automationManagement/lib/models/hybridRunbookWorkerGroup.js @@ -26,6 +26,8 @@ class HybridRunbookWorkerGroup { * @member {object} [credential] Sets the credential of a worker group. * @member {string} [credential.name] Gets or sets the name of the * credential. + * @member {string} [groupType] Type of the HybridWorkerGroup. Possible + * values include: 'User', 'System' */ constructor() { } @@ -80,6 +82,13 @@ class HybridRunbookWorkerGroup { name: 'Composite', className: 'RunAsCredentialAssociationProperty' } + }, + groupType: { + required: false, + serializedName: 'groupType', + type: { + name: 'String' + } } } } diff --git a/lib/services/automationManagement/lib/models/index.d.ts b/lib/services/automationManagement/lib/models/index.d.ts index 60e57de9f5..3721109928 100644 --- a/lib/services/automationManagement/lib/models/index.d.ts +++ b/lib/services/automationManagement/lib/models/index.d.ts @@ -269,7 +269,7 @@ export interface DscCompilationJob extends ProxyResource { readonly startedBy?: string; readonly jobId?: string; readonly creationTime?: Date; - provisioningState?: JobProvisioningStateProperty; + readonly provisioningState?: JobProvisioningStateProperty; runOn?: string; status?: string; statusDetails?: string; @@ -358,6 +358,55 @@ export interface Certificate extends ProxyResource { description?: 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 Watcher class. + * @constructor + * Definition of the watcher type. + * + * @member {number} [executionFrequencyInSeconds] Gets or sets the frequency at + * which the watcher is invoked. + * @member {string} [scriptName] Gets or sets the name of the script the + * watcher is attached to, i.e. the name of an existing runbook. + * @member {object} [scriptParameters] Gets or sets the parameters of the + * script. + * @member {string} [scriptRunOn] Gets or sets the name of the hybrid worker + * group the watcher will run on. + * @member {string} [status] Gets the current status of the watcher. + * @member {date} [creationTime] Gets or sets the creation time. + * @member {date} [lastModifiedTime] Gets or sets the last modified time. + * @member {string} [lastModifiedBy] Details of the user who last modified the + * watcher. + * @member {string} [description] Gets or sets the description. + * @member {string} [etag] Gets or sets the etag of the resource. + */ +export interface Watcher extends TrackedResource { + executionFrequencyInSeconds?: number; + scriptName?: string; + scriptParameters?: { [propertyName: string]: string }; + scriptRunOn?: string; + readonly status?: string; + readonly creationTime?: Date; + readonly lastModifiedTime?: Date; + readonly lastModifiedBy?: string; + description?: string; + etag?: string; +} + /** * @class * Initializes a new instance of the RunbookParameter class. @@ -446,20 +495,6 @@ export interface RunbookDraft { 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. @@ -1212,6 +1247,31 @@ export interface DscCompilationJobCreateParameters { tags?: { [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 DscConfigurationCreateOrUpdateParameters class. @@ -1315,61 +1375,6 @@ export interface DscMetaConfiguration { 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 Name of the node configuration. - * @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. - * @member {object} source1 Gets or sets the source. - * @member {object} [source1.hash] Gets or sets the hash. - * @member {string} [source1.hash.algorithm] Gets or sets the content hash - * algorithm used to hash the content. - * @member {string} [source1.hash.value] Gets or sets expected hash value of - * the content. - * @member {string} [source1.type] Gets or sets the content source type. - * Possible values include: 'embeddedContent', 'uri' - * @member {string} [source1.value] Gets or sets the value of the content. This - * is based on the content source type. - * @member {string} [source1.version] Gets or sets the version of the content. - * @member {string} name1 Gets or sets the type of the parameter. - * @member {object} configuration1 Gets or sets the configuration of the node. - * @member {string} [configuration1.name] Gets or sets the name of the Dsc - * configuration. - * @member {boolean} [incrementNodeConfigurationBuild] If a new build version - * of NodeConfiguration is required. - * @member {object} [tags] Gets or sets the tags attached to the resource. - */ -export interface DscNodeConfigurationCreateOrUpdateParameters { - source: ContentSource; - name: string; - configuration: DscConfigurationAssociationProperty; - newNodeConfigurationBuildVersionRequired?: boolean; - source1: ContentSource; - name1: string; - configuration1: DscConfigurationAssociationProperty; - incrementNodeConfigurationBuild?: boolean; - tags?: { [propertyName: string]: string }; -} - /** * @class * Initializes a new instance of the DscNodeConfigurationAssociationProperty class. @@ -1613,12 +1618,15 @@ export interface RunAsCredentialAssociationProperty { * runbook workers. * @member {object} [credential] Sets the credential of a worker group. * @member {string} [credential.name] Gets or sets the name of the credential. + * @member {string} [groupType] Type of the HybridWorkerGroup. Possible values + * include: 'User', 'System' */ export interface HybridRunbookWorkerGroup { id?: string; name?: string; hybridRunbookWorkers?: HybridRunbookWorker[]; credential?: RunAsCredentialAssociationProperty; + groupType?: string; } /** @@ -1634,86 +1642,6 @@ 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 }; - readonly 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. @@ -1777,31 +1705,6 @@ export interface JobSchedule { 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. @@ -2356,6 +2259,64 @@ export interface WebhookUpdateParameters { description?: string; } +/** + * @class + * Initializes a new instance of the WatcherUpdateParameters class. + * @constructor + * @member {number} [executionFrequencyInSeconds] Gets or sets the frequency at + * which the watcher is invoked. + * @member {string} [name] Gets or sets the name of the resource. + */ +export interface WatcherUpdateParameters { + executionFrequencyInSeconds?: number; + name?: string; +} + +/** + * @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 {string} [provisioningState] The provisioning state of a resource. + */ +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 }; + readonly provisioningState?: string; +} + /** * @class * Initializes a new instance of the JobCollectionItem class. @@ -2389,6 +2350,24 @@ export interface JobCollectionItem extends ProxyResource { runOn?: string; } +/** + * @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 WindowsProperties class. @@ -3004,6 +2983,52 @@ export interface SourceControlSyncJobById { exception?: string; } +/** + * @class + * Initializes a new instance of the SourceControlSyncJobStream class. + * @constructor + * Definition of the source control sync job stream. + * + * @member {string} [id] Resource id. + * @member {string} [syncJobStreamId] Gets the sync job stream id. + * @member {string} [summary] Gets the summary of the sync job stream. + * @member {date} [time] Gets the time of the sync job stream. + * @member {string} [streamType] Gets the type of the sync job stream. Possible + * values include: 'Error', 'Output' + */ +export interface SourceControlSyncJobStream { + readonly id?: string; + syncJobStreamId?: string; + summary?: string; + readonly time?: Date; + streamType?: string; +} + +/** + * @class + * Initializes a new instance of the SourceControlSyncJobStreamById class. + * @constructor + * Definition of the source control sync job stream by id. + * + * @member {string} [id] Resource id. + * @member {string} [syncJobStreamId] Gets the sync job stream id. + * @member {string} [summary] Gets the summary of the sync job stream. + * @member {date} [time] Gets the time of the sync job stream. + * @member {string} [streamType] Gets the type of the sync job stream. Possible + * values include: 'Error', 'Output' + * @member {string} [streamText] Gets the text of the sync job stream. + * @member {string} [value] Gets the value of the sync job stream. + */ +export interface SourceControlSyncJobStreamById { + readonly id?: string; + syncJobStreamId?: string; + summary?: string; + readonly time?: Date; + streamType?: string; + streamText?: string; + value?: string; +} + /** * @class * Initializes a new instance of the DscNode class. @@ -3064,6 +3089,40 @@ export interface DscNodeConfiguration extends ProxyResource { incrementNodeConfigurationBuild?: 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 {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. + * @member {string} [name] Name of the node configuration. + * @member {object} [tags] Gets or sets the tags attached to the resource. + */ +export interface DscNodeConfigurationCreateOrUpdateParameters { + source: ContentSource; + configuration: DscConfigurationAssociationProperty; + incrementNodeConfigurationBuild?: boolean; + name?: string; + tags?: { [propertyName: string]: string }; +} + /** * @class @@ -3319,6 +3378,18 @@ export interface SourceControlSyncJobListResult extends Array { + readonly nextLink?: string; +} + /** * @class * Initializes a new instance of the JobListResultV2 class. @@ -3381,3 +3452,15 @@ export interface DscCompilationJobListResult extends Array { export interface DscNodeConfigurationListResult extends Array { nextLink?: string; } + +/** + * @class + * Initializes a new instance of the WatcherListResult class. + * @constructor + * The response model for the list watcher operation. + * + * @member {string} [nextLink] Gets or sets the next link. + */ +export interface WatcherListResult extends Array { + nextLink?: string; +} diff --git a/lib/services/automationManagement/lib/models/index.js b/lib/services/automationManagement/lib/models/index.js index 67610d8ee5..a0e0f0b60e 100644 --- a/lib/services/automationManagement/lib/models/index.js +++ b/lib/services/automationManagement/lib/models/index.js @@ -35,11 +35,12 @@ exports.Credential = require('./credential'); exports.ConnectionTypeAssociationProperty = require('./connectionTypeAssociationProperty'); exports.Connection = require('./connection'); exports.Certificate = require('./certificate'); +exports.TrackedResource = require('./trackedResource'); +exports.Watcher = require('./watcher'); 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'); @@ -71,10 +72,10 @@ exports.AgentRegistrationKeys = require('./agentRegistrationKeys'); exports.AgentRegistration = require('./agentRegistration'); exports.AgentRegistrationRegenerateKeyParameter = require('./agentRegistrationRegenerateKeyParameter'); exports.DscCompilationJobCreateParameters = require('./dscCompilationJobCreateParameters'); +exports.JobStream = require('./jobStream'); 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'); @@ -87,13 +88,9 @@ 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'); @@ -114,7 +111,10 @@ exports.VariableCreateOrUpdateParameters = require('./variableCreateOrUpdatePara exports.VariableUpdateParameters = require('./variableUpdateParameters'); exports.WebhookCreateOrUpdateParameters = require('./webhookCreateOrUpdateParameters'); exports.WebhookUpdateParameters = require('./webhookUpdateParameters'); +exports.WatcherUpdateParameters = require('./watcherUpdateParameters'); +exports.Job = require('./job'); exports.JobCollectionItem = require('./jobCollectionItem'); +exports.JobCreateParameters = require('./jobCreateParameters'); exports.WindowsProperties = require('./windowsProperties'); exports.LinuxProperties = require('./linuxProperties'); exports.UpdateConfiguration = require('./updateConfiguration'); @@ -134,8 +134,11 @@ exports.SourceControlUpdateParameters = require('./sourceControlUpdateParameters exports.SourceControlSyncJob = require('./sourceControlSyncJob'); exports.SourceControlSyncJobCreateParameters = require('./sourceControlSyncJobCreateParameters'); exports.SourceControlSyncJobById = require('./sourceControlSyncJobById'); +exports.SourceControlSyncJobStream = require('./sourceControlSyncJobStream'); +exports.SourceControlSyncJobStreamById = require('./sourceControlSyncJobStreamById'); exports.DscNode = require('./dscNode'); exports.DscNodeConfiguration = require('./dscNodeConfiguration'); +exports.DscNodeConfigurationCreateOrUpdateParameters = require('./dscNodeConfigurationCreateOrUpdateParameters'); exports.AutomationAccountListResult = require('./automationAccountListResult'); exports.OperationListResult = require('./operationListResult'); exports.StatisticsListResult = require('./statisticsListResult'); @@ -158,8 +161,10 @@ exports.VariableListResult = require('./variableListResult'); exports.WebhookListResult = require('./webhookListResult'); exports.SourceControlListResult = require('./sourceControlListResult'); exports.SourceControlSyncJobListResult = require('./sourceControlSyncJobListResult'); +exports.SourceControlSyncJobStreamsListBySyncJob = require('./sourceControlSyncJobStreamsListBySyncJob'); exports.JobListResultV2 = require('./jobListResultV2'); exports.DscNodeListResult = require('./dscNodeListResult'); exports.DscNodeReportListResult = require('./dscNodeReportListResult'); exports.DscCompilationJobListResult = require('./dscCompilationJobListResult'); exports.DscNodeConfigurationListResult = require('./dscNodeConfigurationListResult'); +exports.WatcherListResult = require('./watcherListResult'); diff --git a/lib/services/automationManagement/lib/models/job.js b/lib/services/automationManagement/lib/models/job.js index dfe14d9a78..c0759250d5 100644 --- a/lib/services/automationManagement/lib/models/job.js +++ b/lib/services/automationManagement/lib/models/job.js @@ -41,10 +41,7 @@ class Job extends models['ProxyResource'] { * @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' + * @member {string} [provisioningState] The provisioning state of a resource. */ constructor() { super(); @@ -192,8 +189,7 @@ class Job extends models['ProxyResource'] { readOnly: true, serializedName: 'properties.provisioningState', type: { - name: 'Composite', - className: 'JobProvisioningStateProperty' + name: 'String' } } } diff --git a/lib/services/automationManagement/lib/models/jobCreateParameters.js b/lib/services/automationManagement/lib/models/jobCreateParameters.js index b60f054efd..f62bbf6f81 100644 --- a/lib/services/automationManagement/lib/models/jobCreateParameters.js +++ b/lib/services/automationManagement/lib/models/jobCreateParameters.js @@ -19,7 +19,7 @@ const models = require('./index'); class JobCreateParameters { /** * Create a JobCreateParameters. - * @member {object} runbook Gets or sets the runbook. + * @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 @@ -43,7 +43,7 @@ class JobCreateParameters { className: 'JobCreateParameters', modelProperties: { runbook: { - required: true, + required: false, serializedName: 'properties.runbook', type: { name: 'Composite', diff --git a/lib/services/automationManagement/lib/models/sourceControlSyncJobStream.js b/lib/services/automationManagement/lib/models/sourceControlSyncJobStream.js new file mode 100644 index 0000000000..24c9541ca9 --- /dev/null +++ b/lib/services/automationManagement/lib/models/sourceControlSyncJobStream.js @@ -0,0 +1,87 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * 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 stream. + * + */ +class SourceControlSyncJobStream { + /** + * Create a SourceControlSyncJobStream. + * @member {string} [id] Resource id. + * @member {string} [syncJobStreamId] Gets the sync job stream id. + * @member {string} [summary] Gets the summary of the sync job stream. + * @member {date} [time] Gets the time of the sync job stream. + * @member {string} [streamType] Gets the type of the sync job stream. + * Possible values include: 'Error', 'Output' + */ + constructor() { + } + + /** + * Defines the metadata of SourceControlSyncJobStream + * + * @returns {object} metadata of SourceControlSyncJobStream + * + */ + mapper() { + return { + required: false, + serializedName: 'SourceControlSyncJobStream', + type: { + name: 'Composite', + className: 'SourceControlSyncJobStream', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + syncJobStreamId: { + required: false, + serializedName: 'properties.syncJobStreamId', + type: { + name: 'String' + } + }, + summary: { + required: false, + serializedName: 'properties.summary', + type: { + name: 'String' + } + }, + time: { + required: false, + readOnly: true, + serializedName: 'properties.time', + type: { + name: 'DateTime' + } + }, + streamType: { + required: false, + serializedName: 'properties.streamType', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SourceControlSyncJobStream; diff --git a/lib/services/automationManagement/lib/models/sourceControlSyncJobStreamById.js b/lib/services/automationManagement/lib/models/sourceControlSyncJobStreamById.js new file mode 100644 index 0000000000..7899451a0a --- /dev/null +++ b/lib/services/automationManagement/lib/models/sourceControlSyncJobStreamById.js @@ -0,0 +1,103 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * 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 stream by id. + * + */ +class SourceControlSyncJobStreamById { + /** + * Create a SourceControlSyncJobStreamById. + * @member {string} [id] Resource id. + * @member {string} [syncJobStreamId] Gets the sync job stream id. + * @member {string} [summary] Gets the summary of the sync job stream. + * @member {date} [time] Gets the time of the sync job stream. + * @member {string} [streamType] Gets the type of the sync job stream. + * Possible values include: 'Error', 'Output' + * @member {string} [streamText] Gets the text of the sync job stream. + * @member {string} [value] Gets the value of the sync job stream. + */ + constructor() { + } + + /** + * Defines the metadata of SourceControlSyncJobStreamById + * + * @returns {object} metadata of SourceControlSyncJobStreamById + * + */ + mapper() { + return { + required: false, + serializedName: 'SourceControlSyncJobStreamById', + type: { + name: 'Composite', + className: 'SourceControlSyncJobStreamById', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + syncJobStreamId: { + required: false, + serializedName: 'properties.syncJobStreamId', + type: { + name: 'String' + } + }, + summary: { + required: false, + serializedName: 'properties.summary', + type: { + name: 'String' + } + }, + time: { + required: false, + readOnly: true, + serializedName: 'properties.time', + type: { + name: 'DateTime' + } + }, + streamType: { + required: false, + serializedName: 'properties.streamType', + type: { + name: 'String' + } + }, + streamText: { + required: false, + serializedName: 'properties.streamText', + type: { + name: 'String' + } + }, + value: { + required: false, + serializedName: 'properties.value', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SourceControlSyncJobStreamById; diff --git a/lib/services/automationManagement/lib/models/sourceControlSyncJobStreamsListBySyncJob.js b/lib/services/automationManagement/lib/models/sourceControlSyncJobStreamsListBySyncJob.js new file mode 100644 index 0000000000..1bd26279c6 --- /dev/null +++ b/lib/services/automationManagement/lib/models/sourceControlSyncJobStreamsListBySyncJob.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 source control sync job streams operation. + */ +class SourceControlSyncJobStreamsListBySyncJob extends Array { + /** + * Create a SourceControlSyncJobStreamsListBySyncJob. + * @member {string} [nextLink] Gets or sets the next link. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of SourceControlSyncJobStreamsListBySyncJob + * + * @returns {object} metadata of SourceControlSyncJobStreamsListBySyncJob + * + */ + mapper() { + return { + required: false, + serializedName: 'SourceControlSyncJobStreamsListBySyncJob', + type: { + name: 'Composite', + className: 'SourceControlSyncJobStreamsListBySyncJob', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SourceControlSyncJobStreamElementType', + type: { + name: 'Composite', + className: 'SourceControlSyncJobStream' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SourceControlSyncJobStreamsListBySyncJob; diff --git a/lib/services/automationManagement/lib/models/watcher.js b/lib/services/automationManagement/lib/models/watcher.js new file mode 100644 index 0000000000..39671ec978 --- /dev/null +++ b/lib/services/automationManagement/lib/models/watcher.js @@ -0,0 +1,189 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * 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 watcher type. + * + * @extends models['TrackedResource'] + */ +class Watcher extends models['TrackedResource'] { + /** + * Create a Watcher. + * @member {number} [executionFrequencyInSeconds] Gets or sets the frequency + * at which the watcher is invoked. + * @member {string} [scriptName] Gets or sets the name of the script the + * watcher is attached to, i.e. the name of an existing runbook. + * @member {object} [scriptParameters] Gets or sets the parameters of the + * script. + * @member {string} [scriptRunOn] Gets or sets the name of the hybrid worker + * group the watcher will run on. + * @member {string} [status] Gets the current status of the watcher. + * @member {date} [creationTime] Gets or sets the creation time. + * @member {date} [lastModifiedTime] Gets or sets the last modified time. + * @member {string} [lastModifiedBy] Details of the user who last modified + * the watcher. + * @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 Watcher + * + * @returns {object} metadata of Watcher + * + */ + mapper() { + return { + required: false, + serializedName: 'Watcher', + type: { + name: 'Composite', + className: 'Watcher', + 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' + } + }, + executionFrequencyInSeconds: { + required: false, + serializedName: 'properties.executionFrequencyInSeconds', + type: { + name: 'Number' + } + }, + scriptName: { + required: false, + serializedName: 'properties.scriptName', + type: { + name: 'String' + } + }, + scriptParameters: { + required: false, + serializedName: 'properties.scriptParameters', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + scriptRunOn: { + required: false, + serializedName: 'properties.scriptRunOn', + type: { + name: 'String' + } + }, + status: { + required: false, + readOnly: true, + serializedName: 'properties.status', + 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' + } + }, + lastModifiedBy: { + required: false, + readOnly: true, + serializedName: 'properties.lastModifiedBy', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Watcher; diff --git a/lib/services/automationManagement/lib/models/watcherListResult.js b/lib/services/automationManagement/lib/models/watcherListResult.js new file mode 100644 index 0000000000..c900c0ef28 --- /dev/null +++ b/lib/services/automationManagement/lib/models/watcherListResult.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 watcher operation. + */ +class WatcherListResult extends Array { + /** + * Create a WatcherListResult. + * @member {string} [nextLink] Gets or sets the next link. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of WatcherListResult + * + * @returns {object} metadata of WatcherListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'WatcherListResult', + type: { + name: 'Composite', + className: 'WatcherListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'WatcherElementType', + type: { + name: 'Composite', + className: 'Watcher' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = WatcherListResult; diff --git a/lib/services/automationManagement/lib/models/watcherUpdateParameters.js b/lib/services/automationManagement/lib/models/watcherUpdateParameters.js new file mode 100644 index 0000000000..30671293e8 --- /dev/null +++ b/lib/services/automationManagement/lib/models/watcherUpdateParameters.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'; + +/** + * Class representing a WatcherUpdateParameters. + */ +class WatcherUpdateParameters { + /** + * Create a WatcherUpdateParameters. + * @member {number} [executionFrequencyInSeconds] Gets or sets the frequency + * at which the watcher is invoked. + * @member {string} [name] Gets or sets the name of the resource. + */ + constructor() { + } + + /** + * Defines the metadata of WatcherUpdateParameters + * + * @returns {object} metadata of WatcherUpdateParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'WatcherUpdateParameters', + type: { + name: 'Composite', + className: 'WatcherUpdateParameters', + modelProperties: { + executionFrequencyInSeconds: { + required: false, + serializedName: 'properties.executionFrequencyInSeconds', + type: { + name: 'Number' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = WatcherUpdateParameters; diff --git a/lib/services/automationManagement/lib/operations/dscNodeConfigurationOperations.js b/lib/services/automationManagement/lib/operations/dscNodeConfigurationOperations.js index 788298eb6b..92be1691db 100644 --- a/lib/services/automationManagement/lib/operations/dscNodeConfigurationOperations.js +++ b/lib/services/automationManagement/lib/operations/dscNodeConfigurationOperations.js @@ -339,44 +339,34 @@ function _get(resourceGroupName, automationAccountName, nodeConfigurationName, o * * @param {object} parameters.source Gets or sets the source. * - * @param {string} parameters.name Name of the node configuration. + * @param {object} [parameters.source.hash] Gets or sets the hash. * - * @param {object} parameters.configuration Gets or sets the configuration of - * the node. - * - * @param {boolean} [parameters.newNodeConfigurationBuildVersionRequired] If a - * new build version of NodeConfiguration is required. - * - * @param {object} parameters.source1 Gets or sets the source. - * - * @param {object} [parameters.source1.hash] Gets or sets the hash. - * - * @param {string} parameters.source1.hash.algorithm Gets or sets the content + * @param {string} parameters.source.hash.algorithm Gets or sets the content * hash algorithm used to hash the content. * - * @param {string} parameters.source1.hash.value Gets or sets expected hash + * @param {string} parameters.source.hash.value Gets or sets expected hash * value of the content. * - * @param {string} [parameters.source1.type] Gets or sets the content source + * @param {string} [parameters.source.type] Gets or sets the content source * type. Possible values include: 'embeddedContent', 'uri' * - * @param {string} [parameters.source1.value] Gets or sets the value of the + * @param {string} [parameters.source.value] Gets or sets the value of the * content. This is based on the content source type. * - * @param {string} [parameters.source1.version] Gets or sets the version of the + * @param {string} [parameters.source.version] Gets or sets the version of the * content. * - * @param {string} parameters.name1 Gets or sets the type of the parameter. - * - * @param {object} parameters.configuration1 Gets or sets the configuration of + * @param {object} parameters.configuration Gets or sets the configuration of * the node. * - * @param {string} [parameters.configuration1.name] Gets or sets the name of - * the Dsc configuration. + * @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 {string} [parameters.name] Name of the node configuration. + * * @param {object} [parameters.tags] Gets or sets the tags attached to the * resource. * @@ -659,44 +649,34 @@ function _listByAutomationAccount(resourceGroupName, automationAccountName, opti * * @param {object} parameters.source Gets or sets the source. * - * @param {string} parameters.name Name of the node configuration. - * - * @param {object} parameters.configuration Gets or sets the configuration of - * the node. - * - * @param {boolean} [parameters.newNodeConfigurationBuildVersionRequired] If a - * new build version of NodeConfiguration is required. - * - * @param {object} parameters.source1 Gets or sets the source. + * @param {object} [parameters.source.hash] Gets or sets the hash. * - * @param {object} [parameters.source1.hash] Gets or sets the hash. - * - * @param {string} parameters.source1.hash.algorithm Gets or sets the content + * @param {string} parameters.source.hash.algorithm Gets or sets the content * hash algorithm used to hash the content. * - * @param {string} parameters.source1.hash.value Gets or sets expected hash + * @param {string} parameters.source.hash.value Gets or sets expected hash * value of the content. * - * @param {string} [parameters.source1.type] Gets or sets the content source + * @param {string} [parameters.source.type] Gets or sets the content source * type. Possible values include: 'embeddedContent', 'uri' * - * @param {string} [parameters.source1.value] Gets or sets the value of the + * @param {string} [parameters.source.value] Gets or sets the value of the * content. This is based on the content source type. * - * @param {string} [parameters.source1.version] Gets or sets the version of the + * @param {string} [parameters.source.version] Gets or sets the version of the * content. * - * @param {string} parameters.name1 Gets or sets the type of the parameter. - * - * @param {object} parameters.configuration1 Gets or sets the configuration of + * @param {object} parameters.configuration Gets or sets the configuration of * the node. * - * @param {string} [parameters.configuration1.name] Gets or sets the name of - * the Dsc configuration. + * @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 {string} [parameters.name] Name of the node configuration. + * * @param {object} [parameters.tags] Gets or sets the tags attached to the * resource. * @@ -1210,44 +1190,34 @@ class DscNodeConfigurationOperations { * * @param {object} parameters.source Gets or sets the source. * - * @param {string} parameters.name Name of the node configuration. - * - * @param {object} parameters.configuration Gets or sets the configuration of - * the node. + * @param {object} [parameters.source.hash] Gets or sets the hash. * - * @param {boolean} [parameters.newNodeConfigurationBuildVersionRequired] If a - * new build version of NodeConfiguration is required. - * - * @param {object} parameters.source1 Gets or sets the source. - * - * @param {object} [parameters.source1.hash] Gets or sets the hash. - * - * @param {string} parameters.source1.hash.algorithm Gets or sets the content + * @param {string} parameters.source.hash.algorithm Gets or sets the content * hash algorithm used to hash the content. * - * @param {string} parameters.source1.hash.value Gets or sets expected hash + * @param {string} parameters.source.hash.value Gets or sets expected hash * value of the content. * - * @param {string} [parameters.source1.type] Gets or sets the content source + * @param {string} [parameters.source.type] Gets or sets the content source * type. Possible values include: 'embeddedContent', 'uri' * - * @param {string} [parameters.source1.value] Gets or sets the value of the + * @param {string} [parameters.source.value] Gets or sets the value of the * content. This is based on the content source type. * - * @param {string} [parameters.source1.version] Gets or sets the version of the + * @param {string} [parameters.source.version] Gets or sets the version of the * content. * - * @param {string} parameters.name1 Gets or sets the type of the parameter. - * - * @param {object} parameters.configuration1 Gets or sets the configuration of + * @param {object} parameters.configuration Gets or sets the configuration of * the node. * - * @param {string} [parameters.configuration1.name] Gets or sets the name of - * the Dsc configuration. + * @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 {string} [parameters.name] Name of the node configuration. + * * @param {object} [parameters.tags] Gets or sets the tags attached to the * resource. * @@ -1290,44 +1260,34 @@ class DscNodeConfigurationOperations { * * @param {object} parameters.source Gets or sets the source. * - * @param {string} parameters.name Name of the node configuration. + * @param {object} [parameters.source.hash] Gets or sets the hash. * - * @param {object} parameters.configuration Gets or sets the configuration of - * the node. - * - * @param {boolean} [parameters.newNodeConfigurationBuildVersionRequired] If a - * new build version of NodeConfiguration is required. - * - * @param {object} parameters.source1 Gets or sets the source. - * - * @param {object} [parameters.source1.hash] Gets or sets the hash. - * - * @param {string} parameters.source1.hash.algorithm Gets or sets the content + * @param {string} parameters.source.hash.algorithm Gets or sets the content * hash algorithm used to hash the content. * - * @param {string} parameters.source1.hash.value Gets or sets expected hash + * @param {string} parameters.source.hash.value Gets or sets expected hash * value of the content. * - * @param {string} [parameters.source1.type] Gets or sets the content source + * @param {string} [parameters.source.type] Gets or sets the content source * type. Possible values include: 'embeddedContent', 'uri' * - * @param {string} [parameters.source1.value] Gets or sets the value of the + * @param {string} [parameters.source.value] Gets or sets the value of the * content. This is based on the content source type. * - * @param {string} [parameters.source1.version] Gets or sets the version of the + * @param {string} [parameters.source.version] Gets or sets the version of the * content. * - * @param {string} parameters.name1 Gets or sets the type of the parameter. - * - * @param {object} parameters.configuration1 Gets or sets the configuration of + * @param {object} parameters.configuration Gets or sets the configuration of * the node. * - * @param {string} [parameters.configuration1.name] Gets or sets the name of - * the Dsc configuration. + * @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 {string} [parameters.name] Name of the node configuration. + * * @param {object} [parameters.tags] Gets or sets the tags attached to the * resource. * @@ -1495,44 +1455,34 @@ class DscNodeConfigurationOperations { * * @param {object} parameters.source Gets or sets the source. * - * @param {string} parameters.name Name of the node configuration. - * - * @param {object} parameters.configuration Gets or sets the configuration of - * the node. - * - * @param {boolean} [parameters.newNodeConfigurationBuildVersionRequired] If a - * new build version of NodeConfiguration is required. - * - * @param {object} parameters.source1 Gets or sets the source. + * @param {object} [parameters.source.hash] Gets or sets the hash. * - * @param {object} [parameters.source1.hash] Gets or sets the hash. - * - * @param {string} parameters.source1.hash.algorithm Gets or sets the content + * @param {string} parameters.source.hash.algorithm Gets or sets the content * hash algorithm used to hash the content. * - * @param {string} parameters.source1.hash.value Gets or sets expected hash + * @param {string} parameters.source.hash.value Gets or sets expected hash * value of the content. * - * @param {string} [parameters.source1.type] Gets or sets the content source + * @param {string} [parameters.source.type] Gets or sets the content source * type. Possible values include: 'embeddedContent', 'uri' * - * @param {string} [parameters.source1.value] Gets or sets the value of the + * @param {string} [parameters.source.value] Gets or sets the value of the * content. This is based on the content source type. * - * @param {string} [parameters.source1.version] Gets or sets the version of the + * @param {string} [parameters.source.version] Gets or sets the version of the * content. * - * @param {string} parameters.name1 Gets or sets the type of the parameter. - * - * @param {object} parameters.configuration1 Gets or sets the configuration of + * @param {object} parameters.configuration Gets or sets the configuration of * the node. * - * @param {string} [parameters.configuration1.name] Gets or sets the name of - * the Dsc configuration. + * @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 {string} [parameters.name] Name of the node configuration. + * * @param {object} [parameters.tags] Gets or sets the tags attached to the * resource. * @@ -1575,44 +1525,34 @@ class DscNodeConfigurationOperations { * * @param {object} parameters.source Gets or sets the source. * - * @param {string} parameters.name Name of the node configuration. - * - * @param {object} parameters.configuration Gets or sets the configuration of - * the node. + * @param {object} [parameters.source.hash] Gets or sets the hash. * - * @param {boolean} [parameters.newNodeConfigurationBuildVersionRequired] If a - * new build version of NodeConfiguration is required. - * - * @param {object} parameters.source1 Gets or sets the source. - * - * @param {object} [parameters.source1.hash] Gets or sets the hash. - * - * @param {string} parameters.source1.hash.algorithm Gets or sets the content + * @param {string} parameters.source.hash.algorithm Gets or sets the content * hash algorithm used to hash the content. * - * @param {string} parameters.source1.hash.value Gets or sets expected hash + * @param {string} parameters.source.hash.value Gets or sets expected hash * value of the content. * - * @param {string} [parameters.source1.type] Gets or sets the content source + * @param {string} [parameters.source.type] Gets or sets the content source * type. Possible values include: 'embeddedContent', 'uri' * - * @param {string} [parameters.source1.value] Gets or sets the value of the + * @param {string} [parameters.source.value] Gets or sets the value of the * content. This is based on the content source type. * - * @param {string} [parameters.source1.version] Gets or sets the version of the + * @param {string} [parameters.source.version] Gets or sets the version of the * content. * - * @param {string} parameters.name1 Gets or sets the type of the parameter. - * - * @param {object} parameters.configuration1 Gets or sets the configuration of + * @param {object} parameters.configuration Gets or sets the configuration of * the node. * - * @param {string} [parameters.configuration1.name] Gets or sets the name of - * the Dsc configuration. + * @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 {string} [parameters.name] Name of the node configuration. + * * @param {object} [parameters.tags] Gets or sets the tags attached to the * resource. * diff --git a/lib/services/automationManagement/lib/operations/index.d.ts b/lib/services/automationManagement/lib/operations/index.d.ts index 9839e76a37..bf7721c3de 100644 --- a/lib/services/automationManagement/lib/operations/index.d.ts +++ b/lib/services/automationManagement/lib/operations/index.d.ts @@ -9396,6 +9396,217 @@ export interface SourceControlSyncJobOperations { listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } +/** + * @class + * SourceControlSyncJobStreams + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface SourceControlSyncJobStreams { + + + /** + * Retrieve a list of sync job streams identified by sync 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 {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. + */ + listBySyncJobWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, sourceControlName: string, sourceControlSyncJobId: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of sync job streams identified by sync 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 {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 {SourceControlSyncJobStreamsListBySyncJob} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {SourceControlSyncJobStreamsListBySyncJob} [result] - The deserialized result object if an error did not occur. + * See {@link SourceControlSyncJobStreamsListBySyncJob} + * for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listBySyncJob(resourceGroupName: string, automationAccountName: string, sourceControlName: string, sourceControlSyncJobId: string, options?: { filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listBySyncJob(resourceGroupName: string, automationAccountName: string, sourceControlName: string, sourceControlSyncJobId: string, callback: ServiceCallback): void; + listBySyncJob(resourceGroupName: string, automationAccountName: string, sourceControlName: string, sourceControlSyncJobId: string, options: { filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a sync job stream identified by stream 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 {string} streamId The id of the sync job stream. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that 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, streamId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a sync job stream identified by stream 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 {string} streamId The id of the sync job stream. + * + * @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 {SourceControlSyncJobStreamById} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {SourceControlSyncJobStreamById} [result] - The deserialized result object if an error did not occur. + * See {@link SourceControlSyncJobStreamById} for more + * information. + * + * {WebResource} [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, streamId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, sourceControlName: string, sourceControlSyncJobId: string, streamId: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, sourceControlName: string, sourceControlSyncJobId: string, streamId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of sync job streams identified by sync job 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. + */ + listBySyncJobNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve a list of sync job streams identified by sync job 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 {SourceControlSyncJobStreamsListBySyncJob} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {SourceControlSyncJobStreamsListBySyncJob} [result] - The deserialized result object if an error did not occur. + * See {@link SourceControlSyncJobStreamsListBySyncJob} + * for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listBySyncJobNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listBySyncJobNext(nextPageLink: string, callback: ServiceCallback): void; + listBySyncJobNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + /** * @class * JobOperations @@ -9758,7 +9969,7 @@ export interface JobOperations { * @param {object} parameters The parameters supplied to the create job * operation. * - * @param {object} parameters.runbook Gets or sets the runbook. + * @param {object} [parameters.runbook] Gets or sets the runbook. * * @param {string} [parameters.runbook.name] Gets or sets the name of the * runbook. @@ -9797,7 +10008,7 @@ export interface JobOperations { * @param {object} parameters The parameters supplied to the create job * operation. * - * @param {object} parameters.runbook Gets or sets the runbook. + * @param {object} [parameters.runbook] Gets or sets the runbook. * * @param {string} [parameters.runbook.name] Gets or sets the name of the * runbook. @@ -11743,44 +11954,34 @@ export interface DscNodeConfigurationOperations { * * @param {object} parameters.source Gets or sets the source. * - * @param {string} parameters.name Name of the node configuration. - * - * @param {object} parameters.configuration Gets or sets the configuration of - * the node. - * - * @param {boolean} [parameters.newNodeConfigurationBuildVersionRequired] If a - * new build version of NodeConfiguration is required. - * - * @param {object} parameters.source1 Gets or sets the source. - * - * @param {object} [parameters.source1.hash] Gets or sets the hash. + * @param {object} [parameters.source.hash] Gets or sets the hash. * - * @param {string} parameters.source1.hash.algorithm Gets or sets the content + * @param {string} parameters.source.hash.algorithm Gets or sets the content * hash algorithm used to hash the content. * - * @param {string} parameters.source1.hash.value Gets or sets expected hash + * @param {string} parameters.source.hash.value Gets or sets expected hash * value of the content. * - * @param {string} [parameters.source1.type] Gets or sets the content source + * @param {string} [parameters.source.type] Gets or sets the content source * type. Possible values include: 'embeddedContent', 'uri' * - * @param {string} [parameters.source1.value] Gets or sets the value of the + * @param {string} [parameters.source.value] Gets or sets the value of the * content. This is based on the content source type. * - * @param {string} [parameters.source1.version] Gets or sets the version of the + * @param {string} [parameters.source.version] Gets or sets the version of the * content. * - * @param {string} parameters.name1 Gets or sets the type of the parameter. - * - * @param {object} parameters.configuration1 Gets or sets the configuration of + * @param {object} parameters.configuration Gets or sets the configuration of * the node. * - * @param {string} [parameters.configuration1.name] Gets or sets the name of - * the Dsc configuration. + * @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 {string} [parameters.name] Name of the node configuration. + * * @param {object} [parameters.tags] Gets or sets the tags attached to the * resource. * @@ -11811,44 +12012,34 @@ export interface DscNodeConfigurationOperations { * * @param {object} parameters.source Gets or sets the source. * - * @param {string} parameters.name Name of the node configuration. - * - * @param {object} parameters.configuration Gets or sets the configuration of - * the node. - * - * @param {boolean} [parameters.newNodeConfigurationBuildVersionRequired] If a - * new build version of NodeConfiguration is required. - * - * @param {object} parameters.source1 Gets or sets the source. - * - * @param {object} [parameters.source1.hash] Gets or sets the hash. + * @param {object} [parameters.source.hash] Gets or sets the hash. * - * @param {string} parameters.source1.hash.algorithm Gets or sets the content + * @param {string} parameters.source.hash.algorithm Gets or sets the content * hash algorithm used to hash the content. * - * @param {string} parameters.source1.hash.value Gets or sets expected hash + * @param {string} parameters.source.hash.value Gets or sets expected hash * value of the content. * - * @param {string} [parameters.source1.type] Gets or sets the content source + * @param {string} [parameters.source.type] Gets or sets the content source * type. Possible values include: 'embeddedContent', 'uri' * - * @param {string} [parameters.source1.value] Gets or sets the value of the + * @param {string} [parameters.source.value] Gets or sets the value of the * content. This is based on the content source type. * - * @param {string} [parameters.source1.version] Gets or sets the version of the + * @param {string} [parameters.source.version] Gets or sets the version of the * content. * - * @param {string} parameters.name1 Gets or sets the type of the parameter. - * - * @param {object} parameters.configuration1 Gets or sets the configuration of + * @param {object} parameters.configuration Gets or sets the configuration of * the node. * - * @param {string} [parameters.configuration1.name] Gets or sets the name of - * the Dsc configuration. + * @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 {string} [parameters.name] Name of the node configuration. + * * @param {object} [parameters.tags] Gets or sets the tags attached to the * resource. * @@ -11974,44 +12165,34 @@ export interface DscNodeConfigurationOperations { * * @param {object} parameters.source Gets or sets the source. * - * @param {string} parameters.name Name of the node configuration. - * - * @param {object} parameters.configuration Gets or sets the configuration of - * the node. - * - * @param {boolean} [parameters.newNodeConfigurationBuildVersionRequired] If a - * new build version of NodeConfiguration is required. - * - * @param {object} parameters.source1 Gets or sets the source. - * - * @param {object} [parameters.source1.hash] Gets or sets the hash. + * @param {object} [parameters.source.hash] Gets or sets the hash. * - * @param {string} parameters.source1.hash.algorithm Gets or sets the content + * @param {string} parameters.source.hash.algorithm Gets or sets the content * hash algorithm used to hash the content. * - * @param {string} parameters.source1.hash.value Gets or sets expected hash + * @param {string} parameters.source.hash.value Gets or sets expected hash * value of the content. * - * @param {string} [parameters.source1.type] Gets or sets the content source + * @param {string} [parameters.source.type] Gets or sets the content source * type. Possible values include: 'embeddedContent', 'uri' * - * @param {string} [parameters.source1.value] Gets or sets the value of the + * @param {string} [parameters.source.value] Gets or sets the value of the * content. This is based on the content source type. * - * @param {string} [parameters.source1.version] Gets or sets the version of the + * @param {string} [parameters.source.version] Gets or sets the version of the * content. * - * @param {string} parameters.name1 Gets or sets the type of the parameter. - * - * @param {object} parameters.configuration1 Gets or sets the configuration of + * @param {object} parameters.configuration Gets or sets the configuration of * the node. * - * @param {string} [parameters.configuration1.name] Gets or sets the name of - * the Dsc configuration. + * @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 {string} [parameters.name] Name of the node configuration. + * * @param {object} [parameters.tags] Gets or sets the tags attached to the * resource. * @@ -12042,44 +12223,34 @@ export interface DscNodeConfigurationOperations { * * @param {object} parameters.source Gets or sets the source. * - * @param {string} parameters.name Name of the node configuration. - * - * @param {object} parameters.configuration Gets or sets the configuration of - * the node. - * - * @param {boolean} [parameters.newNodeConfigurationBuildVersionRequired] If a - * new build version of NodeConfiguration is required. - * - * @param {object} parameters.source1 Gets or sets the source. - * - * @param {object} [parameters.source1.hash] Gets or sets the hash. + * @param {object} [parameters.source.hash] Gets or sets the hash. * - * @param {string} parameters.source1.hash.algorithm Gets or sets the content + * @param {string} parameters.source.hash.algorithm Gets or sets the content * hash algorithm used to hash the content. * - * @param {string} parameters.source1.hash.value Gets or sets expected hash + * @param {string} parameters.source.hash.value Gets or sets expected hash * value of the content. * - * @param {string} [parameters.source1.type] Gets or sets the content source + * @param {string} [parameters.source.type] Gets or sets the content source * type. Possible values include: 'embeddedContent', 'uri' * - * @param {string} [parameters.source1.value] Gets or sets the value of the + * @param {string} [parameters.source.value] Gets or sets the value of the * content. This is based on the content source type. * - * @param {string} [parameters.source1.version] Gets or sets the version of the + * @param {string} [parameters.source.version] Gets or sets the version of the * content. * - * @param {string} parameters.name1 Gets or sets the type of the parameter. - * - * @param {object} parameters.configuration1 Gets or sets the configuration of + * @param {object} parameters.configuration Gets or sets the configuration of * the node. * - * @param {string} [parameters.configuration1.name] Gets or sets the name of - * the Dsc configuration. + * @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 {string} [parameters.name] Name of the node configuration. + * * @param {object} [parameters.tags] Gets or sets the tags attached to the * resource. * @@ -12172,3 +12343,567 @@ export interface DscNodeConfigurationOperations { listByAutomationAccountNext(nextPageLink: string, callback: ServiceCallback): void; listByAutomationAccountNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } + +/** + * @class + * WatcherOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the AutomationClient. + */ +export interface WatcherOperations { + + + /** + * Create the watcher identified by watcher name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} watcherName The watcher name. + * + * @param {object} parameters The create or update parameters for watcher. + * + * @param {number} [parameters.executionFrequencyInSeconds] Gets or sets the + * frequency at which the watcher is invoked. + * + * @param {string} [parameters.scriptName] Gets or sets the name of the script + * the watcher is attached to, i.e. the name of an existing runbook. + * + * @param {object} [parameters.scriptParameters] Gets or sets the parameters of + * the script. + * + * @param {string} [parameters.scriptRunOn] Gets or sets the name of the hybrid + * worker group the watcher will run on. + * + * @param {string} [parameters.description] Gets or sets the description. + * + * @param {string} [parameters.etag] Gets or sets the etag of the resource. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} [parameters.location] The Azure Region where the resource + * lives + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that 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, watcherName: string, parameters: models.Watcher, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create the watcher identified by watcher name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} watcherName The watcher name. + * + * @param {object} parameters The create or update parameters for watcher. + * + * @param {number} [parameters.executionFrequencyInSeconds] Gets or sets the + * frequency at which the watcher is invoked. + * + * @param {string} [parameters.scriptName] Gets or sets the name of the script + * the watcher is attached to, i.e. the name of an existing runbook. + * + * @param {object} [parameters.scriptParameters] Gets or sets the parameters of + * the script. + * + * @param {string} [parameters.scriptRunOn] Gets or sets the name of the hybrid + * worker group the watcher will run on. + * + * @param {string} [parameters.description] Gets or sets the description. + * + * @param {string} [parameters.etag] Gets or sets the etag of the resource. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} [parameters.location] The Azure Region where the resource + * lives + * + * @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 {Watcher} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Watcher} [result] - The deserialized result object if an error did not occur. + * See {@link Watcher} for more information. + * + * {WebResource} [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, watcherName: string, parameters: models.Watcher, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, automationAccountName: string, watcherName: string, parameters: models.Watcher, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, automationAccountName: string, watcherName: string, parameters: models.Watcher, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve the watcher identified by watcher name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} watcherName The watcher 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, watcherName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the watcher identified by watcher name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} watcherName The watcher 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 {Watcher} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Watcher} [result] - The deserialized result object if an error did not occur. + * See {@link Watcher} for more information. + * + * {WebResource} [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, watcherName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, automationAccountName: string, watcherName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, automationAccountName: string, watcherName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Update the watcher identified by watcher name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} watcherName The watcher name. + * + * @param {object} parameters The update parameters for watcher. + * + * @param {number} [parameters.executionFrequencyInSeconds] Gets or sets the + * frequency at which the watcher is invoked. + * + * @param {string} [parameters.name] Gets or sets the name of 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, watcherName: string, parameters: models.WatcherUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Update the watcher identified by watcher name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} watcherName The watcher name. + * + * @param {object} parameters The update parameters for watcher. + * + * @param {number} [parameters.executionFrequencyInSeconds] Gets or sets the + * frequency at which the watcher is invoked. + * + * @param {string} [parameters.name] Gets or sets the name of 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 {Watcher} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Watcher} [result] - The deserialized result object if an error did not occur. + * See {@link Watcher} for more information. + * + * {WebResource} [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, watcherName: string, parameters: models.WatcherUpdateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, automationAccountName: string, watcherName: string, parameters: models.WatcherUpdateParameters, callback: ServiceCallback): void; + update(resourceGroupName: string, automationAccountName: string, watcherName: string, parameters: models.WatcherUpdateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Delete the watcher by name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} watcherName The watcher 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, watcherName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Delete the watcher by name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} watcherName The watcher 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, watcherName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, automationAccountName: string, watcherName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, automationAccountName: string, watcherName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Resume the watcher identified by watcher name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} watcherName The watcher 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. + */ + startWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, watcherName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Resume the watcher identified by watcher name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} watcherName The watcher 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. + */ + start(resourceGroupName: string, automationAccountName: string, watcherName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + start(resourceGroupName: string, automationAccountName: string, watcherName: string, callback: ServiceCallback): void; + start(resourceGroupName: string, automationAccountName: string, watcherName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Resume the watcher identified by watcher name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} watcherName The watcher 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, watcherName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Resume the watcher identified by watcher name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} watcherName The watcher 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, watcherName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + stop(resourceGroupName: string, automationAccountName: string, watcherName: string, callback: ServiceCallback): void; + stop(resourceGroupName: string, automationAccountName: string, watcherName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve a list of watchers. + * + * @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 watchers. + * + * @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 {WatcherListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {WatcherListResult} [result] - The deserialized result object if an error did not occur. + * See {@link WatcherListResult} for more information. + * + * {WebResource} [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 watchers. + * + * @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 watchers. + * + * @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 {WatcherListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {WatcherListResult} [result] - The deserialized result object if an error did not occur. + * See {@link WatcherListResult} for more information. + * + * {WebResource} [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/operations/index.js b/lib/services/automationManagement/lib/operations/index.js index 63aeffd32f..a26014da0f 100644 --- a/lib/services/automationManagement/lib/operations/index.js +++ b/lib/services/automationManagement/lib/operations/index.js @@ -43,6 +43,7 @@ exports.SoftwareUpdateConfigurationRuns = require('./softwareUpdateConfiguration exports.SoftwareUpdateConfigurationMachineRuns = require('./softwareUpdateConfigurationMachineRuns'); exports.SourceControlOperations = require('./sourceControlOperations'); exports.SourceControlSyncJobOperations = require('./sourceControlSyncJobOperations'); +exports.SourceControlSyncJobStreams = require('./sourceControlSyncJobStreams'); exports.JobOperations = require('./jobOperations'); exports.JobStreamOperations = require('./jobStreamOperations'); exports.AgentRegistrationInformation = require('./agentRegistrationInformation'); @@ -51,3 +52,4 @@ exports.NodeReports = require('./nodeReports'); exports.DscCompilationJobOperations = require('./dscCompilationJobOperations'); exports.DscCompilationJobStream = require('./dscCompilationJobStream'); exports.DscNodeConfigurationOperations = require('./dscNodeConfigurationOperations'); +exports.WatcherOperations = require('./watcherOperations'); diff --git a/lib/services/automationManagement/lib/operations/jobOperations.js b/lib/services/automationManagement/lib/operations/jobOperations.js index df4b700f0b..3960d66031 100644 --- a/lib/services/automationManagement/lib/operations/jobOperations.js +++ b/lib/services/automationManagement/lib/operations/jobOperations.js @@ -868,7 +868,7 @@ function _get(resourceGroupName, automationAccountName, jobName, options, callba * @param {object} parameters The parameters supplied to the create job * operation. * - * @param {object} parameters.runbook Gets or sets the runbook. + * @param {object} [parameters.runbook] Gets or sets the runbook. * * @param {string} [parameters.runbook.name] Gets or sets the name of the * runbook. @@ -2039,7 +2039,7 @@ class JobOperations { * @param {object} parameters The parameters supplied to the create job * operation. * - * @param {object} parameters.runbook Gets or sets the runbook. + * @param {object} [parameters.runbook] Gets or sets the runbook. * * @param {string} [parameters.runbook.name] Gets or sets the name of the * runbook. @@ -2090,7 +2090,7 @@ class JobOperations { * @param {object} parameters The parameters supplied to the create job * operation. * - * @param {object} parameters.runbook Gets or sets the runbook. + * @param {object} [parameters.runbook] Gets or sets the runbook. * * @param {string} [parameters.runbook.name] Gets or sets the name of the * runbook. diff --git a/lib/services/automationManagement/lib/operations/softwareUpdateConfigurationMachineRuns.js b/lib/services/automationManagement/lib/operations/softwareUpdateConfigurationMachineRuns.js index dd36c0ac40..8cc0d121b6 100644 --- a/lib/services/automationManagement/lib/operations/softwareUpdateConfigurationMachineRuns.js +++ b/lib/services/automationManagement/lib/operations/softwareUpdateConfigurationMachineRuns.js @@ -149,12 +149,13 @@ function _getById(resourceGroupName, automationAccountName, softwareUpdateConfig 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -349,12 +350,13 @@ function _list(resourceGroupName, automationAccountName, options, callback) { 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { diff --git a/lib/services/automationManagement/lib/operations/softwareUpdateConfigurationRuns.js b/lib/services/automationManagement/lib/operations/softwareUpdateConfigurationRuns.js index 825c7c999e..e4a7cf8515 100644 --- a/lib/services/automationManagement/lib/operations/softwareUpdateConfigurationRuns.js +++ b/lib/services/automationManagement/lib/operations/softwareUpdateConfigurationRuns.js @@ -149,12 +149,13 @@ function _getById(resourceGroupName, automationAccountName, softwareUpdateConfig 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -348,12 +349,13 @@ function _list(resourceGroupName, automationAccountName, options, callback) { 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { diff --git a/lib/services/automationManagement/lib/operations/softwareUpdateConfigurations.js b/lib/services/automationManagement/lib/operations/softwareUpdateConfigurations.js index 60620e732a..fced67c954 100644 --- a/lib/services/automationManagement/lib/operations/softwareUpdateConfigurations.js +++ b/lib/services/automationManagement/lib/operations/softwareUpdateConfigurations.js @@ -273,7 +273,7 @@ function _create(resourceGroupName, automationAccountName, softwareUpdateConfigu return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 201 && statusCode !== 400 && statusCode !== 404 && statusCode !== 409) { + if (statusCode !== 200 && statusCode !== 201) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -283,12 +283,13 @@ function _create(resourceGroupName, automationAccountName, softwareUpdateConfigu 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -475,12 +476,13 @@ function _getByName(resourceGroupName, automationAccountName, softwareUpdateConf 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -638,7 +640,7 @@ function _deleteMethod(resourceGroupName, automationAccountName, softwareUpdateC return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 204 && statusCode !== 404) { + if (statusCode !== 200 && statusCode !== 204) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -648,12 +650,13 @@ function _deleteMethod(resourceGroupName, automationAccountName, softwareUpdateC 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -808,12 +811,13 @@ function _list(resourceGroupName, automationAccountName, options, callback) { 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { diff --git a/lib/services/automationManagement/lib/operations/sourceControlSyncJobStreams.js b/lib/services/automationManagement/lib/operations/sourceControlSyncJobStreams.js new file mode 100644 index 0000000000..b4ca7b0de9 --- /dev/null +++ b/lib/services/automationManagement/lib/operations/sourceControlSyncJobStreams.js @@ -0,0 +1,801 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * 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 sync job streams identified by sync 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 {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 SourceControlSyncJobStreamsListBySyncJob} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listBySyncJob(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 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 (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 (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/{sourceControlSyncJobId}/streams'; + 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 = []; + 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['SourceControlSyncJobStreamsListBySyncJob']().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 sync job stream identified by stream 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 {string} streamId The id of the sync job stream. + * + * @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 SourceControlSyncJobStreamById} for more + * information. + * + * {object} [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, streamId, 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 (streamId === null || streamId === undefined || typeof streamId.valueOf() !== 'string') { + throw new Error('streamId 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}/sourceControlSyncJobs/{sourceControlSyncJobId}/streams/{streamId}'; + 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('{streamId}', encodeURIComponent(streamId)); + 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['SourceControlSyncJobStreamById']().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 sync job streams identified by sync job 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 SourceControlSyncJobStreamsListBySyncJob} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listBySyncJobNext(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['SourceControlSyncJobStreamsListBySyncJob']().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 SourceControlSyncJobStreams. */ +class SourceControlSyncJobStreams { + /** + * Create a SourceControlSyncJobStreams. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listBySyncJob = _listBySyncJob; + this._get = _get; + this._listBySyncJobNext = _listBySyncJobNext; + } + + /** + * Retrieve a list of sync job streams identified by sync 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 {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. + */ + listBySyncJobWithHttpOperationResponse(resourceGroupName, automationAccountName, sourceControlName, sourceControlSyncJobId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listBySyncJob(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 a list of sync job streams identified by sync 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 {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 {SourceControlSyncJobStreamsListBySyncJob} - 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 SourceControlSyncJobStreamsListBySyncJob} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listBySyncJob(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._listBySyncJob(resourceGroupName, automationAccountName, sourceControlName, sourceControlSyncJobId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listBySyncJob(resourceGroupName, automationAccountName, sourceControlName, sourceControlSyncJobId, options, optionalCallback); + } + } + + /** + * Retrieve a sync job stream identified by stream 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 {string} streamId The id of the sync job stream. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, streamId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, automationAccountName, sourceControlName, sourceControlSyncJobId, streamId, 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 sync job stream identified by stream 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 {string} streamId The id of the sync job stream. + * + * @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 {SourceControlSyncJobStreamById} - 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 SourceControlSyncJobStreamById} for more + * information. + * + * {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, streamId, 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, streamId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, automationAccountName, sourceControlName, sourceControlSyncJobId, streamId, options, optionalCallback); + } + } + + /** + * Retrieve a list of sync job streams identified by sync job 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. + */ + listBySyncJobNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listBySyncJobNext(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 sync job streams identified by sync job 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 {SourceControlSyncJobStreamsListBySyncJob} - 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 SourceControlSyncJobStreamsListBySyncJob} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listBySyncJobNext(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._listBySyncJobNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listBySyncJobNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = SourceControlSyncJobStreams; diff --git a/lib/services/automationManagement/lib/operations/watcherOperations.js b/lib/services/automationManagement/lib/operations/watcherOperations.js new file mode 100644 index 0000000000..14fba40d13 --- /dev/null +++ b/lib/services/automationManagement/lib/operations/watcherOperations.js @@ -0,0 +1,2114 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * 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 the watcher identified by watcher name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} watcherName The watcher name. + * + * @param {object} parameters The create or update parameters for watcher. + * + * @param {number} [parameters.executionFrequencyInSeconds] Gets or sets the + * frequency at which the watcher is invoked. + * + * @param {string} [parameters.scriptName] Gets or sets the name of the script + * the watcher is attached to, i.e. the name of an existing runbook. + * + * @param {object} [parameters.scriptParameters] Gets or sets the parameters of + * the script. + * + * @param {string} [parameters.scriptRunOn] Gets or sets the name of the hybrid + * worker group the watcher will run on. + * + * @param {string} [parameters.description] Gets or sets the description. + * + * @param {string} [parameters.etag] Gets or sets the etag of the resource. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} [parameters.location] The Azure Region where the resource + * lives + * + * @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 Watcher} for more information. + * + * {object} [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, watcherName, 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 (watcherName === null || watcherName === undefined || typeof watcherName.valueOf() !== 'string') { + throw new Error('watcherName 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}/watchers/{watcherName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{watcherName}', encodeURIComponent(watcherName)); + 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['Watcher']().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['Watcher']().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['Watcher']().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 the watcher identified by watcher name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} watcherName The watcher 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 Watcher} for more information. + * + * {object} [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, watcherName, 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 (watcherName === null || watcherName === undefined || typeof watcherName.valueOf() !== 'string') { + throw new Error('watcherName 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}/watchers/{watcherName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{watcherName}', encodeURIComponent(watcherName)); + 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['Watcher']().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 watcher identified by watcher name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} watcherName The watcher name. + * + * @param {object} parameters The update parameters for watcher. + * + * @param {number} [parameters.executionFrequencyInSeconds] Gets or sets the + * frequency at which the watcher is invoked. + * + * @param {string} [parameters.name] Gets or sets the name of 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 Watcher} for more information. + * + * {object} [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, watcherName, 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 (watcherName === null || watcherName === undefined || typeof watcherName.valueOf() !== 'string') { + throw new Error('watcherName 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}/watchers/{watcherName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{watcherName}', encodeURIComponent(watcherName)); + 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['WatcherUpdateParameters']().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['Watcher']().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 watcher by name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} watcherName The watcher 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, watcherName, 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 (watcherName === null || watcherName === undefined || typeof watcherName.valueOf() !== 'string') { + throw new Error('watcherName 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}/watchers/{watcherName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{watcherName}', encodeURIComponent(watcherName)); + 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); + }); +} + +/** + * Resume the watcher identified by watcher name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} watcherName The watcher 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 _start(resourceGroupName, automationAccountName, watcherName, 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 (watcherName === null || watcherName === undefined || typeof watcherName.valueOf() !== 'string') { + throw new Error('watcherName 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}/watchers/{watcherName}/start'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{watcherName}', encodeURIComponent(watcherName)); + 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; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Resume the watcher identified by watcher name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} watcherName The watcher 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, watcherName, 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 (watcherName === null || watcherName === undefined || typeof watcherName.valueOf() !== 'string') { + throw new Error('watcherName 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}/watchers/{watcherName}/stop'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{automationAccountName}', encodeURIComponent(automationAccountName)); + requestUrl = requestUrl.replace('{watcherName}', encodeURIComponent(watcherName)); + 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; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Retrieve a list of watchers. + * + * @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 WatcherListResult} for more information. + * + * {object} [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}/watchers'; + 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['WatcherListResult']().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 watchers. + * + * @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 WatcherListResult} for more information. + * + * {object} [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['WatcherListResult']().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 WatcherOperations. */ +class WatcherOperations { + /** + * Create a WatcherOperations. + * @param {AutomationClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._createOrUpdate = _createOrUpdate; + this._get = _get; + this._update = _update; + this._deleteMethod = _deleteMethod; + this._start = _start; + this._stop = _stop; + this._listByAutomationAccount = _listByAutomationAccount; + this._listByAutomationAccountNext = _listByAutomationAccountNext; + } + + /** + * Create the watcher identified by watcher name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} watcherName The watcher name. + * + * @param {object} parameters The create or update parameters for watcher. + * + * @param {number} [parameters.executionFrequencyInSeconds] Gets or sets the + * frequency at which the watcher is invoked. + * + * @param {string} [parameters.scriptName] Gets or sets the name of the script + * the watcher is attached to, i.e. the name of an existing runbook. + * + * @param {object} [parameters.scriptParameters] Gets or sets the parameters of + * the script. + * + * @param {string} [parameters.scriptRunOn] Gets or sets the name of the hybrid + * worker group the watcher will run on. + * + * @param {string} [parameters.description] Gets or sets the description. + * + * @param {string} [parameters.etag] Gets or sets the etag of the resource. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} [parameters.location] The Azure Region where the resource + * lives + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [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, watcherName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, automationAccountName, watcherName, 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 watcher identified by watcher name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} watcherName The watcher name. + * + * @param {object} parameters The create or update parameters for watcher. + * + * @param {number} [parameters.executionFrequencyInSeconds] Gets or sets the + * frequency at which the watcher is invoked. + * + * @param {string} [parameters.scriptName] Gets or sets the name of the script + * the watcher is attached to, i.e. the name of an existing runbook. + * + * @param {object} [parameters.scriptParameters] Gets or sets the parameters of + * the script. + * + * @param {string} [parameters.scriptRunOn] Gets or sets the name of the hybrid + * worker group the watcher will run on. + * + * @param {string} [parameters.description] Gets or sets the description. + * + * @param {string} [parameters.etag] Gets or sets the etag of the resource. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} [parameters.location] The Azure Region where the resource + * lives + * + * @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 {Watcher} - 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 Watcher} for more information. + * + * {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, watcherName, 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, watcherName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, automationAccountName, watcherName, parameters, options, optionalCallback); + } + } + + /** + * Retrieve the watcher identified by watcher name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} watcherName The watcher 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, watcherName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, automationAccountName, watcherName, 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 watcher identified by watcher name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} watcherName The watcher 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 {Watcher} - 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 Watcher} for more information. + * + * {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, watcherName, 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, watcherName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, automationAccountName, watcherName, options, optionalCallback); + } + } + + /** + * Update the watcher identified by watcher name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} watcherName The watcher name. + * + * @param {object} parameters The update parameters for watcher. + * + * @param {number} [parameters.executionFrequencyInSeconds] Gets or sets the + * frequency at which the watcher is invoked. + * + * @param {string} [parameters.name] Gets or sets the name of 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, watcherName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, automationAccountName, watcherName, 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 watcher identified by watcher name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} watcherName The watcher name. + * + * @param {object} parameters The update parameters for watcher. + * + * @param {number} [parameters.executionFrequencyInSeconds] Gets or sets the + * frequency at which the watcher is invoked. + * + * @param {string} [parameters.name] Gets or sets the name of 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 {Watcher} - 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 Watcher} for more information. + * + * {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, watcherName, 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, watcherName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, automationAccountName, watcherName, parameters, options, optionalCallback); + } + } + + /** + * Delete the watcher by name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} watcherName The watcher 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, watcherName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, automationAccountName, watcherName, 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 watcher by name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} watcherName The watcher 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, watcherName, 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, watcherName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, automationAccountName, watcherName, options, optionalCallback); + } + } + + /** + * Resume the watcher identified by watcher name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} watcherName The watcher 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. + */ + startWithHttpOperationResponse(resourceGroupName, automationAccountName, watcherName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._start(resourceGroupName, automationAccountName, watcherName, 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 watcher identified by watcher name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} watcherName The watcher 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. + */ + start(resourceGroupName, automationAccountName, watcherName, 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._start(resourceGroupName, automationAccountName, watcherName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._start(resourceGroupName, automationAccountName, watcherName, options, optionalCallback); + } + } + + /** + * Resume the watcher identified by watcher name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} watcherName The watcher 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, watcherName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._stop(resourceGroupName, automationAccountName, watcherName, 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 watcher identified by watcher name. + * + * @param {string} resourceGroupName Name of an Azure Resource group. + * + * @param {string} automationAccountName The automation account name. + * + * @param {string} watcherName The watcher 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, watcherName, 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, watcherName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._stop(resourceGroupName, automationAccountName, watcherName, options, optionalCallback); + } + } + + /** + * Retrieve a list of watchers. + * + * @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 watchers. + * + * @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 {WatcherListResult} - 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 WatcherListResult} for more information. + * + * {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 watchers. + * + * @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 watchers. + * + * @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 {WatcherListResult} - 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 WatcherListResult} for more information. + * + * {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 = WatcherOperations; diff --git a/lib/services/automationManagement/package.json b/lib/services/automationManagement/package.json index 316d5d998e..97b4adff35 100644 --- a/lib/services/automationManagement/package.json +++ b/lib/services/automationManagement/package.json @@ -4,10 +4,13 @@ "description": "AutomationClient Library with typescript type definitions for node", "version": "3.0.0-preview", "dependencies": { - "ms-rest": "^2.3.2", + "ms-rest": "^2.3.3", "ms-rest-azure": "^2.5.5" }, - "keywords": [ "node", "azure" ], + "keywords": [ + "node", + "azure" + ], "license": "MIT", "main": "./lib/automationClient.js", "types": "./lib/automationClient.d.ts",