diff --git a/eng/CodeGeneration.targets b/eng/CodeGeneration.targets index 4c38c3f9d000b..fbd07dcab6508 100644 --- a/eng/CodeGeneration.targets +++ b/eng/CodeGeneration.targets @@ -3,7 +3,7 @@ <_AutoRestVersion>https://github.com/Azure/autorest/releases/download/autorest-3.0.6222/autorest-3.0.6222.tgz <_AutoRestCoreVersion>3.0.6282 - <_AutoRestCSharpVersion>https://github.com/Azure/autorest.csharp/releases/download/3.0.0-dev.20200506.1/autorest-csharp-v3-3.0.0-dev.20200506.1.tgz + <_AutoRestCSharpVersion>https://github.com/Azure/autorest.csharp/releases/download/3.0.0-dev.20200513.3/autorest-csharp-v3-3.0.0-dev.20200513.3.tgz <_SupportsCodeGeneration Condition="'$(IsClientLibrary)' == 'true'">true <_DefaultInputName Condition="Exists('$(MSBuildProjectDirectory)/autorest.md')">$(MSBuildProjectDirectory)/autorest.md $(_DefaultInputName) diff --git a/sdk/core/Azure.Core/src/Shared/AutoRest/CodeGenClientAttribute.cs b/sdk/core/Azure.Core/src/Shared/AutoRest/CodeGenClientAttribute.cs index 08658438d75af..522ee46691d46 100644 --- a/sdk/core/Azure.Core/src/Shared/AutoRest/CodeGenClientAttribute.cs +++ b/sdk/core/Azure.Core/src/Shared/AutoRest/CodeGenClientAttribute.cs @@ -6,13 +6,10 @@ namespace Azure.Core { [AttributeUsage(AttributeTargets.Class)] - internal class CodeGenClientAttribute : Attribute + internal class CodeGenClientAttribute : CodeGenTypeAttribute { - public string OriginalName { get; } - - public CodeGenClientAttribute(string originalName) + public CodeGenClientAttribute(string originalName) : base(originalName) { - OriginalName = originalName; } } } \ No newline at end of file diff --git a/sdk/core/Azure.Core/src/Shared/AutoRest/CodeGenMemberAttribute.cs b/sdk/core/Azure.Core/src/Shared/AutoRest/CodeGenMemberAttribute.cs index 14c0870a293dc..0e98c8bbc15bf 100644 --- a/sdk/core/Azure.Core/src/Shared/AutoRest/CodeGenMemberAttribute.cs +++ b/sdk/core/Azure.Core/src/Shared/AutoRest/CodeGenMemberAttribute.cs @@ -8,10 +8,8 @@ namespace Azure.Core { [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] - internal class CodeGenMemberAttribute : Attribute + internal class CodeGenMemberAttribute : CodeGenTypeAttribute { - public string? OriginalName { get; } - /// /// For collection properties. When set to true empty collection would be treated as undefined and not serialized. /// @@ -23,13 +21,12 @@ internal class CodeGenMemberAttribute : Attribute /// public bool Initialize { get; set; } - public CodeGenMemberAttribute() + public CodeGenMemberAttribute() : base(null) { } - public CodeGenMemberAttribute(string originalName) + public CodeGenMemberAttribute(string originalName) : base(originalName) { - OriginalName = originalName; } } } \ No newline at end of file diff --git a/sdk/core/Azure.Core/src/Shared/AutoRest/CodeGenModelAttribute.cs b/sdk/core/Azure.Core/src/Shared/AutoRest/CodeGenModelAttribute.cs index f1a8d55e3e2ed..ccf88b745aad0 100644 --- a/sdk/core/Azure.Core/src/Shared/AutoRest/CodeGenModelAttribute.cs +++ b/sdk/core/Azure.Core/src/Shared/AutoRest/CodeGenModelAttribute.cs @@ -8,13 +8,10 @@ namespace Azure.Core { [AttributeUsage(AttributeTargets.Class | AttributeTargets.Enum | AttributeTargets.Struct)] - internal class CodeGenModelAttribute : Attribute + internal class CodeGenModelAttribute : CodeGenTypeAttribute { - public string OriginalName { get; } - - public CodeGenModelAttribute(string originalName) + public CodeGenModelAttribute(string originalName): base(originalName) { - OriginalName = originalName; } } } diff --git a/sdk/core/Azure.Core/src/Shared/AutoRest/CodeGenTypeAttribute.cs b/sdk/core/Azure.Core/src/Shared/AutoRest/CodeGenTypeAttribute.cs new file mode 100644 index 0000000000000..08095da55db65 --- /dev/null +++ b/sdk/core/Azure.Core/src/Shared/AutoRest/CodeGenTypeAttribute.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable enable + +using System; + +namespace Azure.Core +{ + [AttributeUsage(AttributeTargets.Class)] + internal class CodeGenTypeAttribute : Attribute + { + public string? OriginalName { get; } + + public CodeGenTypeAttribute(string? originalName) + { + OriginalName = originalName; + } + } +} \ No newline at end of file diff --git a/sdk/core/Azure.Core/src/Shared/AutoRest/ManagementPipelineBuilder.cs b/sdk/core/Azure.Core/src/Shared/AutoRest/ManagementPipelineBuilder.cs index 8c7fabd3f8a04..04a04b4d6ec69 100644 --- a/sdk/core/Azure.Core/src/Shared/AutoRest/ManagementPipelineBuilder.cs +++ b/sdk/core/Azure.Core/src/Shared/AutoRest/ManagementPipelineBuilder.cs @@ -14,9 +14,9 @@ namespace Azure.Core { internal static class ManagementPipelineBuilder { - public static HttpPipeline Build(TokenCredential credential, ClientOptions options) + public static HttpPipeline Build(TokenCredential credential, string host, ClientOptions options) { - return HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(credential, "https://management.azure.com//.default")); + return HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(credential, $"{host}/.default")); } } } \ No newline at end of file diff --git a/sdk/core/Azure.Core/src/Shared/AutoRest/TypeFormatters.cs b/sdk/core/Azure.Core/src/Shared/AutoRest/TypeFormatters.cs index 24f5cc85a92e9..4cbf912690815 100644 --- a/sdk/core/Azure.Core/src/Shared/AutoRest/TypeFormatters.cs +++ b/sdk/core/Azure.Core/src/Shared/AutoRest/TypeFormatters.cs @@ -108,7 +108,7 @@ private static int GetNumBase64PaddingCharsToAddForDecode(int inputLength) } public static DateTimeOffset ParseDateTimeOffset(string value) => - DateTimeOffset.Parse(value, CultureInfo.InvariantCulture); + DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal); public static TimeSpan ParseTimeSpan(string value, string format) => format switch { diff --git a/sdk/search/Azure.Search.Documents/api/Azure.Search.Documents.netstandard2.0.cs b/sdk/search/Azure.Search.Documents/api/Azure.Search.Documents.netstandard2.0.cs index e0956cae1c043..ea476839065eb 100644 --- a/sdk/search/Azure.Search.Documents/api/Azure.Search.Documents.netstandard2.0.cs +++ b/sdk/search/Azure.Search.Documents/api/Azure.Search.Documents.netstandard2.0.cs @@ -413,8 +413,8 @@ public EntityRecognitionSkill(System.Collections.Generic.IEnumerable Polish. public static EntityRecognitionSkillLanguage Pl { get; } = new EntityRecognitionSkillLanguage(PlValue); /// Portuguese (Portugal). - public static EntityRecognitionSkillLanguage Pt { get; } = new EntityRecognitionSkillLanguage(PtValue); + public static EntityRecognitionSkillLanguage PtPT { get; } = new EntityRecognitionSkillLanguage(PtPTValue); /// Portuguese (Brazil). public static EntityRecognitionSkillLanguage PtBR { get; } = new EntityRecognitionSkillLanguage(PtBRValue); /// Russian. diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/KeyPhraseExtractionSkillLanguage.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/KeyPhraseExtractionSkillLanguage.cs index 907169c8474e5..3ee1d1d05c38c 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/KeyPhraseExtractionSkillLanguage.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/KeyPhraseExtractionSkillLanguage.cs @@ -32,7 +32,7 @@ public KeyPhraseExtractionSkillLanguage(string value) private const string KoValue = "ko"; private const string NoValue = "no"; private const string PlValue = "pl"; - private const string PtValue = "pt-PT"; + private const string PtPTValue = "pt-PT"; private const string PtBRValue = "pt-BR"; private const string RuValue = "ru"; private const string EsValue = "es"; @@ -61,7 +61,7 @@ public KeyPhraseExtractionSkillLanguage(string value) /// Polish. public static KeyPhraseExtractionSkillLanguage Pl { get; } = new KeyPhraseExtractionSkillLanguage(PlValue); /// Portuguese (Portugal). - public static KeyPhraseExtractionSkillLanguage Pt { get; } = new KeyPhraseExtractionSkillLanguage(PtValue); + public static KeyPhraseExtractionSkillLanguage PtPT { get; } = new KeyPhraseExtractionSkillLanguage(PtPTValue); /// Portuguese (Brazil). public static KeyPhraseExtractionSkillLanguage PtBR { get; } = new KeyPhraseExtractionSkillLanguage(PtBRValue); /// Russian. diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/LexicalAnalyzerName.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/LexicalAnalyzerName.cs index 78ec45ad589b9..2ed2dc538a690 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/LexicalAnalyzerName.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/LexicalAnalyzerName.cs @@ -83,8 +83,8 @@ public LexicalAnalyzerName(string value) private const string PlLuceneValue = "pl.lucene"; private const string PtBrMicrosoftValue = "pt-BR.microsoft"; private const string PtBrLuceneValue = "pt-BR.lucene"; - private const string PtMicrosoftValue = "pt-PT.microsoft"; - private const string PtLuceneValue = "pt-PT.lucene"; + private const string PtPtMicrosoftValue = "pt-PT.microsoft"; + private const string PtPtLuceneValue = "pt-PT.lucene"; private const string PaMicrosoftValue = "pa.microsoft"; private const string RoMicrosoftValue = "ro.microsoft"; private const string RoLuceneValue = "ro.lucene"; @@ -240,9 +240,9 @@ public LexicalAnalyzerName(string value) /// Lucene analyzer for Portuguese (Brazil). public static LexicalAnalyzerName PtBrLucene { get; } = new LexicalAnalyzerName(PtBrLuceneValue); /// Microsoft analyzer for Portuguese (Portugal). - public static LexicalAnalyzerName PtMicrosoft { get; } = new LexicalAnalyzerName(PtMicrosoftValue); + public static LexicalAnalyzerName PtPtMicrosoft { get; } = new LexicalAnalyzerName(PtPtMicrosoftValue); /// Lucene analyzer for Portuguese (Portugal). - public static LexicalAnalyzerName PtLucene { get; } = new LexicalAnalyzerName(PtLuceneValue); + public static LexicalAnalyzerName PtPtLucene { get; } = new LexicalAnalyzerName(PtPtLuceneValue); /// Microsoft analyzer for Punjabi. public static LexicalAnalyzerName PaMicrosoft { get; } = new LexicalAnalyzerName(PaMicrosoftValue); /// Microsoft analyzer for Romanian. diff --git a/sdk/search/Azure.Search.Documents/src/Generated/Models/SentimentSkillLanguage.cs b/sdk/search/Azure.Search.Documents/src/Generated/Models/SentimentSkillLanguage.cs index 21f92b34f595e..402a5b4a5b219 100644 --- a/sdk/search/Azure.Search.Documents/src/Generated/Models/SentimentSkillLanguage.cs +++ b/sdk/search/Azure.Search.Documents/src/Generated/Models/SentimentSkillLanguage.cs @@ -31,7 +31,7 @@ public SentimentSkillLanguage(string value) private const string ItValue = "it"; private const string NoValue = "no"; private const string PlValue = "pl"; - private const string PtValue = "pt-PT"; + private const string PtPTValue = "pt-PT"; private const string RuValue = "ru"; private const string EsValue = "es"; private const string SvValue = "sv"; @@ -58,7 +58,7 @@ public SentimentSkillLanguage(string value) /// Polish. public static SentimentSkillLanguage Pl { get; } = new SentimentSkillLanguage(PlValue); /// Portuguese (Portugal). - public static SentimentSkillLanguage Pt { get; } = new SentimentSkillLanguage(PtValue); + public static SentimentSkillLanguage PtPT { get; } = new SentimentSkillLanguage(PtPTValue); /// Russian. public static SentimentSkillLanguage Ru { get; } = new SentimentSkillLanguage(RuValue); /// Spanish.