-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add operational insights resource (#42744)
* Add operational insights resource * fix test and cspell false positive * pr fb
- Loading branch information
1 parent
3928f09
commit 9463d82
Showing
39 changed files
with
142 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,6 +94,7 @@ | |
"nunit", | ||
"odata", | ||
"onco", | ||
"opinsights", | ||
"otel", | ||
"overridden", | ||
"parallelization", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
sdk/provisioning/Azure.Provisioning/src/operationalinsights/OperationalInsightsWorkspace.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using Azure.Core; | ||
using Azure.Provisioning.ResourceManager; | ||
using Azure.ResourceManager.OperationalInsights; | ||
using Azure.ResourceManager.OperationalInsights.Models; | ||
|
||
namespace Azure.Provisioning.OperationalInsights | ||
{ | ||
/// <summary> | ||
/// Represents an Operational Insights workspace. | ||
/// </summary> | ||
public class OperationalInsightsWorkspace : Resource<OperationalInsightsWorkspaceData> | ||
{ | ||
// https://learn.microsoft.com/azure/templates/microsoft.insights/2020-02-02/components?pivots=deployment-language-bicep | ||
private const string ResourceTypeName = "Microsoft.Insights/components"; | ||
// https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/RestOperations/WorkspacesRestOperations.cs#L36C42-L36C52 | ||
internal const string DefaultVersion = "2022-10-01"; | ||
|
||
private static OperationalInsightsWorkspaceData Empty(string name) => ArmOperationalInsightsModelFactory.OperationalInsightsWorkspaceData(); | ||
|
||
/// <summary> | ||
/// Creates a new instance of the <see cref="OperationalInsightsWorkspaceData"/> class. | ||
/// </summary> | ||
/// <param name="scope">The scope.</param> | ||
/// <param name="sku">The SKU.</param> | ||
/// <param name="parent">The parent.</param> | ||
/// <param name="name">The name.</param> | ||
/// <param name="version">The version.</param> | ||
/// <param name="location">The location</param> | ||
public OperationalInsightsWorkspace( | ||
IConstruct scope, | ||
OperationalInsightsWorkspaceSku? sku = default, | ||
ResourceGroup? parent = default, | ||
string name = "opinsights", | ||
string version = DefaultVersion, | ||
AzureLocation? location = default) | ||
: this(scope, parent, name, version, false, (name) => ArmOperationalInsightsModelFactory.OperationalInsightsWorkspaceData( | ||
name: name, | ||
location: location ?? Environment.GetEnvironmentVariable("AZURE_LOCATION") ?? AzureLocation.WestUS, | ||
sku: new OperationalInsightsWorkspaceSku(OperationalInsightsWorkspaceSkuName.PerGB2018))) | ||
{ | ||
AssignProperty(data => data.Name, GetAzureName(scope, name)); | ||
} | ||
|
||
private OperationalInsightsWorkspace( | ||
IConstruct scope, | ||
ResourceGroup? parent, | ||
string name, | ||
string version = DefaultVersion, | ||
bool isExisting = false, | ||
Func<string, OperationalInsightsWorkspaceData>? creator = null) | ||
: base(scope, parent, name, ResourceTypeName, version, creator ?? Empty, isExisting) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Creates a new instance of the <see cref="OperationalInsightsWorkspace"/> class referencing an existing instance. | ||
/// </summary> | ||
/// <param name="scope">The scope.</param> | ||
/// <param name="name">The resource name.</param> | ||
/// <param name="parent">The resource group.</param> | ||
/// <returns>The KeyVault instance.</returns> | ||
public static OperationalInsightsWorkspace FromExisting(IConstruct scope, string name, ResourceGroup? parent = null) | ||
=> new OperationalInsightsWorkspace(scope, parent: parent, name: name, isExisting: true); | ||
|
||
/// <inheritdoc/> | ||
protected override string GetAzureName(IConstruct scope, string resourceName) => GetGloballyUniqueName(resourceName); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.