| | | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | | 2 | | // Licensed under the MIT License. |
| | | 3 | | |
| | | 4 | | using Microsoft.Azure.Amqp; |
| | | 5 | | |
| | | 6 | | namespace Azure.Messaging.EventHubs |
| | | 7 | | { |
| | | 8 | | /// <summary> |
| | | 9 | | /// The set of annotations for service responses associated with an AMQP messages and |
| | | 10 | | /// entities. |
| | | 11 | | /// </summary> |
| | | 12 | | /// |
| | | 13 | | internal static class AmqpResponse |
| | | 14 | | { |
| | | 15 | | /// <summary>The annotation that identifies the code of a response status.</summary> |
| | | 16 | | public const string StatusCode = "status-code"; |
| | | 17 | | |
| | | 18 | | /// <summary>The annotation that identifies the description of a response status.</summary> |
| | | 19 | | public const string StatusDescription = "status-description"; |
| | | 20 | | |
| | | 21 | | /// <summary>The annotation that identifies an error response.</summary> |
| | | 22 | | public const string ErrorCondition = "error-condition"; |
| | | 23 | | |
| | | 24 | | /// <summary> |
| | | 25 | | /// Determines whether the given AMQP status code value should be considered a successful |
| | | 26 | | /// request. |
| | | 27 | | /// </summary> |
| | | 28 | | /// |
| | | 29 | | /// <param name="statusCode">The status code value to consider.</param> |
| | | 30 | | /// |
| | | 31 | | /// <returns><c>true</c> if the request should be considered successful; otherwise, <c>false</c>.</returns> |
| | | 32 | | /// |
| | | 33 | | public static bool IsSuccessStatus(AmqpResponseStatusCode statusCode) => |
| | 22 | 34 | | ((statusCode == AmqpResponseStatusCode.OK) || (statusCode == AmqpResponseStatusCode.Accepted)); |
| | | 35 | | } |
| | | 36 | | } |