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

add support for appconfiguration #42019

Merged
merged 1 commit into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions eng/Packages.Data.props
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
<PackageReference Update="Azure.ResourceManager.Sql" Version="1.3.0-alpha.20240213.1" />
<PackageReference Update="Azure.ResourceManager.AppService" Version="1.1.0-alpha.20240213.1" />
<PackageReference Update="Azure.ResourceManager.Storage" Version="1.3.0-alpha.20240213.1" />
<PackageReference Update="Azure.ResourceManager.AppConfiguration" Version="1.3.0-alpha.20240215.2" />

<!-- Other approved packages -->
<PackageReference Update="Microsoft.Azure.Amqp" Version="2.6.4" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,18 @@ public abstract partial class Resource<T> : Azure.Provisioning.Resource where T
public void AssignParameter(System.Linq.Expressions.Expression<System.Func<T, object?>> propertySelector, Azure.Provisioning.Parameter parameter) { }
}
}
namespace Azure.Provisioning.AppConfiguration
{
public static partial class AppConfigurationExtensions
{
public static Azure.Provisioning.AppConfiguration.AppConfigurationStore AddAppConfigurationStore(this Azure.Provisioning.IConstruct construct, string name = "store") { throw null; }
}
public partial class AppConfigurationStore : Azure.Provisioning.Resource<Azure.ResourceManager.AppConfiguration.AppConfigurationStoreData>
{
public AppConfigurationStore(Azure.Provisioning.IConstruct scope, string name = "store", string version = "2023-03-01", Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?)) : base (default(Azure.Provisioning.IConstruct), default(Azure.Provisioning.Resource), default(string), default(Azure.Core.ResourceType), default(string), default(System.Func<string, Azure.ResourceManager.AppConfiguration.AppConfigurationStoreData>)) { }
protected override Azure.Provisioning.Resource? FindParentInScope(Azure.Provisioning.IConstruct scope) { throw null; }
}
}
namespace Azure.Provisioning.AppService
{
public partial class AppServicePlan : Azure.Provisioning.Resource<Azure.ResourceManager.AppService.AppServicePlanData>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,18 @@ public abstract partial class Resource<T> : Azure.Provisioning.Resource where T
public void AssignParameter(System.Linq.Expressions.Expression<System.Func<T, object?>> propertySelector, Azure.Provisioning.Parameter parameter) { }
}
}
namespace Azure.Provisioning.AppConfiguration
{
public static partial class AppConfigurationExtensions
{
public static Azure.Provisioning.AppConfiguration.AppConfigurationStore AddAppConfigurationStore(this Azure.Provisioning.IConstruct construct, string name = "store") { throw null; }
}
public partial class AppConfigurationStore : Azure.Provisioning.Resource<Azure.ResourceManager.AppConfiguration.AppConfigurationStoreData>
{
public AppConfigurationStore(Azure.Provisioning.IConstruct scope, string name = "store", string version = "2023-03-01", Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?)) : base (default(Azure.Provisioning.IConstruct), default(Azure.Provisioning.Resource), default(string), default(Azure.Core.ResourceType), default(string), default(System.Func<string, Azure.ResourceManager.AppConfiguration.AppConfigurationStoreData>)) { }
protected override Azure.Provisioning.Resource? FindParentInScope(Azure.Provisioning.IConstruct scope) { throw null; }
}
}
namespace Azure.Provisioning.AppService
{
public partial class AppServicePlan : Azure.Provisioning.Resource<Azure.ResourceManager.AppService.AppServicePlanData>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<PackageReference Include="Azure.ResourceManager.Sql" />
<PackageReference Include="Azure.ResourceManager.AppService" />
<PackageReference Include="Azure.ResourceManager.Storage" />
<PackageReference Include="Azure.ResourceManager.AppConfiguration" />
<PackageReference Include="System.ClientModel" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

namespace Azure.Provisioning.AppConfiguration
{
/// <summary>
/// Extension methods for <see cref="IConstruct"/>.
/// </summary>
public static class AppConfigurationExtensions
{
/// <summary>
/// Adds a <see cref="AppConfigurationStore"/> to the construct.
/// </summary>
/// <param name="construct">The construct.</param>
/// <param name="name">The name.</param>
/// <returns></returns>
public static AppConfigurationStore AddAppConfigurationStore(this IConstruct construct, string name = "store")
{
return new AppConfigurationStore(construct, name);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using Azure.Core;
using Azure.Provisioning.ResourceManager;
using Azure.ResourceManager.AppConfiguration;
using Azure.ResourceManager.AppConfiguration.Models;

namespace Azure.Provisioning.AppConfiguration
{
/// <summary>
/// Represents a KeyVault.
/// </summary>
public class AppConfigurationStore : Resource<AppConfigurationStoreData>
{
private const string ResourceTypeName = "Microsoft.AppConfiguration/configurationStores";

/// <summary>
/// Initializes a new instance of the <see cref="AppConfigurationStore"/> class.
/// </summary>
/// <param name="scope">The scope.</param>
/// <param name="name">The name.</param>
/// <param name="version">The version.</param>
/// <param name="location">The location.</param>
public AppConfigurationStore(IConstruct scope, string name = "store", string version = "2023-03-01", AzureLocation? location = default)
: base(scope, null, name, ResourceTypeName, version, (name) => ArmAppConfigurationModelFactory.AppConfigurationStoreData(
name: name,
resourceType: ResourceTypeName,
location: location ?? Environment.GetEnvironmentVariable("AZURE_LOCATION") ?? AzureLocation.WestUS,
skuName: "free"))
{
}

/// <inheritdoc/>
protected override Resource? FindParentInScope(IConstruct scope)
{
var result = base.FindParentInScope(scope);
if (result is null)
{
result = scope.GetOrAddResourceGroup();
}
return result;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
targetScope = subscription


resource resourceGroup_I6QNkoPsb 'Microsoft.Resources/resourceGroups@2023-07-01' = {
name: 'rg-TEST'
location: 'westus'
tags: {
azd-env-name: 'TEST'
}
}

resource appConfigurationStore_sgecYnln3 'Microsoft.AppConfiguration/configurationStores@2023-03-01' = {
scope: resourceGroup_I6QNkoPsb
name: 'store-TEST'
location: 'westus'
sku: {
name: 'free'
}
properties: {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using Azure.Provisioning.Sql;
using Azure.Provisioning.Resources;
using Azure.Provisioning.Storage;
using Azure.Provisioning.AppConfiguration;
using Azure.ResourceManager.Storage.Models;

namespace Azure.Provisioning.Tests
Expand Down Expand Up @@ -120,6 +121,14 @@ public void StorageBlobDropDown()
infra.Build(GetOutputPath());
}

[Test]
public void AppConfiguration()
{
var infra = new TestInfrastructure();
infra.AddAppConfigurationStore();
infra.Build(GetOutputPath());
}

private static string GetGitRoot()
{
ProcessStartInfo startInfo = new ProcessStartInfo
Expand Down