diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/ILabServicesClient.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/ILabServicesClient.cs index 17fe66f14866..1bdfa5c976d6 100644 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/ILabServicesClient.cs +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/ILabServicesClient.cs @@ -40,14 +40,14 @@ public partial interface ILabServicesClient : System.IDisposable ServiceClientCredentials Credentials { get; } /// - /// The API version to use for this operation. + /// The ID of the target subscription. /// - string ApiVersion { get; } + string SubscriptionId { get; set; } /// - /// The ID of the target subscription. + /// The API version to use for this operation. /// - string SubscriptionId { get; set; } + string ApiVersion { get; } /// /// The preferred language for the response. @@ -69,14 +69,9 @@ public partial interface ILabServicesClient : System.IDisposable /// - /// Gets the IOperations. - /// - IOperations Operations { get; } - - /// - /// Gets the IOperationResultsOperations. + /// Gets the IImagesOperations. /// - IOperationResultsOperations OperationResults { get; } + IImagesOperations Images { get; } /// /// Gets the ILabPlansOperations. @@ -84,15 +79,25 @@ public partial interface ILabServicesClient : System.IDisposable ILabPlansOperations LabPlans { get; } /// - /// Gets the IImagesOperations. + /// Gets the IOperations. /// - IImagesOperations Images { get; } + IOperations Operations { get; } /// /// Gets the ILabsOperations. /// ILabsOperations Labs { get; } + /// + /// Gets the IOperationResultsOperations. + /// + IOperationResultsOperations OperationResults { get; } + + /// + /// Gets the ISchedulesOperations. + /// + ISchedulesOperations Schedules { get; } + /// /// Gets the IUsersOperations. /// @@ -104,9 +109,14 @@ public partial interface ILabServicesClient : System.IDisposable IVirtualMachinesOperations VirtualMachines { get; } /// - /// Gets the ISchedulesOperations. + /// Gets the IUsagesOperations. /// - ISchedulesOperations Schedules { get; } + IUsagesOperations Usages { get; } + + /// + /// Gets the ISkusOperations. + /// + ISkusOperations Skus { get; } } } diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/ISkusOperations.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/ISkusOperations.cs new file mode 100644 index 000000000000..e650d76d0f32 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/ISkusOperations.cs @@ -0,0 +1,77 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.LabServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SkusOperations operations. + /// + public partial interface ISkusOperations + { + /// + /// Gets all the Azure Lab Services resource SKUs. + /// + /// + /// Returns a list of all the Azure Lab Services resource SKUs. + /// + /// + /// The filter to apply to the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all the Azure Lab Services resource SKUs. + /// + /// + /// Returns a list of all the Azure Lab Services resource SKUs. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/IUsagesOperations.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/IUsagesOperations.cs new file mode 100644 index 000000000000..c564b670954c --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/IUsagesOperations.cs @@ -0,0 +1,82 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.LabServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// UsagesOperations operations. + /// + public partial interface IUsagesOperations + { + /// + /// Gets the list of usages. + /// + /// + /// Returns list of usage per SKU family for the specified subscription + /// in the specified region. + /// + /// + /// The location name. + /// + /// + /// The filter to apply to the operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByLocationWithHttpMessagesAsync(string location, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the list of usages. + /// + /// + /// Returns list of usage per SKU family for the specified subscription + /// in the specified region. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByLocationNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/LabServicesClient.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/LabServicesClient.cs index c47df697cd40..41b5166991ee 100644 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/LabServicesClient.cs +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/LabServicesClient.cs @@ -44,14 +44,14 @@ public partial class LabServicesClient : ServiceClient, ILabS public ServiceClientCredentials Credentials { get; private set; } /// - /// The API version to use for this operation. + /// The ID of the target subscription. /// - public string ApiVersion { get; private set; } + public string SubscriptionId { get; set; } /// - /// The ID of the target subscription. + /// The API version to use for this operation. /// - public string SubscriptionId { get; set; } + public string ApiVersion { get; private set; } /// /// The preferred language for the response. @@ -72,14 +72,9 @@ public partial class LabServicesClient : ServiceClient, ILabS public bool? GenerateClientRequestId { get; set; } /// - /// Gets the IOperations. - /// - public virtual IOperations Operations { get; private set; } - - /// - /// Gets the IOperationResultsOperations. + /// Gets the IImagesOperations. /// - public virtual IOperationResultsOperations OperationResults { get; private set; } + public virtual IImagesOperations Images { get; private set; } /// /// Gets the ILabPlansOperations. @@ -87,15 +82,25 @@ public partial class LabServicesClient : ServiceClient, ILabS public virtual ILabPlansOperations LabPlans { get; private set; } /// - /// Gets the IImagesOperations. + /// Gets the IOperations. /// - public virtual IImagesOperations Images { get; private set; } + public virtual IOperations Operations { get; private set; } /// /// Gets the ILabsOperations. /// public virtual ILabsOperations Labs { get; private set; } + /// + /// Gets the IOperationResultsOperations. + /// + public virtual IOperationResultsOperations OperationResults { get; private set; } + + /// + /// Gets the ISchedulesOperations. + /// + public virtual ISchedulesOperations Schedules { get; private set; } + /// /// Gets the IUsersOperations. /// @@ -107,9 +112,14 @@ public partial class LabServicesClient : ServiceClient, ILabS public virtual IVirtualMachinesOperations VirtualMachines { get; private set; } /// - /// Gets the ISchedulesOperations. + /// Gets the IUsagesOperations. /// - public virtual ISchedulesOperations Schedules { get; private set; } + public virtual IUsagesOperations Usages { get; private set; } + + /// + /// Gets the ISkusOperations. + /// + public virtual ISkusOperations Skus { get; private set; } /// /// Initializes a new instance of the LabServicesClient class. @@ -352,16 +362,18 @@ internal LabServicesClient(System.Uri baseUri, ServiceClientCredentials credenti /// private void Initialize() { - Operations = new Operations(this); - OperationResults = new OperationResultsOperations(this); - LabPlans = new LabPlansOperations(this); Images = new ImagesOperations(this); + LabPlans = new LabPlansOperations(this); + Operations = new Operations(this); Labs = new LabsOperations(this); + OperationResults = new OperationResultsOperations(this); + Schedules = new SchedulesOperations(this); Users = new UsersOperations(this); VirtualMachines = new VirtualMachinesOperations(this); - Schedules = new SchedulesOperations(this); + Usages = new UsagesOperations(this); + Skus = new SkusOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2021-10-01-preview"; + ApiVersion = "2021-11-15-preview"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabServicesSku.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabServicesSku.cs new file mode 100644 index 000000000000..14cae0771d64 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabServicesSku.cs @@ -0,0 +1,128 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.LabServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Azure Lab Services resource SKUs + /// + public partial class LabServicesSku + { + /// + /// Initializes a new instance of the LabServicesSku class. + /// + public LabServicesSku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabServicesSku class. + /// + /// The lab services resource type. + /// The name of the SKU. + /// The tier of the SKU. Possible values include: + /// 'Standard', 'Premium' + /// The SKU size. + /// The family of the SKU. + /// The capabilities of the SKU. + /// List of locations that are available for a + /// size. + /// Metadata for retrieving price info of a lab + /// services SKUs. + /// Restrictions of a lab services + /// SKUs. + public LabServicesSku(string resourceType = default(string), string name = default(string), string tier = default(string), string size = default(string), string family = default(string), LabServicesSkuCapacity capacity = default(LabServicesSkuCapacity), IList capabilities = default(IList), IList locations = default(IList), IList costs = default(IList), IList restrictions = default(IList)) + { + ResourceType = resourceType; + Name = name; + Tier = tier; + Size = size; + Family = family; + Capacity = capacity; + Capabilities = capabilities; + Locations = locations; + Costs = costs; + Restrictions = restrictions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the lab services resource type. + /// + [JsonProperty(PropertyName = "resourceType")] + public string ResourceType { get; private set; } + + /// + /// Gets the name of the SKU. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the tier of the SKU. Possible values include: 'Standard', + /// 'Premium' + /// + [JsonProperty(PropertyName = "tier")] + public string Tier { get; private set; } + + /// + /// Gets the SKU size. + /// + [JsonProperty(PropertyName = "size")] + public string Size { get; private set; } + + /// + /// Gets the family of the SKU. + /// + [JsonProperty(PropertyName = "family")] + public string Family { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "capacity")] + public LabServicesSkuCapacity Capacity { get; set; } + + /// + /// Gets the capabilities of the SKU. + /// + [JsonProperty(PropertyName = "capabilities")] + public IList Capabilities { get; private set; } + + /// + /// Gets list of locations that are available for a size. + /// + [JsonProperty(PropertyName = "locations")] + public IList Locations { get; private set; } + + /// + /// Gets metadata for retrieving price info of a lab services SKUs. + /// + [JsonProperty(PropertyName = "costs")] + public IList Costs { get; private set; } + + /// + /// Gets restrictions of a lab services SKUs. + /// + [JsonProperty(PropertyName = "restrictions")] + public IList Restrictions { get; private set; } + + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabServicesSkuCapabilities.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabServicesSkuCapabilities.cs new file mode 100644 index 000000000000..db05c657c127 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabServicesSkuCapabilities.cs @@ -0,0 +1,59 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.LabServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The array of capabilities of a lab services SKU. + /// + public partial class LabServicesSkuCapabilities + { + /// + /// Initializes a new instance of the LabServicesSkuCapabilities class. + /// + public LabServicesSkuCapabilities() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabServicesSkuCapabilities class. + /// + /// The name of the capability for a SKU. + /// The value of the capability for a SKU. + public LabServicesSkuCapabilities(string name = default(string), string value = default(string)) + { + Name = name; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the name of the capability for a SKU. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the value of the capability for a SKU. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; private set; } + + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabServicesSkuCapacity.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabServicesSkuCapacity.cs new file mode 100644 index 000000000000..88456478933e --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabServicesSkuCapacity.cs @@ -0,0 +1,80 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.LabServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The scale out/in options of the SKU. + /// + public partial class LabServicesSkuCapacity + { + /// + /// Initializes a new instance of the LabServicesSkuCapacity class. + /// + public LabServicesSkuCapacity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabServicesSkuCapacity class. + /// + /// The default capacity for this + /// resource. + /// The lowest permitted capacity for this + /// resource. + /// The highest permitted capacity for this + /// resource. + /// The localized name of the resource. + /// Possible values include: 'None', 'Manual', 'Automatic' + public LabServicesSkuCapacity(long? defaultProperty = default(long?), long? minimum = default(long?), long? maximum = default(long?), string scaleType = default(string)) + { + DefaultProperty = defaultProperty; + Minimum = minimum; + Maximum = maximum; + ScaleType = scaleType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the default capacity for this resource. + /// + [JsonProperty(PropertyName = "default")] + public long? DefaultProperty { get; private set; } + + /// + /// Gets the lowest permitted capacity for this resource. + /// + [JsonProperty(PropertyName = "minimum")] + public long? Minimum { get; private set; } + + /// + /// Gets the highest permitted capacity for this resource. + /// + [JsonProperty(PropertyName = "maximum")] + public long? Maximum { get; private set; } + + /// + /// Gets the localized name of the resource. Possible values include: + /// 'None', 'Manual', 'Automatic' + /// + [JsonProperty(PropertyName = "scaleType")] + public string ScaleType { get; private set; } + + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabServicesSkuCost.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabServicesSkuCost.cs new file mode 100644 index 000000000000..8cfb75beb8a6 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabServicesSkuCost.cs @@ -0,0 +1,67 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.LabServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The array of costs of a lab services SKU. + /// + public partial class LabServicesSkuCost + { + /// + /// Initializes a new instance of the LabServicesSkuCost class. + /// + public LabServicesSkuCost() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabServicesSkuCost class. + /// + /// The meter id. + /// The quantity of units charged. + /// The extended unit. + public LabServicesSkuCost(string meterId = default(string), double? quantity = default(double?), string extendedUnit = default(string)) + { + MeterId = meterId; + Quantity = quantity; + ExtendedUnit = extendedUnit; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the meter id. + /// + [JsonProperty(PropertyName = "meterId")] + public string MeterId { get; private set; } + + /// + /// Gets the quantity of units charged. + /// + [JsonProperty(PropertyName = "quantity")] + public double? Quantity { get; private set; } + + /// + /// Gets the extended unit. + /// + [JsonProperty(PropertyName = "extendedUnit")] + public string ExtendedUnit { get; private set; } + + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabServicesSkuRestrictions.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabServicesSkuRestrictions.cs new file mode 100644 index 000000000000..b5bf1b3d4c5b --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabServicesSkuRestrictions.cs @@ -0,0 +1,72 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.LabServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The restriction details. + /// + public partial class LabServicesSkuRestrictions + { + /// + /// Initializes a new instance of the LabServicesSkuRestrictions class. + /// + public LabServicesSkuRestrictions() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LabServicesSkuRestrictions class. + /// + /// The type of restriction. Possible values + /// include: 'Location' + /// The values of the restriction. + /// The reason for the restriction. Possible + /// values include: 'QuotaId', 'NotAvailableForSubscription' + public LabServicesSkuRestrictions(string type = default(string), IList values = default(IList), string reasonCode = default(string)) + { + Type = type; + Values = values; + ReasonCode = reasonCode; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the type of restriction. Possible values include: 'Location' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets the values of the restriction. + /// + [JsonProperty(PropertyName = "values")] + public IList Values { get; private set; } + + /// + /// Gets the reason for the restriction. Possible values include: + /// 'QuotaId', 'NotAvailableForSubscription' + /// + [JsonProperty(PropertyName = "reasonCode")] + public string ReasonCode { get; private set; } + + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabServicesSkuTier.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabServicesSkuTier.cs new file mode 100644 index 000000000000..75121a0ac16d --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/LabServicesSkuTier.cs @@ -0,0 +1,22 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.LabServices.Models +{ + + /// + /// Defines values for LabServicesSkuTier. + /// + public static class LabServicesSkuTier + { + public const string Standard = "Standard"; + public const string Premium = "Premium"; + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/RecurrencePattern.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/RecurrencePattern.cs index 3907c87b3cc2..06b03e08da93 100644 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/RecurrencePattern.cs +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/RecurrencePattern.cs @@ -95,16 +95,13 @@ public RecurrencePattern() /// public virtual void Validate() { - if (Interval != null) + if (Interval > 365) { - if (Interval > 365) - { - throw new ValidationException(ValidationRules.InclusiveMaximum, "Interval", 365); - } - if (Interval < 1) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Interval", 1); - } + throw new ValidationException(ValidationRules.InclusiveMaximum, "Interval", 365); + } + if (Interval < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Interval", 1); } } } diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/RestrictionReasonCode.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/RestrictionReasonCode.cs new file mode 100644 index 000000000000..83261da6a2f0 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/RestrictionReasonCode.cs @@ -0,0 +1,22 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.LabServices.Models +{ + + /// + /// Defines values for RestrictionReasonCode. + /// + public static class RestrictionReasonCode + { + public const string QuotaId = "QuotaId"; + public const string NotAvailableForSubscription = "NotAvailableForSubscription"; + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/RestrictionType.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/RestrictionType.cs new file mode 100644 index 000000000000..138b3a8f497a --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/RestrictionType.cs @@ -0,0 +1,21 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.LabServices.Models +{ + + /// + /// Defines values for RestrictionType. + /// + public static class RestrictionType + { + public const string Location = "Location"; + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ScaleType.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ScaleType.cs new file mode 100644 index 000000000000..fa8ebade0b96 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/ScaleType.cs @@ -0,0 +1,32 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.LabServices.Models +{ + + /// + /// Defines values for ScaleType. + /// + public static class ScaleType + { + /// + /// The capacity is not adjustable in any way. + /// + public const string None = "None"; + /// + /// The user must manually scale this SKU in and out. + /// + public const string Manual = "Manual"; + /// + /// The user is permitted to scale this SKU in and out. + /// + public const string Automatic = "Automatic"; + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/Usage.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/Usage.cs new file mode 100644 index 000000000000..9f278d87d9f1 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/Usage.cs @@ -0,0 +1,84 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.LabServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The core usage details. + /// + public partial class Usage + { + /// + /// Initializes a new instance of the Usage class. + /// + public Usage() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Usage class. + /// + /// The current usage. + /// The limit integer. + /// The unit details. Possible values include: + /// 'Count' + /// The name. + /// The fully qualified arm resource id. + public Usage(long? currentValue = default(long?), long? limit = default(long?), string unit = default(string), UsageName name = default(UsageName), string id = default(string)) + { + CurrentValue = currentValue; + Limit = limit; + Unit = unit; + Name = name; + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the current usage. + /// + [JsonProperty(PropertyName = "currentValue")] + public long? CurrentValue { get; set; } + + /// + /// Gets or sets the limit integer. + /// + [JsonProperty(PropertyName = "limit")] + public long? Limit { get; set; } + + /// + /// Gets or sets the unit details. Possible values include: 'Count' + /// + [JsonProperty(PropertyName = "unit")] + public string Unit { get; set; } + + /// + /// Gets or sets the name. + /// + [JsonProperty(PropertyName = "name")] + public UsageName Name { get; set; } + + /// + /// Gets or sets the fully qualified arm resource id. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/UsageName.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/UsageName.cs new file mode 100644 index 000000000000..45a496b8d604 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/UsageName.cs @@ -0,0 +1,60 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.LabServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The Usage Names. + /// + public partial class UsageName + { + /// + /// Initializes a new instance of the UsageName class. + /// + public UsageName() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UsageName class. + /// + /// The localized name of the + /// resource. + /// The name of the resource. + public UsageName(string localizedValue = default(string), string value = default(string)) + { + LocalizedValue = localizedValue; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the localized name of the resource. + /// + [JsonProperty(PropertyName = "localizedValue")] + public string LocalizedValue { get; set; } + + /// + /// Gets or sets the name of the resource. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/UsageUnit.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/UsageUnit.cs new file mode 100644 index 000000000000..73b072e17695 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/Models/UsageUnit.cs @@ -0,0 +1,21 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.LabServices.Models +{ + + /// + /// Defines values for UsageUnit. + /// + public static class UsageUnit + { + public const string Count = "Count"; + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/SdkInfo_LabServicesClient.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/SdkInfo_LabServicesClient.cs index 8c13ff56be4f..83aeb2059f42 100644 --- a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/SdkInfo_LabServicesClient.cs +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/SdkInfo_LabServicesClient.cs @@ -19,27 +19,18 @@ public static IEnumerable> ApiInfo_LabServicesClie { return new Tuple[] { - new Tuple("LabServices", "Images", "2021-10-01-preview"), - new Tuple("LabServices", "LabPlans", "2021-10-01-preview"), - new Tuple("LabServices", "Labs", "2021-10-01-preview"), - new Tuple("LabServices", "OperationResults", "2021-10-01-preview"), - new Tuple("LabServices", "Operations", "2021-10-01-preview"), - new Tuple("LabServices", "Schedules", "2021-10-01-preview"), - new Tuple("LabServices", "Users", "2021-10-01-preview"), - new Tuple("LabServices", "VirtualMachines", "2021-10-01-preview"), + new Tuple("LabServices", "Images", "2021-11-15-preview"), + new Tuple("LabServices", "LabPlans", "2021-11-15-preview"), + new Tuple("LabServices", "Labs", "2021-11-15-preview"), + new Tuple("LabServices", "OperationResults", "2021-11-15-preview"), + new Tuple("LabServices", "Operations", "2021-11-15-preview"), + new Tuple("LabServices", "Schedules", "2021-11-15-preview"), + new Tuple("LabServices", "Skus", "2021-11-15-preview"), + new Tuple("LabServices", "Usages", "2021-11-15-preview"), + new Tuple("LabServices", "Users", "2021-11-15-preview"), + new Tuple("LabServices", "VirtualMachines", "2021-11-15-preview"), }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "v2"; - public static readonly String AutoRestBootStrapperVersion = "autorest@3.4.0"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/main/specification/labservices/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=C:\\Repos\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "main"; - public static readonly String GithubCommidId = "2ebe584103a362fa87f2f60c9bab89ab410c7571"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/SkusOperations.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/SkusOperations.cs new file mode 100644 index 000000000000..81f6950f045a --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/SkusOperations.cs @@ -0,0 +1,423 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.LabServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SkusOperations operations. + /// + internal partial class SkusOperations : IServiceOperations, ISkusOperations + { + /// + /// Initializes a new instance of the SkusOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal SkusOperations(LabServicesClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the LabServicesClient + /// + public LabServicesClient Client { get; private set; } + + /// + /// Gets all the Azure Lab Services resource SKUs. + /// + /// + /// Returns a list of all the Azure Lab Services resource SKUs. + /// + /// + /// The filter to apply to the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("filter", filter); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.LabServices/skus").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all the Azure Lab Services resource SKUs. + /// + /// + /// Returns a list of all the Azure Lab Services resource SKUs. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/SkusOperationsExtensions.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/SkusOperationsExtensions.cs new file mode 100644 index 000000000000..fa6c5b719373 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/SkusOperationsExtensions.cs @@ -0,0 +1,105 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.LabServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SkusOperations. + /// + public static partial class SkusOperationsExtensions + { + /// + /// Gets all the Azure Lab Services resource SKUs. + /// + /// + /// Returns a list of all the Azure Lab Services resource SKUs. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The filter to apply to the operation. + /// + public static IPage List(this ISkusOperations operations, string filter = default(string)) + { + return operations.ListAsync(filter).GetAwaiter().GetResult(); + } + + /// + /// Gets all the Azure Lab Services resource SKUs. + /// + /// + /// Returns a list of all the Azure Lab Services resource SKUs. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The filter to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ISkusOperations operations, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all the Azure Lab Services resource SKUs. + /// + /// + /// Returns a list of all the Azure Lab Services resource SKUs. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ISkusOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all the Azure Lab Services resource SKUs. + /// + /// + /// Returns a list of all the Azure Lab Services resource SKUs. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this ISkusOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/UsagesOperations.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/UsagesOperations.cs new file mode 100644 index 000000000000..e7b93990d450 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/UsagesOperations.cs @@ -0,0 +1,449 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.LabServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// UsagesOperations operations. + /// + internal partial class UsagesOperations : IServiceOperations, IUsagesOperations + { + /// + /// Initializes a new instance of the UsagesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal UsagesOperations(LabServicesClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the LabServicesClient + /// + public LabServicesClient Client { get; private set; } + + /// + /// Gets the list of usages. + /// + /// + /// Returns list of usage per SKU family for the specified subscription in the + /// specified region. + /// + /// + /// The location name. + /// + /// + /// The filter to apply to the operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByLocationWithHttpMessagesAsync(string location, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (location != null) + { + if (location.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "location", 100); + } + if (location.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "location", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(location, "^[-\\w\\._]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "location", "^[-\\w\\._]+$"); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + tracingParameters.Add("filter", filter); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByLocation", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.LabServices/locations/{location}/usages").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the list of usages. + /// + /// + /// Returns list of usage per SKU family for the specified subscription in the + /// specified region. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListByLocationNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByLocationNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/UsagesOperationsExtensions.cs b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/UsagesOperationsExtensions.cs new file mode 100644 index 000000000000..13110bc9d248 --- /dev/null +++ b/sdk/labservices/Microsoft.Azure.Management.LabServices/src/Generated/UsagesOperationsExtensions.cs @@ -0,0 +1,115 @@ +// +// 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. +// + +namespace Microsoft.Azure.Management.LabServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for UsagesOperations. + /// + public static partial class UsagesOperationsExtensions + { + /// + /// Gets the list of usages. + /// + /// + /// Returns list of usage per SKU family for the specified subscription in the + /// specified region. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location name. + /// + /// + /// The filter to apply to the operation. + /// + public static IPage ListByLocation(this IUsagesOperations operations, string location, string filter = default(string)) + { + return operations.ListByLocationAsync(location, filter).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of usages. + /// + /// + /// Returns list of usage per SKU family for the specified subscription in the + /// specified region. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The location name. + /// + /// + /// The filter to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByLocationAsync(this IUsagesOperations operations, string location, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByLocationWithHttpMessagesAsync(location, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the list of usages. + /// + /// + /// Returns list of usage per SKU family for the specified subscription in the + /// specified region. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByLocationNext(this IUsagesOperations operations, string nextPageLink) + { + return operations.ListByLocationNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of usages. + /// + /// + /// Returns list of usage per SKU family for the specified subscription in the + /// specified region. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByLocationNextAsync(this IUsagesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByLocationNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +}