Skip to content

Commit

Permalink
Merge branch 'main' into amariwest/pauseonstart-swagger
Browse files Browse the repository at this point in the history
  • Loading branch information
amariwest-msft committed Oct 12, 2023
2 parents f03117f + c86f34f commit a9ed81b
Show file tree
Hide file tree
Showing 23 changed files with 177 additions and 51 deletions.
2 changes: 1 addition & 1 deletion eng/Packages.Data.props
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
<PackageReference Update="Azure.Data.Tables" Version="12.8.0" />
<PackageReference Update="Azure.Messaging.EventHubs" Version="5.9.3" />
<PackageReference Update="Azure.Messaging.EventGrid" Version="4.17.0" />
<PackageReference Update="Azure.Messaging.ServiceBus" Version="7.16.0" />
<PackageReference Update="Azure.Messaging.ServiceBus" Version="7.16.2" />
<PackageReference Update="Azure.Messaging.WebPubSub" Version="1.2.0" />
<PackageReference Update="Azure.Monitor.OpenTelemetry.Exporter" Version="1.0.0" />
<PackageReference Update="Azure.Monitor.Query" Version="1.1.0" />
Expand Down
5 changes: 4 additions & 1 deletion eng/common/pipelines/templates/steps/sparse-checkout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ steps:
- checkout: none

- task: PowerShell@2
displayName: 'Sparse checkout repositories'
${{ if eq(length(parameters.Repositories), 1) }}:
displayName: 'Sparse checkout ${{ parameters.Repositories[0].Name }}'
${{ else }}:
displayName: 'Sparse checkout repositories'
inputs:
targetType: inline
# Define this inline, because of the chicken/egg problem with loading a script when nothing
Expand Down
7 changes: 0 additions & 7 deletions eng/common/scripts/TypeSpec-Project-Generate.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,6 @@ function NpmInstallForProject([string]$workingDirectory) {
Copy-Item -Path $emitterPackageLock -Destination "package-lock.json" -Force
}

$useAlphaNpmRegistry = (Get-Content $replacementPackageJson -Raw).Contains("-alpha.")

if($useAlphaNpmRegistry) {
Write-Host "Package.json contains '-alpha.' in the version, Creating .npmrc using public/azure-sdk-for-js-test-autorest feed."
"registry=https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js-test-autorest@local/npm/registry/ `n`nalways-auth=true" | Out-File '.npmrc'
}

if ($usingLockFile) {
Invoke-LoggedCommand "npm ci"
}
Expand Down
9 changes: 8 additions & 1 deletion sdk/core/Azure.Core/src/RequestFailedException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,14 @@ internal static bool TryExtractErrorContent(Response response, out ResponseError
return false;
}
// Try the ErrorResponse format and fallback to the ResponseError format.

