Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update AutoRest C# version #15469

Merged
merged 6 commits into from
Sep 29, 2020
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eng/Packages.Data.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<ItemGroup>
<PackageReference Update="ApprovalTests" Version="3.0.22" />
<PackageReference Update="ApprovalUtilities" Version="3.0.22" />
<PackageReference Update="AutoRest.CSharp.V3" Version="1.0.0-alpha.20200922.1" />
<PackageReference Update="AutoRest.CSharp.V3" Version="1.0.0-alpha.20200928.1" />
<PackageReference Update="Azure.AI.FormRecognizer" Version="3.0.0" />
<PackageReference Update="Azure.AI.TextAnalytics" Version="5.0.0" />
<PackageReference Update="Azure.Data.AppConfiguration" Version="1.0.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace Azure.AI.AnomalyDetector
/// <summary>
/// <see cref="AnomalyDetectorClient"/> is use to connect to the Azure Cognitive Anomaly Detector Service.
/// </summary>
[CodeGenClient("ServiceClient")]
public partial class AnomalyDetectorClient
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@

namespace Azure.Communication.Chat
{
[CodeGenClient("ServiceRestClient")]
[CodeGenClient("AzureCommunicationChatServiceRestClient")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a correct title?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am guessing it is removing the whitespaces in the title.
Eg: "Azure Communication Chat Service" is becoming "AzureCommunicationChatServiceRestClient". In which case, I wonder if we should set the titles differently.
https://github.com/Azure/azure-rest-api-specs/blob/master/specification/communication/data-plane/Microsoft.CommunicationServicesChat/preview/2020-09-21-preview2/communicationserviceschat.json#L4

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pakrym Yes, it is coming from the title. Please let me know if we want to set a different title for this.

internal partial class ChatRestClient { }
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace Azure.Messaging.EventGrid
/// </summary>
public class EventGridPublisherClient
{
private readonly ServiceRestClient _serviceRestClient;
private readonly EventGridRestClient _serviceRestClient;
private readonly ClientDiagnostics _clientDiagnostics;
private string _hostName => _endpoint.Host;
private readonly Uri _endpoint;
Expand Down Expand Up @@ -66,7 +66,7 @@ public EventGridPublisherClient(Uri endpoint, AzureKeyCredential credential, Eve
_endpoint = endpoint;
_key = credential;
HttpPipeline pipeline = HttpPipelineBuilder.Build(options, new AzureKeyCredentialPolicy(credential, Constants.SasKeyName));
_serviceRestClient = new ServiceRestClient(new ClientDiagnostics(options), pipeline, options.Version.GetVersionString());
_serviceRestClient = new EventGridRestClient(new ClientDiagnostics(options), pipeline, options.Version.GetVersionString());
_clientDiagnostics = new ClientDiagnostics(options);
}

Expand All @@ -83,7 +83,7 @@ public EventGridPublisherClient(Uri endpoint, EventGridSharedAccessSignatureCred
_dataSerializer = options.DataSerializer ?? new JsonObjectSerializer();
_endpoint = endpoint;
HttpPipeline pipeline = HttpPipelineBuilder.Build(options, new EventGridSharedAccessSignatureCredentialPolicy(credential));
_serviceRestClient = new ServiceRestClient(new ClientDiagnostics(options), pipeline, options.Version.GetVersionString());
_serviceRestClient = new EventGridRestClient(new ClientDiagnostics(options), pipeline, options.Version.GetVersionString());
_clientDiagnostics = new ClientDiagnostics(options);
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions sdk/eventgrid/Azure.Messaging.EventGrid/src/autorest.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ directive:
}
}

title: EventGridClient
input-file:
- https://github.com/ellismg/azure-rest-api-specs/blob/4bb5b76cb8401896b15f1be3fdaac6bd5d299b17/specification/eventgrid/data-plane/Microsoft.EventGrid/stable/2018-01-01/EventGrid.json
- https://github.com/Azure/azure-rest-api-specs/blob/3e974736d767fd714b4fb0570aa352e774582ecd/specification/eventgrid/data-plane/Microsoft.Storage/stable/2018-01-01/Storage.json
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
namespace Microsoft.Azure.WebJobs.Extensions.EventGrid
{
[Microsoft.Azure.WebJobs.Description.BindingAttribute]
[System.AttributeUsageAttribute(System.AttributeTargets.Parameter | System.AttributeTargets.ReturnValue)]
public sealed partial class EventGridAttribute : System.Attribute
{
public EventGridAttribute() { }
[Microsoft.Azure.WebJobs.Description.AppSettingAttribute]
public string TopicEndpointUri { get { throw null; } set { } }
[Microsoft.Azure.WebJobs.Description.AppSettingAttribute]
public string TopicKeySetting { get { throw null; } set { } }
}
[Microsoft.Azure.WebJobs.Description.BindingAttribute]
[System.AttributeUsageAttribute(System.AttributeTargets.Parameter)]
public sealed partial class EventGridTriggerAttribute : System.Attribute
{
public EventGridTriggerAttribute() { }
}
public static partial class EventGridWebJobsBuilderExtensions
{
public static Microsoft.Azure.WebJobs.IWebJobsBuilder AddEventGrid(this Microsoft.Azure.WebJobs.IWebJobsBuilder builder) { throw null; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace Azure.AI.FormRecognizer.Training
public class CopyModelOperation : Operation<CustomFormModelInfo>
{
/// <summary>Provides communication with the Form Recognizer Azure Cognitive Service through its REST API.</summary>
private readonly ServiceRestClient _serviceClient;
private readonly FormRecognizerRestClient _serviceClient;

/// <summary>Provides tools for exception creation in case of failure.</summary>
private readonly ClientDiagnostics _diagnostics;
Expand Down Expand Up @@ -115,7 +115,7 @@ public CopyModelOperation(string operationId, string targetModelId, FormTraining
/// <param name="diagnostics">The client diagnostics for exception creation in case of failure.</param>
/// <param name="operationLocation">The address of the long-running operation. It can be obtained from the response headers upon starting the operation.</param>
/// <param name="targetModelId">Model ID in the target Form Recognizer resource.</param>
internal CopyModelOperation(ServiceRestClient serviceClient, ClientDiagnostics diagnostics, string operationLocation, string targetModelId)
internal CopyModelOperation(FormRecognizerRestClient serviceClient, ClientDiagnostics diagnostics, string operationLocation, string targetModelId)
{
_serviceClient = serviceClient;
_diagnostics = diagnostics;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace Azure.AI.FormRecognizer
public class FormRecognizerClient
{
/// <summary>Provides communication with the Form Recognizer Azure Cognitive Service through its REST API.</summary>
internal readonly ServiceRestClient ServiceClient;
internal readonly FormRecognizerRestClient ServiceClient;

/// <summary>Provides tools for exception creation in case of failure.</summary>
internal readonly ClientDiagnostics Diagnostics;
Expand Down Expand Up @@ -58,7 +58,7 @@ public FormRecognizerClient(Uri endpoint, AzureKeyCredential credential, FormRec

Diagnostics = new ClientDiagnostics(options);
var pipeline = HttpPipelineBuilder.Build(options, new AzureKeyCredentialPolicy(credential, Constants.AuthorizationHeader));
ServiceClient = new ServiceRestClient(Diagnostics, pipeline, endpoint.AbsoluteUri);
ServiceClient = new FormRecognizerRestClient(Diagnostics, pipeline, endpoint.AbsoluteUri);
}

/// <summary>
Expand Down Expand Up @@ -93,15 +93,15 @@ public FormRecognizerClient(Uri endpoint, TokenCredential credential, FormRecogn

Diagnostics = new ClientDiagnostics(options);
var pipeline = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(credential, Constants.DefaultCognitiveScope));
ServiceClient = new ServiceRestClient(Diagnostics, pipeline, endpoint.AbsoluteUri);
ServiceClient = new FormRecognizerRestClient(Diagnostics, pipeline, endpoint.AbsoluteUri);
}

/// <summary>
/// Initializes a new instance of the <see cref="FormRecognizerClient"/> class.
/// </summary>
/// <param name="diagnostics">Provides tools for exception creation in case of failure.</param>
/// <param name="serviceClient">Provides communication with the Form Recognizer Azure Cognitive Service through its REST API.</param>
internal FormRecognizerClient(ClientDiagnostics diagnostics, ServiceRestClient serviceClient)
internal FormRecognizerClient(ClientDiagnostics diagnostics, FormRecognizerRestClient serviceClient)
{
Diagnostics = diagnostics;
ServiceClient = serviceClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Azure.AI.FormRecognizer.Training
public class FormTrainingClient
{
/// <summary>Provides communication with the Form Recognizer Azure Cognitive Service through its REST API.</summary>
internal readonly ServiceRestClient ServiceClient;
internal readonly FormRecognizerRestClient ServiceClient;

/// <summary>Provides tools for exception creation in case of failure.</summary>
internal readonly ClientDiagnostics Diagnostics;
Expand Down Expand Up @@ -64,7 +64,7 @@ public FormTrainingClient(Uri endpoint, AzureKeyCredential credential, FormRecog

Diagnostics = new ClientDiagnostics(options);
HttpPipeline pipeline = HttpPipelineBuilder.Build(options, new AzureKeyCredentialPolicy(credential, Constants.AuthorizationHeader));
ServiceClient = new ServiceRestClient(Diagnostics, pipeline, endpoint.AbsoluteUri);
ServiceClient = new FormRecognizerRestClient(Diagnostics, pipeline, endpoint.AbsoluteUri);
}

/// <summary>
Expand Down Expand Up @@ -99,7 +99,7 @@ public FormTrainingClient(Uri endpoint, TokenCredential credential, FormRecogniz

Diagnostics = new ClientDiagnostics(options);
var pipeline = HttpPipelineBuilder.Build(options, new BearerTokenAuthenticationPolicy(credential, Constants.DefaultCognitiveScope));
ServiceClient = new ServiceRestClient(Diagnostics, pipeline, endpoint.AbsoluteUri);
ServiceClient = new FormRecognizerRestClient(Diagnostics, pipeline, endpoint.AbsoluteUri);
}

#region Training
Expand Down Expand Up @@ -130,7 +130,7 @@ public virtual TrainingOperation StartTraining(Uri trainingFilesUri, bool useTra
{
var trainRequest = new TrainRequest(trainingFilesUri.AbsoluteUri) { SourceFilter = trainingOptions.TrainingFileFilter, UseLabelFile = useTrainingLabels };

ResponseWithHeaders<ServiceTrainCustomModelAsyncHeaders> response = ServiceClient.TrainCustomModelAsync(trainRequest);
ResponseWithHeaders<FormRecognizerTrainCustomModelAsyncHeaders> response = ServiceClient.TrainCustomModelAsync(trainRequest);
return new TrainingOperation(response.Headers.Location, ServiceClient, Diagnostics);
}
catch (Exception e)
Expand Down Expand Up @@ -166,7 +166,7 @@ public virtual async Task<TrainingOperation> StartTrainingAsync(Uri trainingFile
{
var trainRequest = new TrainRequest(trainingFilesUri.AbsoluteUri) { SourceFilter = trainingOptions.TrainingFileFilter, UseLabelFile = useTrainingLabels };

ResponseWithHeaders<ServiceTrainCustomModelAsyncHeaders> response = await ServiceClient.TrainCustomModelAsyncAsync(trainRequest).ConfigureAwait(false);
ResponseWithHeaders<FormRecognizerTrainCustomModelAsyncHeaders> response = await ServiceClient.TrainCustomModelAsyncAsync(trainRequest).ConfigureAwait(false);
return new TrainingOperation(response.Headers.Location, ServiceClient, Diagnostics);
}
catch (Exception e)
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading