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

Commit

Permalink
Generated from 82cee8e19ad81e9d82d712cfabad1649b91b619a
Browse files Browse the repository at this point in the history
Merge pull request #1 from omarelhariry/a-moghan/PublishingResponses

Adding Publishing To Regions Status
  • Loading branch information
AutorestCI committed Nov 25, 2018
1 parent 2d86cc7 commit 604e139
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 16 deletions.
8 changes: 8 additions & 0 deletions lib/services/luis/authoring/lib/models/endpointInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class EndpointInfo {
* published to.
* @property {string} [assignedEndpointKey] The endpoint key.
* @property {string} [endpointRegion] The endpoint's region.
* @property {string} [failedRegions] Regions where publishing failed.
* @property {string} [publishedDateTime] Timestamp when was last published.
*/
constructor() {
Expand Down Expand Up @@ -87,6 +88,13 @@ class EndpointInfo {
name: 'String'
}
},
failedRegions: {
required: false,
serializedName: 'failedRegions',
type: {
name: 'String'
}
},
publishedDateTime: {
required: false,
serializedName: 'publishedDateTime',
Expand Down
4 changes: 4 additions & 0 deletions lib/services/luis/authoring/lib/models/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1334,6 +1334,10 @@ export interface EndpointInfo {
* The endpoint's region.
*/
endpointRegion?: string;
/**
* Regions where publishing failed.
*/
failedRegions?: string;
/**
* Timestamp when was last published.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ class ProductionOrStagingEndpointInfo extends models['EndpointInfo'] {
name: 'String'
}
},
failedRegions: {
required: false,
serializedName: 'failedRegions',
type: {
name: 'String'
}
},
publishedDateTime: {
required: false,
serializedName: 'publishedDateTime',
Expand Down
50 changes: 43 additions & 7 deletions lib/services/luis/authoring/lib/operations/apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -1564,8 +1564,6 @@ function _deleteMethod(appId, options, callback) {
* {Error} err - The Error object if an error occurred, null otherwise.
*
* {object} [result] - The deserialized result object if an error did not occur.
* See {@link ProductionOrStagingEndpointInfo} for more
* information.
*
* {object} [request] - The HTTP Request object if an error did not occur.
*
Expand Down Expand Up @@ -1637,7 +1635,7 @@ function _publish(appId, applicationPublishObject, options, callback) {
return callback(err);
}
let statusCode = response.statusCode;
if (statusCode !== 201) {
if (statusCode !== 201 && statusCode !== 207 && statusCode !== 503) {
let error = new Error(responseBody);
error.statusCode = response.statusCode;
error.request = msRest.stripRequest(httpRequest);
Expand Down Expand Up @@ -1683,6 +1681,46 @@ function _publish(appId, applicationPublishObject, options, callback) {
return callback(deserializationError);
}
}
// Deserialize Response
if (statusCode === 207) {
let parsedResponse = null;
try {
parsedResponse = JSON.parse(responseBody);
result = JSON.parse(responseBody);
if (parsedResponse !== null && parsedResponse !== undefined) {
let resultMapper = new client.models['ProductionOrStagingEndpointInfo']().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);
}
}
// Deserialize Response
if (statusCode === 503) {
let parsedResponse = null;
try {
parsedResponse = JSON.parse(responseBody);
result = JSON.parse(responseBody);
if (parsedResponse !== null && parsedResponse !== undefined) {
let resultMapper = {
required: false,
serializedName: 'parsedResponse',
type: {
name: 'String'
}
};
result = client.deserialize(resultMapper, parsedResponse, 'result');
}
} catch (error) {
let deserializationError2 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`);
deserializationError2.request = msRest.stripRequest(httpRequest);
deserializationError2.response = msRest.stripResponse(response);
return callback(deserializationError2);
}
}

return callback(null, result, httpRequest, response);
});
Expand Down Expand Up @@ -3856,7 +3894,7 @@ class Apps {
*
* @returns {Promise} A promise is returned
*
* @resolve {HttpOperationResponse<ProductionOrStagingEndpointInfo>} - The deserialized result object.
* @resolve {HttpOperationResponse<Object>} - The deserialized result object.
*
* @reject {Error} - The error object.
*/
Expand Down Expand Up @@ -3900,7 +3938,7 @@ class Apps {
*
* {Promise} A promise is returned
*
* @resolve {ProductionOrStagingEndpointInfo} - The deserialized result object.
* @resolve {Object} - The deserialized result object.
*
* @reject {Error} - The error object.
*
Expand All @@ -3909,8 +3947,6 @@ class Apps {
* {Error} err - The Error object if an error occurred, null otherwise.
*
* {object} [result] - The deserialized result object if an error did not occur.
* See {@link ProductionOrStagingEndpointInfo} for more
* information.
*
* {object} [request] - The HTTP Request object if an error did not occur.
*
Expand Down
16 changes: 7 additions & 9 deletions lib/services/luis/authoring/lib/operations/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8847,11 +8847,11 @@ export interface Apps {
*
* @returns {Promise} A promise is returned
*
* @resolve {HttpOperationResponse<ProductionOrStagingEndpointInfo>} - The deserialized result object.
* @resolve {HttpOperationResponse<Object>} - The deserialized result object.
*
* @reject {Error|ServiceError} - The error object.
*/
publishWithHttpOperationResponse(appId: string, applicationPublishObject: models.ApplicationPublishObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise<HttpOperationResponse<models.ProductionOrStagingEndpointInfo>>;
publishWithHttpOperationResponse(appId: string, applicationPublishObject: models.ApplicationPublishObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise<HttpOperationResponse<any>>;

/**
* Publishes a specific version of the application.
Expand Down Expand Up @@ -8879,25 +8879,23 @@ export interface Apps {
*
* {Promise} A promise is returned.
*
* @resolve {ProductionOrStagingEndpointInfo} - The deserialized result object.
* @resolve {Object} - The deserialized result object.
*
* @reject {Error|ServiceError} - The error object.
*
* {ServiceCallback} optionalCallback(err, result, request, response)
*
* {Error|ServiceError} err - The Error object if an error occurred, null otherwise.
*
* {ProductionOrStagingEndpointInfo} [result] - The deserialized result object if an error did not occur.
* See {@link ProductionOrStagingEndpointInfo} for more
* information.
* {Object} [result] - The deserialized result object if an error did not occur.
*
* {WebResource} [request] - The HTTP Request object if an error did not occur.
*
* {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur.
*/
publish(appId: string, applicationPublishObject: models.ApplicationPublishObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise<models.ProductionOrStagingEndpointInfo>;
publish(appId: string, applicationPublishObject: models.ApplicationPublishObject, callback: ServiceCallback<models.ProductionOrStagingEndpointInfo>): void;
publish(appId: string, applicationPublishObject: models.ApplicationPublishObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback<models.ProductionOrStagingEndpointInfo>): void;
publish(appId: string, applicationPublishObject: models.ApplicationPublishObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise<any>;
publish(appId: string, applicationPublishObject: models.ApplicationPublishObject, callback: ServiceCallback<any>): void;
publish(appId: string, applicationPublishObject: models.ApplicationPublishObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback<any>): void;


/**
Expand Down

0 comments on commit 604e139

Please sign in to comment.