From 5d3dd6e3f14c6d6e89972ba89e2cf45f78a5a6b6 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 19 Nov 2020 05:12:43 +0000 Subject: [PATCH] CodeGen from PR 11405 in Azure/azure-rest-api-specs Swagger Correctness for Cognitive Services (#11405) * Swagger Correctness * Undo changes in 2016-02-01-preview * Move location of field * change enum type to string for Sku.tier --- .../Generated/Models/AzureEntityResource.cs | 15 ++-- .../CognitiveServicesAccountProperties.cs | 11 ++- .../src/Generated/Models/IpRule.cs | 70 +++++++++++++++++++ .../Models/PrivateEndpointConnection.cs | 8 +-- .../Generated/Models/PrivateLinkResource.cs | 8 +-- .../src/Generated/Models/ProxyResource.cs | 15 ++-- .../src/Generated/Models/Resource.cs | 23 +++--- .../src/Generated/Models/Sku.cs | 10 +-- .../src/Generated/Models/SkuTier.cs | 52 ++------------ .../src/Generated/Models/TrackedResource.cs | 14 ++-- ...kInfo_CognitiveServicesManagementClient.cs | 33 +++++++++ 11 files changed, 173 insertions(+), 86 deletions(-) create mode 100644 sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/IpRule.cs diff --git a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/AzureEntityResource.cs b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/AzureEntityResource.cs index d3d4f48fd874d..c8715fd7346b8 100644 --- a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/AzureEntityResource.cs +++ b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/AzureEntityResource.cs @@ -14,9 +14,12 @@ namespace Microsoft.Azure.Management.CognitiveServices.Models using System.Linq; /// - /// The resource model definition for a Azure Resource Manager resource - /// with an etag. + /// Entity Resource /// + /// + /// The resource model definition for an Azure Resource Manager resource + /// with an etag. + /// public partial class AzureEntityResource : Resource { /// @@ -30,12 +33,12 @@ public AzureEntityResource() /// /// Initializes a new instance of the AzureEntityResource class. /// - /// Fully qualified resource Id for the resource. Ex - + /// Fully qualified resource ID for the resource. Ex - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} /// The name of the resource - /// The type of the resource. Ex- - /// Microsoft.Compute/virtualMachines or - /// Microsoft.Storage/storageAccounts. + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" /// Resource Etag. public AzureEntityResource(string id = default(string), string name = default(string), string type = default(string), string etag = default(string)) : base(id, name, type) diff --git a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/CognitiveServicesAccountProperties.cs b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/CognitiveServicesAccountProperties.cs index e46d5ebeb4217..ce06dda3484ac 100644 --- a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/CognitiveServicesAccountProperties.cs +++ b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/CognitiveServicesAccountProperties.cs @@ -58,7 +58,9 @@ public CognitiveServicesAccountProperties() /// 'Enabled', 'Disabled' /// The api properties for special /// APIs. - public CognitiveServicesAccountProperties(string provisioningState = default(string), string endpoint = default(string), string internalId = default(string), IList capabilities = default(IList), string customSubDomainName = default(string), NetworkRuleSet networkAcls = default(NetworkRuleSet), Encryption encryption = default(Encryption), IList userOwnedStorage = default(IList), IList privateEndpointConnections = default(IList), string publicNetworkAccess = default(string), CognitiveServicesAccountApiProperties apiProperties = default(CognitiveServicesAccountApiProperties)) + /// Gets the date of cognitive services + /// account creation. + public CognitiveServicesAccountProperties(string provisioningState = default(string), string endpoint = default(string), string internalId = default(string), IList capabilities = default(IList), string customSubDomainName = default(string), NetworkRuleSet networkAcls = default(NetworkRuleSet), Encryption encryption = default(Encryption), IList userOwnedStorage = default(IList), IList privateEndpointConnections = default(IList), string publicNetworkAccess = default(string), CognitiveServicesAccountApiProperties apiProperties = default(CognitiveServicesAccountApiProperties), string dateCreated = default(string)) { ProvisioningState = provisioningState; Endpoint = endpoint; @@ -71,6 +73,7 @@ public CognitiveServicesAccountProperties() PrivateEndpointConnections = privateEndpointConnections; PublicNetworkAccess = publicNetworkAccess; ApiProperties = apiProperties; + DateCreated = dateCreated; CustomInit(); } @@ -154,6 +157,12 @@ public CognitiveServicesAccountProperties() [JsonProperty(PropertyName = "apiProperties")] public CognitiveServicesAccountApiProperties ApiProperties { get; set; } + /// + /// Gets the date of cognitive services account creation. + /// + [JsonProperty(PropertyName = "dateCreated")] + public string DateCreated { get; private set; } + /// /// Validate the object. /// diff --git a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/IpRule.cs b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/IpRule.cs new file mode 100644 index 0000000000000..0f28403b7703c --- /dev/null +++ b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/IpRule.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.CognitiveServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A rule governing the accessibility from a specific ip address or ip + /// range. + /// + public partial class IpRule + { + /// + /// Initializes a new instance of the IpRule class. + /// + public IpRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IpRule class. + /// + /// An IPv4 address range in CIDR notation, such as + /// '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all + /// addresses that start with 124.56.78). + public IpRule(string value) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets an IPv4 address range in CIDR notation, such as + /// '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all + /// addresses that start with 124.56.78). + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Value == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Value"); + } + } + } +} diff --git a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/PrivateEndpointConnection.cs b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/PrivateEndpointConnection.cs index 3d46b3b349c08..b24cf24c19bf8 100644 --- a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/PrivateEndpointConnection.cs +++ b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/PrivateEndpointConnection.cs @@ -29,12 +29,12 @@ public PrivateEndpointConnection() /// /// Initializes a new instance of the PrivateEndpointConnection class. /// - /// Fully qualified resource Id for the resource. Ex - + /// Fully qualified resource ID for the resource. Ex - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} /// The name of the resource - /// The type of the resource. Ex- - /// Microsoft.Compute/virtualMachines or - /// Microsoft.Storage/storageAccounts. + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" /// Resource properties. public PrivateEndpointConnection(string id = default(string), string name = default(string), string type = default(string), PrivateEndpointConnectionProperties properties = default(PrivateEndpointConnectionProperties)) : base(id, name, type) diff --git a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/PrivateLinkResource.cs b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/PrivateLinkResource.cs index e20747e809698..5860bf8a1b804 100644 --- a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/PrivateLinkResource.cs +++ b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/PrivateLinkResource.cs @@ -29,12 +29,12 @@ public PrivateLinkResource() /// /// Initializes a new instance of the PrivateLinkResource class. /// - /// Fully qualified resource Id for the resource. Ex - + /// Fully qualified resource ID for the resource. Ex - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} /// The name of the resource - /// The type of the resource. Ex- - /// Microsoft.Compute/virtualMachines or - /// Microsoft.Storage/storageAccounts. + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" /// Resource properties. public PrivateLinkResource(string id = default(string), string name = default(string), string type = default(string), PrivateLinkResourceProperties properties = default(PrivateLinkResourceProperties)) : base(id, name, type) diff --git a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/ProxyResource.cs b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/ProxyResource.cs index 82855a45ea04d..2027ea5ba3e46 100644 --- a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/ProxyResource.cs +++ b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/ProxyResource.cs @@ -13,9 +13,12 @@ namespace Microsoft.Azure.Management.CognitiveServices.Models using System.Linq; /// - /// The resource model definition for a ARM proxy resource. It will have - /// everything other than required location and tags + /// Proxy Resource /// + /// + /// The resource model definition for a Azure Resource Manager proxy + /// resource. It will not have tags and a location + /// public partial class ProxyResource : Resource { /// @@ -29,12 +32,12 @@ public ProxyResource() /// /// Initializes a new instance of the ProxyResource class. /// - /// Fully qualified resource Id for the resource. Ex - + /// Fully qualified resource ID for the resource. Ex - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} /// The name of the resource - /// The type of the resource. Ex- - /// Microsoft.Compute/virtualMachines or - /// Microsoft.Storage/storageAccounts. + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" public ProxyResource(string id = default(string), string name = default(string), string type = default(string)) : base(id, name, type) { diff --git a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/Resource.cs b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/Resource.cs index da7056a32edcc..522c97e78bb4f 100644 --- a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/Resource.cs +++ b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/Resource.cs @@ -15,6 +15,13 @@ namespace Microsoft.Azure.Management.CognitiveServices.Models using Newtonsoft.Json; using System.Linq; + /// + /// Resource + /// + /// + /// Common fields that are returned in the response for all Azure Resource + /// Manager resources + /// public partial class Resource : IResource { /// @@ -28,12 +35,12 @@ public Resource() /// /// Initializes a new instance of the Resource class. /// - /// Fully qualified resource Id for the resource. Ex - + /// Fully qualified resource ID for the resource. Ex - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} /// The name of the resource - /// The type of the resource. Ex- - /// Microsoft.Compute/virtualMachines or - /// Microsoft.Storage/storageAccounts. + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" public Resource(string id = default(string), string name = default(string), string type = default(string)) { Id = id; @@ -48,7 +55,7 @@ public Resource() partial void CustomInit(); /// - /// Gets fully qualified resource Id for the resource. Ex - + /// Gets fully qualified resource ID for the resource. Ex - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} /// [JsonProperty(PropertyName = "id")] @@ -61,9 +68,9 @@ public Resource() public string Name { get; private set; } /// - /// Gets the type of the resource. Ex- - /// Microsoft.Compute/virtualMachines or - /// Microsoft.Storage/storageAccounts. + /// Gets the type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" /// [JsonProperty(PropertyName = "type")] public string Type { get; private set; } diff --git a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/Sku.cs b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/Sku.cs index c6c05888028e9..880aff9ada5e6 100644 --- a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/Sku.cs +++ b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/Sku.cs @@ -33,9 +33,9 @@ public Sku() /// Gets or sets the sku name. Required for account /// creation, optional for update. /// Gets the sku tier. This is based on the SKU - /// name. Possible values include: 'Free', 'Standard', - /// 'Premium' - public Sku(string name, SkuTier? tier = default(SkuTier?)) + /// name. Possible values include: 'Free', 'Standard', 'Premium', + /// 'Enterprise' + public Sku(string name, string tier = default(string)) { Name = name; Tier = tier; @@ -56,10 +56,10 @@ public Sku() /// /// Gets the sku tier. This is based on the SKU name. Possible values - /// include: 'Free', 'Standard', 'Premium' + /// include: 'Free', 'Standard', 'Premium', 'Enterprise' /// [JsonProperty(PropertyName = "tier")] - public SkuTier? Tier { get; private set; } + public string Tier { get; private set; } /// /// Validate the object. diff --git a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/SkuTier.cs b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/SkuTier.cs index 427c381e77545..3e22fe28093e8 100644 --- a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/SkuTier.cs +++ b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/SkuTier.cs @@ -10,57 +10,15 @@ namespace Microsoft.Azure.Management.CognitiveServices.Models { - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; /// /// Defines values for SkuTier. /// - [JsonConverter(typeof(StringEnumConverter))] - public enum SkuTier + public static class SkuTier { - [EnumMember(Value = "Free")] - Free, - [EnumMember(Value = "Standard")] - Standard, - [EnumMember(Value = "Premium")] - Premium - } - internal static class SkuTierEnumExtension - { - internal static string ToSerializedValue(this SkuTier? value) - { - return value == null ? null : ((SkuTier)value).ToSerializedValue(); - } - - internal static string ToSerializedValue(this SkuTier value) - { - switch( value ) - { - case SkuTier.Free: - return "Free"; - case SkuTier.Standard: - return "Standard"; - case SkuTier.Premium: - return "Premium"; - } - return null; - } - - internal static SkuTier? ParseSkuTier(this string value) - { - switch( value ) - { - case "Free": - return SkuTier.Free; - case "Standard": - return SkuTier.Standard; - case "Premium": - return SkuTier.Premium; - } - return null; - } + public const string Free = "Free"; + public const string Standard = "Standard"; + public const string Premium = "Premium"; + public const string Enterprise = "Enterprise"; } } diff --git a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/TrackedResource.cs b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/TrackedResource.cs index 9427f61e32c1f..c65acb146c65d 100644 --- a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/TrackedResource.cs +++ b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/Models/TrackedResource.cs @@ -17,8 +17,12 @@ namespace Microsoft.Azure.Management.CognitiveServices.Models using System.Linq; /// - /// The resource model definition for a ARM tracked top level resource + /// Tracked Resource /// + /// + /// The resource model definition for an Azure Resource Manager tracked top + /// level resource which has 'tags' and a 'location' + /// public partial class TrackedResource : Resource { /// @@ -34,12 +38,12 @@ public TrackedResource() /// /// The geo-location where the resource /// lives - /// Fully qualified resource Id for the resource. Ex - + /// Fully qualified resource ID for the resource. Ex - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} /// The name of the resource - /// The type of the resource. Ex- - /// Microsoft.Compute/virtualMachines or - /// Microsoft.Storage/storageAccounts. + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" /// Resource tags. public TrackedResource(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary)) : base(id, name, type) diff --git a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/SdkInfo_CognitiveServicesManagementClient.cs b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/SdkInfo_CognitiveServicesManagementClient.cs index e69de29bb2d1d..20770fa6cc88d 100644 --- a/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/SdkInfo_CognitiveServicesManagementClient.cs +++ b/sdk/cognitiveservices/Microsoft.Azure.Management.CognitiveServices/src/Generated/SdkInfo_CognitiveServicesManagementClient.cs @@ -0,0 +1,33 @@ + +// +// 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.CognitiveServices +{ + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_CognitiveServicesManagementClient + { + get + { + return new Tuple[] + { + new Tuple("CognitiveServices", "Accounts", "2017-04-18"), + new Tuple("CognitiveServices", "CheckDomainAvailability", "2017-04-18"), + new Tuple("CognitiveServices", "CheckSkuAvailability", "2017-04-18"), + new Tuple("CognitiveServices", "Operations", "2017-04-18"), + new Tuple("CognitiveServices", "PrivateEndpointConnections", "2017-04-18"), + new Tuple("CognitiveServices", "PrivateLinkResources", "2017-04-18"), + new Tuple("CognitiveServices", "ResourceSkus", "2017-04-18"), + }.AsEnumerable(); + } + } + } +}