#if NET6_0_OR_GREATER
error = System.Text.Json.JsonSerializer.Deserialize<ErrorResponse>(content, ResponseErrorSourceGenerationContext.Default.ErrorResponse)?.Error;
error ??= System.Text.Json.JsonSerializer.Deserialize<ResponseError>(content, ResponseErrorSourceGenerationContext.Default.ResponseError);
#else
error = System.Text.Json.JsonSerializer.Deserialize<ErrorResponse>(content)?.Error;
error ??= System.Text.Json.JsonSerializer.Deserialize<ResponseError>(content);
#endif
}
catch (Exception)
{
Expand All @@ -271,7 +277,8 @@ internal static bool TryExtractErrorContent(Response response, out ResponseError
return error != null;
}

private class ErrorResponse
// This class needs to be internal rather than private so that it can be used by the System.Text.Json source generator
internal class ErrorResponse
{
[System.Text.Json.Serialization.JsonPropertyName("error")]
public ResponseError? Error { get; set; }
Expand Down
3 changes: 2 additions & 1 deletion sdk/core/Azure.Core/src/ResponseError.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ internal ResponseError(string? code, string? message, string? target, JsonElemen
/// </summary>
internal IReadOnlyList<ResponseError> Details { get; }

private class Converter : JsonConverter<ResponseError?>
// This class needs to be internal rather than private so that it can be used by the System.Text.Json source generator
internal class Converter : JsonConverter<ResponseError?>
{
public override ResponseError? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
Expand Down
27 changes: 27 additions & 0 deletions sdk/core/Azure.Core/src/ResponseErrorSourceGenerationContext.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.Collections.Generic;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
using Azure.Core;

namespace Azure
{
#if NET6_0_OR_GREATER
[JsonSerializable(typeof(ResponseError))]
[JsonSerializable(typeof(RequestFailedException.ErrorResponse))]
[JsonSerializable(typeof(ResponseInnerError))]
[JsonSerializable(typeof(JsonElement))]
[JsonSerializable(typeof(JsonDocument))]
[JsonSerializable(typeof(JsonValueKind))]
[JsonSerializable(typeof(string))]
[JsonSerializable(typeof(bool))]
[JsonSerializable(typeof(List<ResponseError>))]
internal partial class ResponseErrorSourceGenerationContext : JsonSerializerContext
{
}
#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ public static partial class EventGridModelFactory
public static Azure.Messaging.EventGrid.SystemEvents.ResourceNotificationsHealthResourcesAnnotatedEventData ResourceNotificationsHealthResourcesAnnotatedEventData(Azure.Messaging.EventGrid.SystemEvents.ResourceNotificationsResourceUpdatedDetails resourceDetails = null, Azure.Messaging.EventGrid.SystemEvents.ResourceNotificationsOperationalDetails operationalDetails = null, string apiVersion = null) { throw null; }
public static Azure.Messaging.EventGrid.SystemEvents.ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData ResourceNotificationsHealthResourcesAvailabilityStatusChangedEventData(Azure.Messaging.EventGrid.SystemEvents.ResourceNotificationsResourceUpdatedDetails resourceDetails = null, Azure.Messaging.EventGrid.SystemEvents.ResourceNotificationsOperationalDetails operationalDetails = null, string apiVersion = null) { throw null; }
public static Azure.Messaging.EventGrid.SystemEvents.ResourceNotificationsOperationalDetails ResourceNotificationsOperationalDetails(System.DateTimeOffset? resourceEventTime = default(System.DateTimeOffset?)) { throw null; }
public static Azure.Messaging.EventGrid.SystemEvents.ResourceNotificationsResourceUpdatedDetails ResourceNotificationsResourceUpdatedDetails(string id = null, string name = null, string type = null, string location = null, string tags = null, System.Collections.Generic.IReadOnlyDictionary<string, object> properties = null) { throw null; }
public static Azure.Messaging.EventGrid.SystemEvents.ResourceNotificationsResourceUpdatedDetails ResourceNotificationsResourceUpdatedDetails(string id = null, string name = null, string resourceType = null, string location = null, string tags = null, System.Collections.Generic.IReadOnlyDictionary<string, object> properties = null) { throw null; }
public static Azure.Messaging.EventGrid.SystemEvents.ResourceNotificationsResourceUpdatedEventData ResourceNotificationsResourceUpdatedEventData(Azure.Messaging.EventGrid.SystemEvents.ResourceNotificationsResourceUpdatedDetails resourceDetails = null, Azure.Messaging.EventGrid.SystemEvents.ResourceNotificationsOperationalDetails operationalDetails = null, string apiVersion = null) { throw null; }
public static Azure.Messaging.EventGrid.SystemEvents.ResourceWriteCancelEventData ResourceWriteCancelEventData(string tenantId = null, string subscriptionId = null, string resourceGroup = null, string resourceProvider = null, string resourceUri = null, string operationName = null, string status = null, string authorization = null, string claims = null, string correlationId = null, string httpRequest = null) { throw null; }
public static Azure.Messaging.EventGrid.SystemEvents.ResourceWriteFailureEventData ResourceWriteFailureEventData(string tenantId = null, string subscriptionId = null, string resourceGroup = null, string resourceProvider = null, string resourceUri = null, string operationName = null, string status = null, string authorization = null, string claims = null, string correlationId = null, string httpRequest = null) { throw null; }
Expand Down Expand Up @@ -2757,8 +2757,8 @@ internal ResourceNotificationsResourceUpdatedDetails() { }
public string Location { get { throw null; } }
public string Name { get { throw null; } }
public System.Collections.Generic.IReadOnlyDictionary<string, object> Properties { get { throw null; } }
public string ResourceType { get { throw null; } }
public string Tags { get { throw null; } }
public string Type { get { throw null; } }
}
public partial class ResourceNotificationsResourceUpdatedEventData
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using Azure.Core;

namespace Azure.Messaging.EventGrid.SystemEvents
{
/// <summary> Describes the schema of the properties under resource info which are common across all ARN system topic events. </summary>
public partial class ResourceNotificationsResourceUpdatedDetails
{
/// <summary> the type of the resource for which the event is being emitted. </summary>
[CodeGenMember("Type")]
public string ResourceType { get; }
}
}

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.

14 changes: 14 additions & 0 deletions sdk/monitor/Azure.Monitor.Ingestion/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,20 @@ var credential = new DefaultAzureCredential();
var client = new LogsIngestionClient(endpoint, credential);
```

#### Configure client for Azure sovereign cloud

By default, `LogsIngestionClient` is configured to connect to the Azure public cloud. To connect to a sovereign cloud instead, set the `LogsIngestionClientOptions.Audience` property. For example:

```C# Snippet:CreateLogsIngestionClientWithOptions
var endpoint = new Uri("<data_collection_endpoint_uri>");
var credential = new DefaultAzureCredential();
var clientOptions = new LogsIngestionClientOptions
{
Audience = LogsIngestionAudience.AzureChina
};
var client = new LogsIngestionClient(endpoint, credential, clientOptions);
```

### Upload the logs

For examples of logs ingestion, see the [Examples](#examples) section.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ public void SetUpClient()
#endregion
}

public void SetUpClientWithOptions()
{
#region Snippet:CreateLogsIngestionClientWithOptions
var endpoint = new Uri("<data_collection_endpoint_uri>");
var credential = new DefaultAzureCredential();
var clientOptions = new LogsIngestionClientOptions
{
Audience = LogsIngestionAudience.AzureChina
};
var client = new LogsIngestionClient(endpoint, credential, clientOptions);
#endregion
}

public void LogData()
{
#region Snippet:UploadCustomLogs
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30309.148
# Visual Studio Version 17
VisualStudioVersion = 17.7.34009.444
MinimumVisualStudioVersion = 10.0.40219.1
Project("{E27BCECA-CDE9-4080-BEB2-27656FC3E93F}") = "Azure.ResourceManager.OperationalInsights", "src\Azure.ResourceManager.OperationalInsights.csproj", "{9EDA5235-BF40-4AE8-91D6-088B84432F7D}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.OperationalInsights", "src\Azure.ResourceManager.OperationalInsights.csproj", "{9EDA5235-BF40-4AE8-91D6-088B84432F7D}"
EndProject
Project("{E27BCECA-CDE9-4080-BEB2-27656FC3E93F}") = "Azure.ResourceManager.OperationalInsights.Tests", "tests\Azure.ResourceManager.OperationalInsights.Tests.csproj", "{0AD9B005-1722-4858-827C-A35CCD589E8C}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.OperationalInsights.Tests", "tests\Azure.ResourceManager.OperationalInsights.Tests.csproj", "{0AD9B005-1722-4858-827C-A35CCD589E8C}"
EndProject
Project("{E27BCECA-CDE9-4080-BEB2-27656FC3E93F}") = "Azure.ResourceManager.OperationalInsights.Samples", "samples\Azure.ResourceManager.OperationalInsights.Samples.csproj", "{B7B7D769-CC80-418D-9B0A-3C96BFDA8C4C}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.OperationalInsights.Samples", "samples\Azure.ResourceManager.OperationalInsights.Samples.csproj", "{B7B7D769-CC80-418D-9B0A-3C96BFDA8C4C}"
EndProject
Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8E77B375-E5E0-4A70-9CEB-0AA95E4E4FD3}
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Expand Down Expand Up @@ -49,5 +43,23 @@ Global
{0AD9B005-1722-4858-827C-A35CCD589E8C}.Release|x64.Build.0 = Release|Any CPU
{0AD9B005-1722-4858-827C-A35CCD589E8C}.Release|x86.ActiveCfg = Release|Any CPU
{0AD9B005-1722-4858-827C-A35CCD589E8C}.Release|x86.Build.0 = Release|Any CPU
{B7B7D769-CC80-418D-9B0A-3C96BFDA8C4C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B7B7D769-CC80-418D-9B0A-3C96BFDA8C4C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B7B7D769-CC80-418D-9B0A-3C96BFDA8C4C}.Debug|x64.ActiveCfg = Debug|Any CPU
{B7B7D769-CC80-418D-9B0A-3C96BFDA8C4C}.Debug|x64.Build.0 = Debug|Any CPU
{B7B7D769-CC80-418D-9B0A-3C96BFDA8C4C}.Debug|x86.ActiveCfg = Debug|Any CPU
{B7B7D769-CC80-418D-9B0A-3C96BFDA8C4C}.Debug|x86.Build.0 = Debug|Any CPU
{B7B7D769-CC80-418D-9B0A-3C96BFDA8C4C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B7B7D769-CC80-418D-9B0A-3C96BFDA8C4C}.Release|Any CPU.Build.0 = Release|Any CPU
{B7B7D769-CC80-418D-9B0A-3C96BFDA8C4C}.Release|x64.ActiveCfg = Release|Any CPU
{B7B7D769-CC80-418D-9B0A-3C96BFDA8C4C}.Release|x64.Build.0 = Release|Any CPU
{B7B7D769-CC80-418D-9B0A-3C96BFDA8C4C}.Release|x86.ActiveCfg = Release|Any CPU
{B7B7D769-CC80-418D-9B0A-3C96BFDA8C4C}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8E77B375-E5E0-4A70-9CEB-0AA95E4E4FD3}
EndGlobalSection
EndGlobal
Loading

0 comments on commit a9ed81b

Please sign in to comment.