Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.

[AutoPR automation/resource-manager] Fixing swagger issues breaking SDK and blocking cmdlet work #2692

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/services/automationManagement/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
---
uid: azure-arm-automation
summary: *content

---
# Microsoft Azure SDK for Node.js - AutomationClient
This project provides a Node.js package for accessing Azure. Right now it supports:
- **Node.js version 6.x.x or higher**
Expand Down Expand Up @@ -28,7 +33,7 @@ msRestAzure.interactiveLogin().then((creds) => {
console.log(result);
});
}).catch((err) => {
console.log('An error ocurred:');
console.log('An error occurred:');
console.dir(err, {depth: null, colors: true});
});

Expand Down
13 changes: 13 additions & 0 deletions lib/services/automationManagement/lib/models/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2904,6 +2904,19 @@ export interface SourceControlSyncJob {
startedBy?: string;
}

/**
* @class
* Initializes a new instance of the SourceControlSyncJobCreateParameters class.
* @constructor
* The parameters supplied to the create source control sync job operation.
*
* @member {string} [commitId] Sets the commit id of the source control sync
* job.
*/
export interface SourceControlSyncJobCreateParameters {
commitId?: string;
}

/**
* @class
* Initializes a new instance of the SourceControlSyncJobByIdErrors class.
Expand Down
1 change: 1 addition & 0 deletions lib/services/automationManagement/lib/models/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ exports.SourceControlCreateOrUpdateParameters = require('./sourceControlCreateOr
exports.SourceControl = require('./sourceControl');
exports.SourceControlUpdateParameters = require('./sourceControlUpdateParameters');
exports.SourceControlSyncJob = require('./sourceControlSyncJob');
exports.SourceControlSyncJobCreateParameters = require('./sourceControlSyncJobCreateParameters');
exports.SourceControlSyncJobByIdErrors = require('./sourceControlSyncJobByIdErrors');
exports.SourceControlSyncJobById = require('./sourceControlSyncJobById');
exports.DscNode = require('./dscNode');
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/

'use strict';

/**
* The parameters supplied to the create source control sync job operation.
*
*/
class SourceControlSyncJobCreateParameters {
/**
* Create a SourceControlSyncJobCreateParameters.
* @member {string} [commitId] Sets the commit id of the source control sync
* job.
*/
constructor() {
}

/**
* Defines the metadata of SourceControlSyncJobCreateParameters
*
* @returns {object} metadata of SourceControlSyncJobCreateParameters
*
*/
mapper() {
return {
required: false,
serializedName: 'SourceControlSyncJobCreateParameters',
type: {
name: 'Composite',
className: 'SourceControlSyncJobCreateParameters',
modelProperties: {
commitId: {
required: false,
serializedName: 'properties.commitId',
type: {
name: 'String'
}
}
}
}
};
}
}

