From 07441e86b2a15799e6afd696034acef779450917 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 27 Jun 2018 22:07:12 +0000 Subject: [PATCH 1/2] Generated from 04307357a8675aa7b96a0b884d10d4fccd39cf24 Reverting the schedule.json response code for Created to 201 as that conforms with our Web Service API --- .../automationManagement/lib/operations/scheduleOperations.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/services/automationManagement/lib/operations/scheduleOperations.js b/lib/services/automationManagement/lib/operations/scheduleOperations.js index 1a1af0bfae..b6fc36b13d 100644 --- a/lib/services/automationManagement/lib/operations/scheduleOperations.js +++ b/lib/services/automationManagement/lib/operations/scheduleOperations.js @@ -179,7 +179,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, scheduleName, return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 409) { + if (statusCode !== 201 && statusCode !== 409) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -209,7 +209,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, scheduleName, let result = null; if (responseBody === '') responseBody = null; // Deserialize Response - if (statusCode === 200) { + if (statusCode === 201) { let parsedResponse = null; try { parsedResponse = JSON.parse(responseBody); From d22fb947189bab342a73e5a617ee87f32f060bc7 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 27 Jun 2018 22:20:56 +0000 Subject: [PATCH 2/2] Generated from 2e54eec23745555508e8b186aab2cf152eee40de Also added dummy 200 response for idempotency --- .../lib/operations/scheduleOperations.js | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/lib/services/automationManagement/lib/operations/scheduleOperations.js b/lib/services/automationManagement/lib/operations/scheduleOperations.js index b6fc36b13d..80d9f81168 100644 --- a/lib/services/automationManagement/lib/operations/scheduleOperations.js +++ b/lib/services/automationManagement/lib/operations/scheduleOperations.js @@ -179,7 +179,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, scheduleName, return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 201 && statusCode !== 409) { + if (statusCode !== 200 && statusCode !== 201 && statusCode !== 409) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -209,7 +209,7 @@ function _createOrUpdate(resourceGroupName, automationAccountName, scheduleName, let result = null; if (responseBody === '') responseBody = null; // Deserialize Response - if (statusCode === 201) { + if (statusCode === 200) { let parsedResponse = null; try { parsedResponse = JSON.parse(responseBody); @@ -225,6 +225,23 @@ function _createOrUpdate(resourceGroupName, automationAccountName, scheduleName, 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['Schedule']().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); });