diff --git a/eng/mgmt/mgmtmetadata/resources_resource-manager.txt b/eng/mgmt/mgmtmetadata/resources_resource-manager.txt index 40a4b8c45c510..68cb72bc063fb 100644 --- a/eng/mgmt/mgmtmetadata/resources_resource-manager.txt +++ b/eng/mgmt/mgmtmetadata/resources_resource-manager.txt @@ -3,12 +3,13 @@ AutoRest installed successfully. Commencing code generation Generating CSharp code Executing AutoRest command -cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/resources/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --tag=package-templatespecs-2021-05 --csharp.output-folder=C:\azure-sdk-for-net\sdk\resources\Microsoft.Azure.Management.Resource\src\Generated\TemplateSpecs -2021-05-11 18:40:02 UTC +cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/resources/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --tag=package-subscriptions-2021-01 --csharp.output-folder=C:\dev\azure-sdk-for-net\sdk\resources\Microsoft.Azure.Management.Resource\src\Generated\Subscriptions +Autorest CSharp Version: 2.3.82 +2021-08-02 20:47:53 UTC Azure-rest-api-specs repository information GitHub fork: Azure Branch: master -Commit: 60be518b4fa1a9fb011a0cb69ae7ca3e1cee06b1 +Commit: 749d2b5158cfd186e6719a13c614e1993cccbf95 AutoRest information Requested version: v2 -Bootstrapper version: autorest@1.9.1 +Bootstrapper version: autorest@3.2.1 diff --git a/sdk/resources/Microsoft.Azure.Management.Resource/AzSdk.RP.props b/sdk/resources/Microsoft.Azure.Management.Resource/AzSdk.RP.props index cbbb650e092a6..56bb9dbd2b2ae 100644 --- a/sdk/resources/Microsoft.Azure.Management.Resource/AzSdk.RP.props +++ b/sdk/resources/Microsoft.Azure.Management.Resource/AzSdk.RP.props @@ -1,7 +1,7 @@  - Resources_2020-10-01;Features_2015-12-01;ManagementLinkClient_2016-09-01;Resources_2016-09-01;Authorization_2016-09-01;Authorization_2020-09-01;Authorization_2020-07-01-preview;Management_2020-09-01;Management_2020-07-01-preview;PolicyClient_2020-09-01;Management_2020-10-01;ResourceManagementClient_2020-10-01;Resources_2020-01-01;SubscriptionClient_2020-01-01;Resources_2021-05-01;Resources_2021-04-01; + SubscriptionClient_2021-01-01;Resources_2020-10-01;Features_2015-12-01;ManagementLinkClient_2016-09-01;Resources_2016-09-01;Authorization_2016-09-01;Authorization_2020-09-01;Authorization_2020-07-01-preview;Management_2020-09-01;Management_2020-07-01-preview;PolicyClient_2020-09-01;Management_2020-10-01;ResourceManagementClient_2020-10-01;Resources_2020-01-01;SubscriptionClient_2020-01-01;Resources_2021-05-01;Resources_2021-04-01; $(PackageTags);$(CommonTags);$(AzureApiTag); diff --git a/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/ISubscriptionClient.cs b/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/ISubscriptionClient.cs index 211d9be958e96..f44cf5bfaa5f3 100644 --- a/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/ISubscriptionClient.cs +++ b/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/ISubscriptionClient.cs @@ -14,6 +14,10 @@ namespace Microsoft.Azure.Management.ResourceManager using Microsoft.Rest.Azure; using Models; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; /// /// All resource groups and resources exist within subscriptions. These @@ -77,5 +81,23 @@ public partial interface ISubscriptionClient : System.IDisposable /// ITenantsOperations Tenants { get; } + /// + /// Checks resource name validity + /// + /// + /// A resource name is valid if it is not a reserved word, does not + /// contains a reserved word and does not start with a reserved word + /// + /// + /// Resource object with values for resource name and resource type + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task> CheckResourceNameWithHttpMessagesAsync(ResourceName resourceNameDefinition = default(ResourceName), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } } diff --git a/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/ISubscriptionsOperations.cs b/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/ISubscriptionsOperations.cs index af47db013ad0c..0bd2d19822587 100644 --- a/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/ISubscriptionsOperations.cs +++ b/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/ISubscriptionsOperations.cs @@ -34,6 +34,9 @@ public partial interface ISubscriptionsOperations /// /// The ID of the target subscription. /// + /// + /// Whether to include extended locations. + /// /// /// The headers that will be added to request. /// @@ -49,7 +52,7 @@ public partial interface ISubscriptionsOperations /// /// Thrown when a required parameter is null /// - Task>> ListLocationsWithHttpMessagesAsync(string subscriptionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListLocationsWithHttpMessagesAsync(string subscriptionId, bool? includeExtendedLocations = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets details about a specified subscription. /// diff --git a/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/CheckResourceNameResult.cs b/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/CheckResourceNameResult.cs new file mode 100644 index 0000000000000..d34372d05eed2 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/CheckResourceNameResult.cs @@ -0,0 +1,70 @@ +// +// 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.ResourceManager.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Resource Name valid if not a reserved word, does not contain a reserved + /// word and does not start with a reserved word + /// + public partial class CheckResourceNameResult + { + /// + /// Initializes a new instance of the CheckResourceNameResult class. + /// + public CheckResourceNameResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CheckResourceNameResult class. + /// + /// Name of Resource + /// Type of Resource + /// Is the resource name Allowed or Reserved. + /// Possible values include: 'Allowed', 'Reserved' + public CheckResourceNameResult(string name = default(string), string type = default(string), string status = default(string)) + { + Name = name; + Type = type; + Status = status; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of Resource + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets type of Resource + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets is the resource name Allowed or Reserved. Possible + /// values include: 'Allowed', 'Reserved' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/ErrorDefinition.cs b/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/ErrorDefinition.cs new file mode 100644 index 0000000000000..360adc6a23abe --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/ErrorDefinition.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.ResourceManager.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Error description and code explaining why resource name is invalid. + /// + public partial class ErrorDefinition + { + /// + /// Initializes a new instance of the ErrorDefinition class. + /// + public ErrorDefinition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorDefinition class. + /// + /// Description of the error. + /// Code of the error. + public ErrorDefinition(string message = default(string), string code = default(string)) + { + Message = message; + Code = code; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets description of the error. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// Gets or sets code of the error. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/ErrorResponseException.cs b/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/ErrorResponseException.cs new file mode 100644 index 0000000000000..a9790c9188e78 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/ErrorResponseException.cs @@ -0,0 +1,62 @@ +// +// 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.ResourceManager.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with ErrorResponse + /// information. + /// + public partial class ErrorResponseException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public ErrorResponse Body { get; set; } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + public ErrorResponseException() + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + public ErrorResponseException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + /// Inner exception. + public ErrorResponseException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/Location.cs b/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/Location.cs index 5a63b1e836a56..598099f07a501 100644 --- a/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/Location.cs +++ b/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/Location.cs @@ -34,16 +34,19 @@ public Location() /// /subscriptions/00000000-0000-0000-0000-000000000000/locations/westus. /// The subscription ID. /// The location name. + /// The location type. Possible values include: + /// 'Region', 'EdgeZone' /// The display name of the location. /// The display name of the location /// and its region. /// Metadata of the location, such as lat/long, /// paired region, and others. - public Location(string id = default(string), string subscriptionId = default(string), string name = default(string), string displayName = default(string), string regionalDisplayName = default(string), LocationMetadata metadata = default(LocationMetadata)) + public Location(string id = default(string), string subscriptionId = default(string), string name = default(string), LocationType? type = default(LocationType?), string displayName = default(string), string regionalDisplayName = default(string), LocationMetadata metadata = default(LocationMetadata)) { Id = id; SubscriptionId = subscriptionId; Name = name; + Type = type; DisplayName = displayName; RegionalDisplayName = regionalDisplayName; Metadata = metadata; @@ -74,6 +77,13 @@ public Location() [JsonProperty(PropertyName = "name")] public string Name { get; private set; } + /// + /// Gets the location type. Possible values include: 'Region', + /// 'EdgeZone' + /// + [JsonProperty(PropertyName = "type")] + public LocationType? Type { get; private set; } + /// /// Gets the display name of the location. /// diff --git a/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/LocationMetadata.cs b/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/LocationMetadata.cs index ea30364d5662a..7904ca9a0e3ed 100644 --- a/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/LocationMetadata.cs +++ b/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/LocationMetadata.cs @@ -34,7 +34,7 @@ public LocationMetadata() /// The type of the region. Possible values /// include: 'Physical', 'Logical' /// The category of the region. Possible - /// values include: 'Recommended', 'Other' + /// values include: 'Recommended', 'Extended', 'Other' /// The geography group of the /// location. /// The longitude of the location. @@ -43,7 +43,9 @@ public LocationMetadata() /// location. /// The regions paired to this /// region. - public LocationMetadata(string regionType = default(string), string regionCategory = default(string), string geographyGroup = default(string), string longitude = default(string), string latitude = default(string), string physicalLocation = default(string), IList pairedRegion = default(IList)) + /// The home location of an edge + /// zone. + public LocationMetadata(string regionType = default(string), string regionCategory = default(string), string geographyGroup = default(string), string longitude = default(string), string latitude = default(string), string physicalLocation = default(string), IList pairedRegion = default(IList), string homeLocation = default(string)) { RegionType = regionType; RegionCategory = regionCategory; @@ -52,6 +54,7 @@ public LocationMetadata() Latitude = latitude; PhysicalLocation = physicalLocation; PairedRegion = pairedRegion; + HomeLocation = homeLocation; CustomInit(); } @@ -69,7 +72,7 @@ public LocationMetadata() /// /// Gets the category of the region. Possible values include: - /// 'Recommended', 'Other' + /// 'Recommended', 'Extended', 'Other' /// [JsonProperty(PropertyName = "regionCategory")] public string RegionCategory { get; private set; } @@ -104,5 +107,11 @@ public LocationMetadata() [JsonProperty(PropertyName = "pairedRegion")] public IList PairedRegion { get; set; } + /// + /// Gets the home location of an edge zone. + /// + [JsonProperty(PropertyName = "homeLocation")] + public string HomeLocation { get; private set; } + } } diff --git a/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/LocationType.cs b/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/LocationType.cs new file mode 100644 index 0000000000000..dc03102a3ca3f --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/LocationType.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.ResourceManager.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for LocationType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum LocationType + { + [EnumMember(Value = "Region")] + Region, + [EnumMember(Value = "EdgeZone")] + EdgeZone + } + internal static class LocationTypeEnumExtension + { + internal static string ToSerializedValue(this LocationType? value) + { + return value == null ? null : ((LocationType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this LocationType value) + { + switch( value ) + { + case LocationType.Region: + return "Region"; + case LocationType.EdgeZone: + return "EdgeZone"; + } + return null; + } + + internal static LocationType? ParseLocationType(this string value) + { + switch( value ) + { + case "Region": + return LocationType.Region; + case "EdgeZone": + return LocationType.EdgeZone; + } + return null; + } + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/OperationListResult.cs b/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/OperationListResult.cs new file mode 100644 index 0000000000000..b75ee39d020d6 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/OperationListResult.cs @@ -0,0 +1,65 @@ +// +// 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.ResourceManager.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Result of the request to list Microsoft.Resources operations. It + /// contains a list of operations and a URL link to get the next set of + /// results. + /// + public partial class OperationListResult + { + /// + /// Initializes a new instance of the OperationListResult class. + /// + public OperationListResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationListResult class. + /// + /// List of Microsoft.Resources operations. + /// URL to get the next set of operation list + /// results if there are any. + public OperationListResult(IList value = default(IList), string nextLink = default(string)) + { + Value = value; + NextLink = nextLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of Microsoft.Resources operations. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + /// + /// Gets or sets URL to get the next set of operation list results if + /// there are any. + /// + [JsonProperty(PropertyName = "nextLink")] + public string NextLink { get; set; } + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/Page.cs b/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/Page.cs index c6f2533504c2f..b6856eceff690 100644 --- a/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/Page.cs +++ b/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/Page.cs @@ -26,7 +26,7 @@ public class Page : IPage /// /// Gets the link to the next page. /// - [JsonProperty("nextLink")] + [JsonProperty("")] public string NextPageLink { get; private set; } [JsonProperty("value")] diff --git a/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/Page1.cs b/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/Page1.cs index cd02c5c3d2c95..62aaea7013be7 100644 --- a/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/Page1.cs +++ b/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/Page1.cs @@ -26,7 +26,7 @@ public class Page1 : IPage /// /// Gets the link to the next page. /// - [JsonProperty("")] + [JsonProperty("nextLink")] public string NextPageLink { get; private set; } [JsonProperty("value")] diff --git a/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/RegionCategory.cs b/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/RegionCategory.cs index 0bc9be79dc53d..9c63b1e310f98 100644 --- a/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/RegionCategory.cs +++ b/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/RegionCategory.cs @@ -17,6 +17,7 @@ namespace Microsoft.Azure.Management.ResourceManager.Models public static class RegionCategory { public const string Recommended = "Recommended"; + public const string Extended = "Extended"; public const string Other = "Other"; } } diff --git a/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/ResourceName.cs b/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/ResourceName.cs new file mode 100644 index 0000000000000..ca2591d89888e --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/ResourceName.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.ResourceManager.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Name and Type of the Resource + /// + public partial class ResourceName + { + /// + /// Initializes a new instance of the ResourceName class. + /// + public ResourceName() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceName class. + /// + /// Name of the resource + /// The type of the resource + public ResourceName(string name, string type) + { + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of the resource + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the type of the resource + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (Type == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Type"); + } + } + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/ResourceNameStatus.cs b/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/ResourceNameStatus.cs new file mode 100644 index 0000000000000..367ba715abef3 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/Models/ResourceNameStatus.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.ResourceManager.Models +{ + + /// + /// Defines values for ResourceNameStatus. + /// + public static class ResourceNameStatus + { + public const string Allowed = "Allowed"; + public const string Reserved = "Reserved"; + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/SdkInfo_SubscriptionClient.cs b/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/SdkInfo_SubscriptionClient.cs index 23c6a7d9d72ec..98a50f71a6744 100644 --- a/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/SdkInfo_SubscriptionClient.cs +++ b/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/SdkInfo_SubscriptionClient.cs @@ -19,9 +19,9 @@ public static IEnumerable> ApiInfo_SubscriptionCli { return new Tuple[] { - new Tuple("Resources", "Operations", "2020-01-01"), - new Tuple("SubscriptionClient", "Subscriptions", "2020-01-01"), - new Tuple("SubscriptionClient", "Tenants", "2020-01-01"), + new Tuple("Resources", "checkResourceName", "2021-01-01"), + new Tuple("SubscriptionClient", "Subscriptions", "2021-01-01"), + new Tuple("SubscriptionClient", "Tenants", "2021-01-01"), }.AsEnumerable(); } } diff --git a/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/SubscriptionClient.cs b/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/SubscriptionClient.cs index 0dac5f27dfa14..49ddcd336c409 100644 --- a/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/SubscriptionClient.cs +++ b/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/SubscriptionClient.cs @@ -20,6 +20,8 @@ namespace Microsoft.Azure.Management.ResourceManager using System.Linq; using System.Net; using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; /// /// All resource groups and resources exist within subscriptions. These @@ -326,7 +328,7 @@ private void Initialize() Subscriptions = new SubscriptionsOperations(this); Tenants = new TenantsOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2020-01-01"; + ApiVersion = "2021-01-01"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; @@ -358,5 +360,196 @@ private void Initialize() CustomInitialize(); DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); } + /// + /// Checks resource name validity + /// + /// + /// A resource name is valid if it is not a reserved word, does not contains a + /// reserved word and does not start with a reserved word + /// + /// + /// Resource object with values for resource name and resource type + /// + /// + /// 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> CheckResourceNameWithHttpMessagesAsync(ResourceName resourceNameDefinition = default(ResourceName), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceNameDefinition != null) + { + resourceNameDefinition.Validate(); + } + if (ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceNameDefinition", resourceNameDefinition); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CheckResourceName", tracingParameters); + } + // Construct URL + var _baseUrl = BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Resources/checkResourceName").ToString(); + List _queryParameters = new List(); + if (ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(ApiVersion))); + } + 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("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (GenerateClientRequestId != null && GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", 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; + if(resourceNameDefinition != null) + { + _requestContent = SafeJsonConvert.SerializeObject(resourceNameDefinition, SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await 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 CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + 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 = SafeJsonConvert.DeserializeObject(_responseContent, 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/resources/Microsoft.Azure.Management.Resource/src/Generated/SubscriptionClientExtensions.cs b/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/SubscriptionClientExtensions.cs new file mode 100644 index 0000000000000..f641420a8f726 --- /dev/null +++ b/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/SubscriptionClientExtensions.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.ResourceManager +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SubscriptionClient. + /// + public static partial class SubscriptionClientExtensions + { + /// + /// Checks resource name validity + /// + /// + /// A resource name is valid if it is not a reserved word, does not contains a + /// reserved word and does not start with a reserved word + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource object with values for resource name and resource type + /// + public static CheckResourceNameResult CheckResourceName(this ISubscriptionClient operations, ResourceName resourceNameDefinition = default(ResourceName)) + { + return operations.CheckResourceNameAsync(resourceNameDefinition).GetAwaiter().GetResult(); + } + + /// + /// Checks resource name validity + /// + /// + /// A resource name is valid if it is not a reserved word, does not contains a + /// reserved word and does not start with a reserved word + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource object with values for resource name and resource type + /// + /// + /// The cancellation token. + /// + public static async Task CheckResourceNameAsync(this ISubscriptionClient operations, ResourceName resourceNameDefinition = default(ResourceName), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CheckResourceNameWithHttpMessagesAsync(resourceNameDefinition, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/SubscriptionsOperations.cs b/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/SubscriptionsOperations.cs index 3a87a3ce06ac6..6eba1ee33ec1c 100644 --- a/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/SubscriptionsOperations.cs +++ b/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/SubscriptionsOperations.cs @@ -61,6 +61,9 @@ internal SubscriptionsOperations(SubscriptionClient client) /// /// The ID of the target subscription. /// + /// + /// Whether to include extended locations. + /// /// /// Headers that will be added to request. /// @@ -82,7 +85,7 @@ internal SubscriptionsOperations(SubscriptionClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListLocationsWithHttpMessagesAsync(string subscriptionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListLocationsWithHttpMessagesAsync(string subscriptionId, bool? includeExtendedLocations = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (subscriptionId == null) { @@ -100,6 +103,7 @@ internal SubscriptionsOperations(SubscriptionClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("subscriptionId", subscriptionId); + tracingParameters.Add("includeExtendedLocations", includeExtendedLocations); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListLocations", tracingParameters); } @@ -112,6 +116,10 @@ internal SubscriptionsOperations(SubscriptionClient client) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } + if (includeExtendedLocations != null) + { + _queryParameters.Add(string.Format("includeExtendedLocations={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(includeExtendedLocations, Client.SerializationSettings).Trim('"')))); + } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); diff --git a/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/SubscriptionsOperationsExtensions.cs b/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/SubscriptionsOperationsExtensions.cs index adc41a4670a8e..d8a02d02e6188 100644 --- a/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/SubscriptionsOperationsExtensions.cs +++ b/sdk/resources/Microsoft.Azure.Management.Resource/src/Generated/SubscriptionsOperationsExtensions.cs @@ -37,9 +37,12 @@ public static partial class SubscriptionsOperationsExtensions /// /// The ID of the target subscription. /// - public static IEnumerable ListLocations(this ISubscriptionsOperations operations, string subscriptionId) + /// + /// Whether to include extended locations. + /// + public static IEnumerable ListLocations(this ISubscriptionsOperations operations, string subscriptionId, bool? includeExtendedLocations = default(bool?)) { - return operations.ListLocationsAsync(subscriptionId).GetAwaiter().GetResult(); + return operations.ListLocationsAsync(subscriptionId, includeExtendedLocations).GetAwaiter().GetResult(); } /// @@ -56,12 +59,15 @@ public static IEnumerable ListLocations(this ISubscriptionsOperations /// /// The ID of the target subscription. /// + /// + /// Whether to include extended locations. + /// /// /// The cancellation token. /// - public static async Task> ListLocationsAsync(this ISubscriptionsOperations operations, string subscriptionId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListLocationsAsync(this ISubscriptionsOperations operations, string subscriptionId, bool? includeExtendedLocations = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListLocationsWithHttpMessagesAsync(subscriptionId, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListLocationsWithHttpMessagesAsync(subscriptionId, includeExtendedLocations, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/resources/Microsoft.Azure.Management.Resource/src/Properties/AssemblyInfo.cs b/sdk/resources/Microsoft.Azure.Management.Resource/src/Properties/AssemblyInfo.cs index 8b7ad74029f8f..a809d70ecda6e 100644 --- a/sdk/resources/Microsoft.Azure.Management.Resource/src/Properties/AssemblyInfo.cs +++ b/sdk/resources/Microsoft.Azure.Management.Resource/src/Properties/AssemblyInfo.cs @@ -8,7 +8,7 @@ [assembly: AssemblyDescription("Provides Microsoft Azure resource management operations including Resource Groups.")] [assembly: AssemblyVersion("3.0.0.0")] -[assembly: AssemblyFileVersion("3.13.2.0")] +[assembly: AssemblyFileVersion("3.13.3.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("Azure .NET SDK")] diff --git a/sdk/resources/Microsoft.Azure.Management.Resource/src/generate.ps1 b/sdk/resources/Microsoft.Azure.Management.Resource/src/generate.ps1 index 5c362737b3785..ba8584578beed 100644 --- a/sdk/resources/Microsoft.Azure.Management.Resource/src/generate.ps1 +++ b/sdk/resources/Microsoft.Azure.Management.Resource/src/generate.ps1 @@ -9,7 +9,7 @@ Start-AutoRestCodeGeneration -ResourceProvider "resources/resource-manager" -SdkRepoRootPath "$PSScriptRoot\..\..\..\.." -AutoRestVersion "v2" -AutoRestCodeGenerationFlags "--tag=package-templatespecs-2021-05" -SdkGenerationDirectory "$PSScriptRoot\Generated\TemplateSpecs" # Generate package with subscriptions tag -#Start-AutoRestCodeGeneration -ResourceProvider "resources/resource-manager" -SdkRepoRootPath "$PSScriptRoot\..\..\..\.." -AutoRestVersion "v2" -AutoRestCodeGenerationFlags "--tag=package-subscriptions-2020-01" -SdkGenerationDirectory "$PSScriptRoot\Generated\Subscriptions" +# Start-AutoRestCodeGeneration -ResourceProvider "resources/resource-manager" -SdkRepoRootPath "$PSScriptRoot\..\..\..\.." -AutoRestVersion "v2" -AutoRestCodeGenerationFlags "--tag=package-subscriptions-2021-01" -SdkGenerationDirectory "$PSScriptRoot\Generated\Subscriptions" # Generate package with policy tag # Start-AutoRestCodeGeneration -ResourceProvider "resources/resource-manager" -SdkRepoRootPath "$PSScriptRoot\..\..\..\.." -AutoRestVersion "v2" -AutoRestCodeGenerationFlags "--tag=package-policy-2020-09" -SdkGenerationDirectory "$PSScriptRoot\GeneratedPolicy202009"