PageRenderTime 51ms CodeModel.GetById 29ms RepoModel.GetById 1ms app.codeStats 0ms

/AzureTableStorage/src/AzureServicesManagement/ServiceManagement/OperatingSystem.cs

#
C# | 144 lines | 85 code | 25 blank | 34 comment | 0 complexity | ab2c3ac1654c90e45a72104068fc5b24 MD5 | raw file
  1. //---------------------------------------------------------------------------------
  2. // Microsoft (R) Windows Azure SDK
  3. // Software Development Kit
  4. //
  5. // Copyright (c) Microsoft Corporation. All rights reserved.
  6. //
  7. // THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
  8. // EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
  9. // OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
  10. //---------------------------------------------------------------------------------
  11. using System;
  12. using System.Collections.Generic;
  13. using System.Runtime.Serialization;
  14. using System.ServiceModel;
  15. using System.ServiceModel.Web;
  16. using System.Collections.ObjectModel;
  17. namespace Microsoft.Samples.WindowsAzure.ServiceManagement
  18. {
  19. /// <summary>
  20. /// List of operating system families.
  21. /// </summary>
  22. [CollectionDataContract(Name = "OperatingSystemFamilies", ItemName = "OperatingSystemFamily", Namespace = Constants.ServiceManagementNS)]
  23. public class OperatingSystemFamilyList : List<OperatingSystemFamily>
  24. {
  25. public OperatingSystemFamilyList()
  26. {
  27. }
  28. public OperatingSystemFamilyList(IEnumerable<OperatingSystemFamily> operatingSystemFamilies)
  29. : base(operatingSystemFamilies)
  30. {
  31. }
  32. }
  33. /// <summary>
  34. /// An operating system family supported in Windows Azure.
  35. /// </summary>
  36. [DataContract(Namespace = Constants.ServiceManagementNS)]
  37. public class OperatingSystemFamily : IExtensibleDataObject
  38. {
  39. [DataMember(Order = 1)]
  40. public string Name { get; set; }
  41. [DataMember(Order = 2, EmitDefaultValue = false)]
  42. public string Label { get; set; }
  43. [DataMember(Order = 3)]
  44. public OperatingSystemList OperatingSystems { get; set; }
  45. public ExtensionDataObject ExtensionData { get; set; }
  46. }
  47. /// <summary>
  48. /// List of operating systems.
  49. /// </summary>
  50. [CollectionDataContract(Name = "OperatingSystems", ItemName = "OperatingSystem", Namespace = Constants.ServiceManagementNS)]
  51. public class OperatingSystemList : List<OperatingSystem>
  52. {
  53. public OperatingSystemList()
  54. {
  55. }
  56. public OperatingSystemList(IEnumerable<OperatingSystem> operatingSystems)
  57. : base(operatingSystems)
  58. {
  59. }
  60. }
  61. /// <summary>
  62. /// An operating system supported in Windows Azure.
  63. /// </summary>
  64. [DataContract(Namespace = Constants.ServiceManagementNS)]
  65. public class OperatingSystem : IExtensibleDataObject
  66. {
  67. [DataMember(Order = 1)]
  68. public string Version { get; set; }
  69. [DataMember(Order = 2, EmitDefaultValue = false)]
  70. public string Label { get; set; }
  71. [DataMember(Order = 3)]
  72. public bool IsDefault { get; set; }
  73. [DataMember(Order = 4)]
  74. public bool IsActive { get; set; }
  75. [DataMember(Order = 5, EmitDefaultValue = false)]
  76. public string Family { get; set; }
  77. [DataMember(Order = 6, EmitDefaultValue = false)]
  78. public string FamilyLabel { get; set; }
  79. public ExtensionDataObject ExtensionData { get; set; }
  80. }
  81. /// <summary>
  82. /// The operating-system-specific interface of the resource model service.
  83. /// </summary>
  84. public partial interface IServiceManagement
  85. {
  86. #region List Operating Systems
  87. /// <summary>
  88. /// Lists all available operating systems.
  89. /// </summary>
  90. [OperationContract(AsyncPattern = true)]
  91. [WebInvoke(Method = "GET", UriTemplate = @"{subscriptionId}/operatingsystems")]
  92. IAsyncResult BeginListOperatingSystems(string subscriptionId, AsyncCallback callback, object state);
  93. OperatingSystemList EndListOperatingSystems(IAsyncResult asyncResult);
  94. #endregion
  95. #region List Operating Systems Families
  96. /// <summary>
  97. /// Lists all available operating system families and their operating systems.
  98. /// </summary>
  99. [OperationContract(AsyncPattern = true)]
  100. [WebInvoke(Method = "GET", UriTemplate = @"{subscriptionId}/operatingsystemfamilies")]
  101. IAsyncResult BeginListOperatingSystemFamilies(string subscriptionId, AsyncCallback callback, object state);
  102. OperatingSystemFamilyList EndListOperatingSystemFamilies(IAsyncResult asyncResult);
  103. #endregion
  104. }
  105. /// <summary>
  106. /// Extensions of the IServiceManagement interface that allows clients to call operations synchronously.
  107. /// </summary>
  108. public static partial class ServiceManagementExtensionMethods
  109. {
  110. public static OperatingSystemList ListOperatingSystems(this IServiceManagement proxy, string subscriptionId)
  111. {
  112. return proxy.EndListOperatingSystems(proxy.BeginListOperatingSystems(subscriptionId, null, null));
  113. }
  114. public static OperatingSystemFamilyList ListOperatingSystemFamilies(this IServiceManagement proxy, string subscriptionId)
  115. {
  116. return proxy.EndListOperatingSystemFamilies(proxy.BeginListOperatingSystemFamilies(subscriptionId, null, null));
  117. }
  118. }
  119. }