module.exports = SourceControlSyncJobCreateParameters;
20 changes: 16 additions & 4 deletions lib/services/automationManagement/lib/operations/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9084,6 +9084,12 @@ export interface SourceControlSyncJobOperations {
*
* @param {uuid} sourceControlSyncJobId The source control sync job id.
*
* @param {object} parameters The parameters supplied to the create source
* control sync job operation.
*
* @param {string} [parameters.commitId] Sets the commit id of the source
* control sync job.
*
* @param {object} [options] Optional Parameters.
*
* @param {object} [options.customHeaders] Headers that will be added to the
Expand All @@ -9095,7 +9101,7 @@ export interface SourceControlSyncJobOperations {
*
* @reject {Error|ServiceError} - The error object.
*/
createWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, sourceControlName: string, sourceControlSyncJobId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise<HttpOperationResponse<models.SourceControlSyncJob>>;
createWithHttpOperationResponse(resourceGroupName: string, automationAccountName: string, sourceControlName: string, sourceControlSyncJobId: string, parameters: models.SourceControlSyncJobCreateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise<HttpOperationResponse<models.SourceControlSyncJob>>;

/**
* Creates the sync job for a source control.
Expand All @@ -9108,6 +9114,12 @@ export interface SourceControlSyncJobOperations {
*
* @param {uuid} sourceControlSyncJobId The source control sync job id.
*
* @param {object} parameters The parameters supplied to the create source
* control sync job operation.
*
* @param {string} [parameters.commitId] Sets the commit id of the source
* control sync job.
*
* @param {object} [options] Optional Parameters.
*
* @param {object} [options.customHeaders] Headers that will be added to the
Expand Down Expand Up @@ -9135,9 +9147,9 @@ export interface SourceControlSyncJobOperations {
*
* {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur.
*/
create(resourceGroupName: string, automationAccountName: string, sourceControlName: string, sourceControlSyncJobId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise<models.SourceControlSyncJob>;
create(resourceGroupName: string, automationAccountName: string, sourceControlName: string, sourceControlSyncJobId: string, callback: ServiceCallback<models.SourceControlSyncJob>): void;
create(resourceGroupName: string, automationAccountName: string, sourceControlName: string, sourceControlSyncJobId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback<models.SourceControlSyncJob>): void;
create(resourceGroupName: string, automationAccountName: string, sourceControlName: string, sourceControlSyncJobId: string, parameters: models.SourceControlSyncJobCreateParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise<models.SourceControlSyncJob>;
create(resourceGroupName: string, automationAccountName: string, sourceControlName: string, sourceControlSyncJobId: string, parameters: models.SourceControlSyncJobCreateParameters, callback: ServiceCallback<models.SourceControlSyncJob>): void;
create(resourceGroupName: string, automationAccountName: string, sourceControlName: string, sourceControlSyncJobId: string, parameters: models.SourceControlSyncJobCreateParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback<models.SourceControlSyncJob>): void;


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ const WebResource = msRest.WebResource;
*
* @param {uuid} sourceControlSyncJobId The source control sync job id.
*
* @param {object} parameters The parameters supplied to the create source
* control sync job operation.
*
* @param {string} [parameters.commitId] Sets the commit id of the source
* control sync job.
*
* @param {object} [options] Optional Parameters.
*
* @param {object} [options.customHeaders] Headers that will be added to the
Expand All @@ -43,7 +49,7 @@ const WebResource = msRest.WebResource;
*
* {stream} [response] - The HTTP Response stream if an error did not occur.
*/
function _create(resourceGroupName, automationAccountName, sourceControlName, sourceControlSyncJobId, options, callback) {
function _create(resourceGroupName, automationAccountName, sourceControlName, sourceControlSyncJobId, parameters, options, callback) {
/* jshint validthis: true */
let client = this.client;
if(!callback && typeof options === 'function') {
Expand Down Expand Up @@ -82,6 +88,9 @@ function _create(resourceGroupName, automationAccountName, sourceControlName, so
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 (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.');
}
Expand Down Expand Up @@ -126,7 +135,21 @@ function _create(resourceGroupName, automationAccountName, sourceControlName, so
}
}
}
httpRequest.body = null;
// Serialize Request
let requestContent = null;
let requestModel = null;
try {
if (parameters !== null && parameters !== undefined) {
let requestModelMapper = new client.models['SourceControlSyncJobCreateParameters']().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) {
Expand Down Expand Up @@ -683,6 +706,12 @@ class SourceControlSyncJobOperations {
*
* @param {uuid} sourceControlSyncJobId The source control sync job id.
*
* @param {object} parameters The parameters supplied to the create source
* control sync job operation.
*
* @param {string} [parameters.commitId] Sets the commit id of the source
* control sync job.
*
* @param {object} [options] Optional Parameters.
*
* @param {object} [options.customHeaders] Headers that will be added to the
Expand All @@ -694,11 +723,11 @@ class SourceControlSyncJobOperations {
*
* @reject {Error} - The error object.
*/
createWithHttpOperationResponse(resourceGroupName, automationAccountName, sourceControlName, sourceControlSyncJobId, options) {
createWithHttpOperationResponse(resourceGroupName, automationAccountName, sourceControlName, sourceControlSyncJobId, parameters, options) {
let client = this.client;
let self = this;
return new Promise((resolve, reject) => {
self._create(resourceGroupName, automationAccountName, sourceControlName, sourceControlSyncJobId, options, (err, result, request, response) => {
self._create(resourceGroupName, automationAccountName, sourceControlName, sourceControlSyncJobId, parameters, options, (err, result, request, response) => {
let httpOperationResponse = new msRest.HttpOperationResponse(request, response);
httpOperationResponse.body = result;
if (err) { reject(err); }
Expand All @@ -719,6 +748,12 @@ class SourceControlSyncJobOperations {
*
* @param {uuid} sourceControlSyncJobId The source control sync job id.
*
* @param {object} parameters The parameters supplied to the create source
* control sync job operation.
*
* @param {string} [parameters.commitId] Sets the commit id of the source
* control sync job.
*
* @param {object} [options] Optional Parameters.
*
* @param {object} [options.customHeaders] Headers that will be added to the
Expand Down Expand Up @@ -746,7 +781,7 @@ class SourceControlSyncJobOperations {
*
* {stream} [response] - The HTTP Response stream if an error did not occur.
*/
create(resourceGroupName, automationAccountName, sourceControlName, sourceControlSyncJobId, options, optionalCallback) {
create(resourceGroupName, automationAccountName, sourceControlName, sourceControlSyncJobId, parameters, options, optionalCallback) {
let client = this.client;
let self = this;
if (!optionalCallback && typeof options === 'function') {
Expand All @@ -755,14 +790,14 @@ class SourceControlSyncJobOperations {
}
if (!optionalCallback) {
return new Promise((resolve, reject) => {
self._create(resourceGroupName, automationAccountName, sourceControlName, sourceControlSyncJobId, options, (err, result, request, response) => {
self._create(resourceGroupName, automationAccountName, sourceControlName, sourceControlSyncJobId, parameters, options, (err, result, request, response) => {
if (err) { reject(err); }
else { resolve(result); }
return;
});
});
} else {
return self._create(resourceGroupName, automationAccountName, sourceControlName, sourceControlSyncJobId, options, optionalCallback);
return self._create(resourceGroupName, automationAccountName, sourceControlName, sourceControlSyncJobId, parameters, options, optionalCallback);
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/services/automationManagement/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "AutomationClient Library with typescript type definitions for node",
"version": "3.0.0-preview",
"dependencies": {
"ms-rest": "^2.3.3",
"ms-rest": "^2.3.2",
"ms-rest-azure": "^2.5.5"
},
"keywords": [ "node", "azure" ],
Expand Down