diff --git a/eng/Packages.Data.props b/eng/Packages.Data.props index 4491b8154f0a4..1cd888fc1213c 100644 --- a/eng/Packages.Data.props +++ b/eng/Packages.Data.props @@ -133,6 +133,7 @@ + diff --git a/sdk/provisioning/Azure.Provisioning/api/Azure.Provisioning.net6.0.cs b/sdk/provisioning/Azure.Provisioning/api/Azure.Provisioning.net6.0.cs index 5d3e1fc5a7d41..c73767f249eea 100644 --- a/sdk/provisioning/Azure.Provisioning/api/Azure.Provisioning.net6.0.cs +++ b/sdk/provisioning/Azure.Provisioning/api/Azure.Provisioning.net6.0.cs @@ -123,8 +123,7 @@ public static partial class AppConfigurationExtensions } public partial class AppConfigurationStore : Azure.Provisioning.Resource { - 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)) { } - protected override Azure.Provisioning.Resource? FindParentInScope(Azure.Provisioning.IConstruct scope) { throw null; } + public AppConfigurationStore(Azure.Provisioning.IConstruct scope, Azure.Provisioning.ResourceManager.ResourceGroup? parent = null, 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)) { } public static Azure.Provisioning.AppConfiguration.AppConfigurationStore FromExisting(Azure.Provisioning.IConstruct scope, string name, Azure.Provisioning.ResourceManager.ResourceGroup? parent = null) { throw null; } } } @@ -133,7 +132,6 @@ namespace Azure.Provisioning.AppService public partial class AppServicePlan : Azure.Provisioning.Resource { public AppServicePlan(Azure.Provisioning.IConstruct scope, string name, string version = "2021-02-01", Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), Azure.Provisioning.ResourceManager.ResourceGroup? parent = null) : base (default(Azure.Provisioning.IConstruct), default(Azure.Provisioning.Resource), default(string), default(Azure.Core.ResourceType), default(string), default(System.Func)) { } - protected override Azure.Provisioning.Resource? FindParentInScope(Azure.Provisioning.IConstruct scope) { throw null; } public static Azure.Provisioning.AppService.AppServicePlan FromExisting(Azure.Provisioning.IConstruct scope, string name, Azure.Provisioning.ResourceManager.ResourceGroup? parent = null) { throw null; } } public static partial class AppServicesExtensions @@ -146,7 +144,6 @@ public partial class WebSite : Azure.Provisioning.Resource @@ -185,6 +182,7 @@ public partial class RoleAssignment : Azure.Provisioning.Resource + { + public CognitiveServicesAccount(Azure.Provisioning.IConstruct scope, string? kind = null, Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesSku? sku = null, Azure.Provisioning.ResourceManager.ResourceGroup? parent = null, string name = "cs", string version = "2023-05-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)) { } + public static Azure.Provisioning.CognitiveServices.CognitiveServicesAccount FromExisting(Azure.Provisioning.IConstruct scope, string name, Azure.Provisioning.ResourceManager.ResourceGroup? parent = null) { throw null; } + } + public partial class CognitiveServicesAccountDeployment : Azure.Provisioning.Resource + { + public CognitiveServicesAccountDeployment(Azure.Provisioning.IConstruct scope, Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesAccountDeploymentModel model, Azure.Provisioning.CognitiveServices.CognitiveServicesAccount? parent = null, Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesSku? sku = null, string name = "cs", string version = "2023-05-01") : base (default(Azure.Provisioning.IConstruct), default(Azure.Provisioning.Resource), default(string), default(Azure.Core.ResourceType), default(string), default(System.Func)) { } + protected override Azure.Provisioning.Resource? FindParentInScope(Azure.Provisioning.IConstruct scope) { throw null; } + public static Azure.Provisioning.CognitiveServices.CognitiveServicesAccountDeployment FromExisting(Azure.Provisioning.IConstruct scope, string name, Azure.Provisioning.CognitiveServices.CognitiveServicesAccount parent) { throw null; } + } +} namespace Azure.Provisioning.CosmosDB { public partial class CosmosDBAccount : Azure.Provisioning.Resource { public CosmosDBAccount(Azure.Provisioning.IConstruct scope, Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountKind? kind = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountKind?), Azure.ResourceManager.CosmosDB.Models.ConsistencyPolicy? consistencyPolicy = null, Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountOfferType? accountOfferType = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountOfferType?), System.Collections.Generic.IEnumerable? accountLocations = null, Azure.Provisioning.ResourceManager.ResourceGroup? parent = null, string name = "cosmosDB", string version = "2023-04-15", 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)) { } - protected override Azure.Provisioning.Resource? FindParentInScope(Azure.Provisioning.IConstruct scope) { throw null; } public static Azure.Provisioning.CosmosDB.CosmosDBAccount FromExisting(Azure.Provisioning.IConstruct scope, string name, Azure.Provisioning.ResourceManager.ResourceGroup? parent = null) { throw null; } protected override string GetAzureName(Azure.Provisioning.IConstruct scope, string resourceName) { throw null; } public Azure.Provisioning.CosmosDB.CosmosDBAccountConnectionString GetConnectionString(Azure.Provisioning.CosmosDB.CosmosDBKey? key = default(Azure.Provisioning.CosmosDB.CosmosDBKey?)) { throw null; } @@ -233,6 +244,7 @@ internal CosmosDBAccountConnectionString() : base (default(string)) { } public partial class CosmosDBSqlDatabase : Azure.Provisioning.Resource { public CosmosDBSqlDatabase(Azure.Provisioning.IConstruct scope, Azure.Provisioning.CosmosDB.CosmosDBAccount? parent = null, Azure.ResourceManager.CosmosDB.Models.ExtendedCosmosDBSqlDatabaseResourceInfo? databaseResourceInfo = null, Azure.ResourceManager.CosmosDB.Models.CosmosDBSqlDatabasePropertiesConfig? propertiesConfig = null, string name = "db", string version = "2022-05-15", 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)) { } + protected override Azure.Provisioning.Resource? FindParentInScope(Azure.Provisioning.IConstruct scope) { throw null; } public static Azure.Provisioning.CosmosDB.CosmosDBSqlDatabase FromExisting(Azure.Provisioning.IConstruct scope, string name, Azure.Provisioning.CosmosDB.CosmosDBAccount parent) { throw null; } } } @@ -242,7 +254,6 @@ public partial class KeyVault : Azure.Provisioning.Resource)) { } public void AddAccessPolicy(Azure.Provisioning.Output output) { } - protected override Azure.Provisioning.Resource? FindParentInScope(Azure.Provisioning.IConstruct scope) { throw null; } public static Azure.Provisioning.KeyVaults.KeyVault FromExisting(Azure.Provisioning.IConstruct scope, string name, Azure.Provisioning.ResourceManager.ResourceGroup? parent = null) { throw null; } protected override string GetAzureName(Azure.Provisioning.IConstruct scope, string resourceName) { throw null; } } @@ -268,7 +279,6 @@ internal PostgreSqlConnectionString() : base (default(string)) { } public partial class PostgreSqlFlexibleServer : Azure.Provisioning.Resource { public PostgreSqlFlexibleServer(Azure.Provisioning.IConstruct scope, Azure.Provisioning.Parameter administratorLogin, Azure.Provisioning.Parameter administratorPassword, Azure.ResourceManager.PostgreSql.FlexibleServers.Models.PostgreSqlFlexibleServerSku? sku = null, Azure.ResourceManager.PostgreSql.FlexibleServers.Models.PostgreSqlFlexibleServerVersion? serverVersion = default(Azure.ResourceManager.PostgreSql.FlexibleServers.Models.PostgreSqlFlexibleServerVersion?), Azure.ResourceManager.PostgreSql.FlexibleServers.Models.PostgreSqlFlexibleServerHighAvailability? highAvailability = null, Azure.ResourceManager.PostgreSql.FlexibleServers.Models.PostgreSqlFlexibleServerStorage? storage = null, Azure.ResourceManager.PostgreSql.FlexibleServers.Models.PostgreSqlFlexibleServerDataEncryption? encryption = null, Azure.ResourceManager.PostgreSql.FlexibleServers.Models.PostgreSqlFlexibleServerBackupProperties? backup = null, Azure.ResourceManager.PostgreSql.FlexibleServers.Models.PostgreSqlFlexibleServerNetwork? network = null, string? availabilityZone = null, Azure.Provisioning.ResourceManager.ResourceGroup? parent = null, string name = "postgres", string version = "2020-06-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)) { } - protected override Azure.Provisioning.Resource? FindParentInScope(Azure.Provisioning.IConstruct scope) { throw null; } public static Azure.Provisioning.PostgreSql.PostgreSqlFlexibleServer FromExisting(Azure.Provisioning.IConstruct scope, string name, Azure.Provisioning.ResourceManager.ResourceGroup? parent = null) { throw null; } protected override string GetAzureName(Azure.Provisioning.IConstruct scope, string resourceName) { throw null; } public Azure.Provisioning.PostgreSql.PostgreSqlConnectionString GetConnectionString(Azure.Provisioning.Parameter administratorLogin, Azure.Provisioning.Parameter administratorPassword) { throw null; } @@ -279,7 +289,6 @@ namespace Azure.Provisioning.Redis public partial class RedisCache : Azure.Provisioning.Resource { public RedisCache(Azure.Provisioning.IConstruct scope, Azure.ResourceManager.Redis.Models.RedisSku? sku = null, Azure.Provisioning.ResourceManager.ResourceGroup? parent = null, string name = "redis", 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)) { } - protected override Azure.Provisioning.Resource? FindParentInScope(Azure.Provisioning.IConstruct scope) { throw null; } public static Azure.Provisioning.Redis.RedisCache FromExisting(Azure.Provisioning.IConstruct scope, string name, Azure.Provisioning.ResourceManager.ResourceGroup? parent = null) { throw null; } protected override string GetAzureName(Azure.Provisioning.IConstruct scope, string resourceName) { throw null; } public Azure.Provisioning.Redis.RedisCacheConnectionString GetConnectionString(bool useSecondary = false) { throw null; } @@ -346,7 +355,6 @@ public partial class SqlFirewallRule : Azure.Provisioning.Resource { public SqlServer(Azure.Provisioning.IConstruct scope, string name, Azure.Provisioning.ResourceManager.ResourceGroup? parent = null, Azure.Provisioning.Parameter? adminLogin = default(Azure.Provisioning.Parameter?), Azure.Provisioning.Parameter? adminPassword = default(Azure.Provisioning.Parameter?), Azure.Provisioning.Sql.SqlServerAdministrator? administrator = default(Azure.Provisioning.Sql.SqlServerAdministrator?), string version = "2022-08-01-preview", 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)) { } - protected override Azure.Provisioning.Resource? FindParentInScope(Azure.Provisioning.IConstruct scope) { throw null; } public static Azure.Provisioning.Sql.SqlServer FromExisting(Azure.Provisioning.IConstruct scope, string name, Azure.Provisioning.ResourceManager.ResourceGroup? parent = null) { throw null; } protected override string GetAzureName(Azure.Provisioning.IConstruct scope, string resourceName) { throw null; } } @@ -369,7 +377,6 @@ public partial class BlobService : Azure.Provisioning.Resource { public StorageAccount(Azure.Provisioning.IConstruct scope, Azure.ResourceManager.Storage.Models.StorageKind kind, Azure.ResourceManager.Storage.Models.StorageSkuName sku, Azure.Provisioning.ResourceManager.ResourceGroup? parent = null, string name = "sa") : base (default(Azure.Provisioning.IConstruct), default(Azure.Provisioning.Resource), default(string), default(Azure.Core.ResourceType), default(string), default(System.Func)) { } - protected override Azure.Provisioning.Resource? FindParentInScope(Azure.Provisioning.IConstruct scope) { throw null; } public static Azure.Provisioning.Storage.StorageAccount FromExisting(Azure.Provisioning.IConstruct scope, string name, Azure.Provisioning.ResourceManager.ResourceGroup? parent = null) { throw null; } protected override string GetAzureName(Azure.Provisioning.IConstruct scope, string resourceName) { throw null; } } diff --git a/sdk/provisioning/Azure.Provisioning/api/Azure.Provisioning.netstandard2.0.cs b/sdk/provisioning/Azure.Provisioning/api/Azure.Provisioning.netstandard2.0.cs index 5d3e1fc5a7d41..c73767f249eea 100644 --- a/sdk/provisioning/Azure.Provisioning/api/Azure.Provisioning.netstandard2.0.cs +++ b/sdk/provisioning/Azure.Provisioning/api/Azure.Provisioning.netstandard2.0.cs @@ -123,8 +123,7 @@ public static partial class AppConfigurationExtensions } public partial class AppConfigurationStore : Azure.Provisioning.Resource { - 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)) { } - protected override Azure.Provisioning.Resource? FindParentInScope(Azure.Provisioning.IConstruct scope) { throw null; } + public AppConfigurationStore(Azure.Provisioning.IConstruct scope, Azure.Provisioning.ResourceManager.ResourceGroup? parent = null, 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)) { } public static Azure.Provisioning.AppConfiguration.AppConfigurationStore FromExisting(Azure.Provisioning.IConstruct scope, string name, Azure.Provisioning.ResourceManager.ResourceGroup? parent = null) { throw null; } } } @@ -133,7 +132,6 @@ namespace Azure.Provisioning.AppService public partial class AppServicePlan : Azure.Provisioning.Resource { public AppServicePlan(Azure.Provisioning.IConstruct scope, string name, string version = "2021-02-01", Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), Azure.Provisioning.ResourceManager.ResourceGroup? parent = null) : base (default(Azure.Provisioning.IConstruct), default(Azure.Provisioning.Resource), default(string), default(Azure.Core.ResourceType), default(string), default(System.Func)) { } - protected override Azure.Provisioning.Resource? FindParentInScope(Azure.Provisioning.IConstruct scope) { throw null; } public static Azure.Provisioning.AppService.AppServicePlan FromExisting(Azure.Provisioning.IConstruct scope, string name, Azure.Provisioning.ResourceManager.ResourceGroup? parent = null) { throw null; } } public static partial class AppServicesExtensions @@ -146,7 +144,6 @@ public partial class WebSite : Azure.Provisioning.Resource @@ -185,6 +182,7 @@ public partial class RoleAssignment : Azure.Provisioning.Resource + { + public CognitiveServicesAccount(Azure.Provisioning.IConstruct scope, string? kind = null, Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesSku? sku = null, Azure.Provisioning.ResourceManager.ResourceGroup? parent = null, string name = "cs", string version = "2023-05-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)) { } + public static Azure.Provisioning.CognitiveServices.CognitiveServicesAccount FromExisting(Azure.Provisioning.IConstruct scope, string name, Azure.Provisioning.ResourceManager.ResourceGroup? parent = null) { throw null; } + } + public partial class CognitiveServicesAccountDeployment : Azure.Provisioning.Resource + { + public CognitiveServicesAccountDeployment(Azure.Provisioning.IConstruct scope, Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesAccountDeploymentModel model, Azure.Provisioning.CognitiveServices.CognitiveServicesAccount? parent = null, Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesSku? sku = null, string name = "cs", string version = "2023-05-01") : base (default(Azure.Provisioning.IConstruct), default(Azure.Provisioning.Resource), default(string), default(Azure.Core.ResourceType), default(string), default(System.Func)) { } + protected override Azure.Provisioning.Resource? FindParentInScope(Azure.Provisioning.IConstruct scope) { throw null; } + public static Azure.Provisioning.CognitiveServices.CognitiveServicesAccountDeployment FromExisting(Azure.Provisioning.IConstruct scope, string name, Azure.Provisioning.CognitiveServices.CognitiveServicesAccount parent) { throw null; } + } +} namespace Azure.Provisioning.CosmosDB { public partial class CosmosDBAccount : Azure.Provisioning.Resource { public CosmosDBAccount(Azure.Provisioning.IConstruct scope, Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountKind? kind = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountKind?), Azure.ResourceManager.CosmosDB.Models.ConsistencyPolicy? consistencyPolicy = null, Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountOfferType? accountOfferType = default(Azure.ResourceManager.CosmosDB.Models.CosmosDBAccountOfferType?), System.Collections.Generic.IEnumerable? accountLocations = null, Azure.Provisioning.ResourceManager.ResourceGroup? parent = null, string name = "cosmosDB", string version = "2023-04-15", 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)) { } - protected override Azure.Provisioning.Resource? FindParentInScope(Azure.Provisioning.IConstruct scope) { throw null; } public static Azure.Provisioning.CosmosDB.CosmosDBAccount FromExisting(Azure.Provisioning.IConstruct scope, string name, Azure.Provisioning.ResourceManager.ResourceGroup? parent = null) { throw null; } protected override string GetAzureName(Azure.Provisioning.IConstruct scope, string resourceName) { throw null; } public Azure.Provisioning.CosmosDB.CosmosDBAccountConnectionString GetConnectionString(Azure.Provisioning.CosmosDB.CosmosDBKey? key = default(Azure.Provisioning.CosmosDB.CosmosDBKey?)) { throw null; } @@ -233,6 +244,7 @@ internal CosmosDBAccountConnectionString() : base (default(string)) { } public partial class CosmosDBSqlDatabase : Azure.Provisioning.Resource { public CosmosDBSqlDatabase(Azure.Provisioning.IConstruct scope, Azure.Provisioning.CosmosDB.CosmosDBAccount? parent = null, Azure.ResourceManager.CosmosDB.Models.ExtendedCosmosDBSqlDatabaseResourceInfo? databaseResourceInfo = null, Azure.ResourceManager.CosmosDB.Models.CosmosDBSqlDatabasePropertiesConfig? propertiesConfig = null, string name = "db", string version = "2022-05-15", 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)) { } + protected override Azure.Provisioning.Resource? FindParentInScope(Azure.Provisioning.IConstruct scope) { throw null; } public static Azure.Provisioning.CosmosDB.CosmosDBSqlDatabase FromExisting(Azure.Provisioning.IConstruct scope, string name, Azure.Provisioning.CosmosDB.CosmosDBAccount parent) { throw null; } } } @@ -242,7 +254,6 @@ public partial class KeyVault : Azure.Provisioning.Resource)) { } public void AddAccessPolicy(Azure.Provisioning.Output output) { } - protected override Azure.Provisioning.Resource? FindParentInScope(Azure.Provisioning.IConstruct scope) { throw null; } public static Azure.Provisioning.KeyVaults.KeyVault FromExisting(Azure.Provisioning.IConstruct scope, string name, Azure.Provisioning.ResourceManager.ResourceGroup? parent = null) { throw null; } protected override string GetAzureName(Azure.Provisioning.IConstruct scope, string resourceName) { throw null; } } @@ -268,7 +279,6 @@ internal PostgreSqlConnectionString() : base (default(string)) { } public partial class PostgreSqlFlexibleServer : Azure.Provisioning.Resource { public PostgreSqlFlexibleServer(Azure.Provisioning.IConstruct scope, Azure.Provisioning.Parameter administratorLogin, Azure.Provisioning.Parameter administratorPassword, Azure.ResourceManager.PostgreSql.FlexibleServers.Models.PostgreSqlFlexibleServerSku? sku = null, Azure.ResourceManager.PostgreSql.FlexibleServers.Models.PostgreSqlFlexibleServerVersion? serverVersion = default(Azure.ResourceManager.PostgreSql.FlexibleServers.Models.PostgreSqlFlexibleServerVersion?), Azure.ResourceManager.PostgreSql.FlexibleServers.Models.PostgreSqlFlexibleServerHighAvailability? highAvailability = null, Azure.ResourceManager.PostgreSql.FlexibleServers.Models.PostgreSqlFlexibleServerStorage? storage = null, Azure.ResourceManager.PostgreSql.FlexibleServers.Models.PostgreSqlFlexibleServerDataEncryption? encryption = null, Azure.ResourceManager.PostgreSql.FlexibleServers.Models.PostgreSqlFlexibleServerBackupProperties? backup = null, Azure.ResourceManager.PostgreSql.FlexibleServers.Models.PostgreSqlFlexibleServerNetwork? network = null, string? availabilityZone = null, Azure.Provisioning.ResourceManager.ResourceGroup? parent = null, string name = "postgres", string version = "2020-06-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)) { } - protected override Azure.Provisioning.Resource? FindParentInScope(Azure.Provisioning.IConstruct scope) { throw null; } public static Azure.Provisioning.PostgreSql.PostgreSqlFlexibleServer FromExisting(Azure.Provisioning.IConstruct scope, string name, Azure.Provisioning.ResourceManager.ResourceGroup? parent = null) { throw null; } protected override string GetAzureName(Azure.Provisioning.IConstruct scope, string resourceName) { throw null; } public Azure.Provisioning.PostgreSql.PostgreSqlConnectionString GetConnectionString(Azure.Provisioning.Parameter administratorLogin, Azure.Provisioning.Parameter administratorPassword) { throw null; } @@ -279,7 +289,6 @@ namespace Azure.Provisioning.Redis public partial class RedisCache : Azure.Provisioning.Resource { public RedisCache(Azure.Provisioning.IConstruct scope, Azure.ResourceManager.Redis.Models.RedisSku? sku = null, Azure.Provisioning.ResourceManager.ResourceGroup? parent = null, string name = "redis", 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)) { } - protected override Azure.Provisioning.Resource? FindParentInScope(Azure.Provisioning.IConstruct scope) { throw null; } public static Azure.Provisioning.Redis.RedisCache FromExisting(Azure.Provisioning.IConstruct scope, string name, Azure.Provisioning.ResourceManager.ResourceGroup? parent = null) { throw null; } protected override string GetAzureName(Azure.Provisioning.IConstruct scope, string resourceName) { throw null; } public Azure.Provisioning.Redis.RedisCacheConnectionString GetConnectionString(bool useSecondary = false) { throw null; } @@ -346,7 +355,6 @@ public partial class SqlFirewallRule : Azure.Provisioning.Resource { public SqlServer(Azure.Provisioning.IConstruct scope, string name, Azure.Provisioning.ResourceManager.ResourceGroup? parent = null, Azure.Provisioning.Parameter? adminLogin = default(Azure.Provisioning.Parameter?), Azure.Provisioning.Parameter? adminPassword = default(Azure.Provisioning.Parameter?), Azure.Provisioning.Sql.SqlServerAdministrator? administrator = default(Azure.Provisioning.Sql.SqlServerAdministrator?), string version = "2022-08-01-preview", 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)) { } - protected override Azure.Provisioning.Resource? FindParentInScope(Azure.Provisioning.IConstruct scope) { throw null; } public static Azure.Provisioning.Sql.SqlServer FromExisting(Azure.Provisioning.IConstruct scope, string name, Azure.Provisioning.ResourceManager.ResourceGroup? parent = null) { throw null; } protected override string GetAzureName(Azure.Provisioning.IConstruct scope, string resourceName) { throw null; } } @@ -369,7 +377,6 @@ public partial class BlobService : Azure.Provisioning.Resource { public StorageAccount(Azure.Provisioning.IConstruct scope, Azure.ResourceManager.Storage.Models.StorageKind kind, Azure.ResourceManager.Storage.Models.StorageSkuName sku, Azure.Provisioning.ResourceManager.ResourceGroup? parent = null, string name = "sa") : base (default(Azure.Provisioning.IConstruct), default(Azure.Provisioning.Resource), default(string), default(Azure.Core.ResourceType), default(string), default(System.Func)) { } - protected override Azure.Provisioning.Resource? FindParentInScope(Azure.Provisioning.IConstruct scope) { throw null; } public static Azure.Provisioning.Storage.StorageAccount FromExisting(Azure.Provisioning.IConstruct scope, string name, Azure.Provisioning.ResourceManager.ResourceGroup? parent = null) { throw null; } protected override string GetAzureName(Azure.Provisioning.IConstruct scope, string resourceName) { throw null; } } diff --git a/sdk/provisioning/Azure.Provisioning/src/Azure.Provisioning.csproj b/sdk/provisioning/Azure.Provisioning/src/Azure.Provisioning.csproj index 15a51965bfca6..2cff349cfcb0c 100644 --- a/sdk/provisioning/Azure.Provisioning/src/Azure.Provisioning.csproj +++ b/sdk/provisioning/Azure.Provisioning/src/Azure.Provisioning.csproj @@ -20,6 +20,7 @@ + diff --git a/sdk/provisioning/Azure.Provisioning/src/Resource.cs b/sdk/provisioning/Azure.Provisioning/src/Resource.cs index 51b28c7361492..d753de4d29b19 100644 --- a/sdk/provisioning/Azure.Provisioning/src/Resource.cs +++ b/sdk/provisioning/Azure.Provisioning/src/Resource.cs @@ -159,7 +159,22 @@ protected string GetGloballyUniqueName(string resourceName) /// The parent . protected virtual Resource? FindParentInScope(IConstruct scope) { - return scope is Resource resource ? resource : null; + if (this is Tenant) + { + return null; + } + + if (this is Subscription) + { + return scope.Root; + } + + if (Parent == null) + { + return this is ResourceGroup ? scope.GetOrCreateSubscription() : scope.GetOrAddResourceGroup(); + } + + return Parent; } /// diff --git a/sdk/provisioning/Azure.Provisioning/src/appconfiguration/AppConfigurationExtensions.cs b/sdk/provisioning/Azure.Provisioning/src/appconfiguration/AppConfigurationExtensions.cs index 13bcf6d79f0d0..6e767617e81e3 100644 --- a/sdk/provisioning/Azure.Provisioning/src/appconfiguration/AppConfigurationExtensions.cs +++ b/sdk/provisioning/Azure.Provisioning/src/appconfiguration/AppConfigurationExtensions.cs @@ -16,7 +16,7 @@ public static class AppConfigurationExtensions /// public static AppConfigurationStore AddAppConfigurationStore(this IConstruct construct, string name = "store") { - return new AppConfigurationStore(construct, name); + return new AppConfigurationStore(construct, name: name); } } } diff --git a/sdk/provisioning/Azure.Provisioning/src/appconfiguration/AppConfigurationStore.cs b/sdk/provisioning/Azure.Provisioning/src/appconfiguration/AppConfigurationStore.cs index 5e60a2843a91a..428e05c1a435e 100644 --- a/sdk/provisioning/Azure.Provisioning/src/appconfiguration/AppConfigurationStore.cs +++ b/sdk/provisioning/Azure.Provisioning/src/appconfiguration/AppConfigurationStore.cs @@ -21,11 +21,12 @@ public class AppConfigurationStore : Resource /// Initializes a new instance of the class. /// /// The scope. + /// The parent. /// The name. /// The version. /// The location. - public AppConfigurationStore(IConstruct scope, string name = "store", string version = "2023-03-01", AzureLocation? location = default) - : this(scope, name, version, location, null, false, (name) => ArmAppConfigurationModelFactory.AppConfigurationStoreData( + public AppConfigurationStore(IConstruct scope, ResourceGroup? parent = null, string name = "store", string version = "2023-03-01", AzureLocation? location = default) + : this(scope, parent, name, version, false, (name) => ArmAppConfigurationModelFactory.AppConfigurationStoreData( name: name, resourceType: ResourceTypeName, location: location ?? Environment.GetEnvironmentVariable("AZURE_LOCATION") ?? AzureLocation.WestUS, @@ -34,7 +35,7 @@ public AppConfigurationStore(IConstruct scope, string name = "store", string ver AddOutput(store => store.Endpoint, $"{Name}_endpoint"); } - private AppConfigurationStore(IConstruct scope, string name = "store", string version = "2023-03-01", AzureLocation? location = default, ResourceGroup? parent = null, bool isExisting = false, Func? creator = null) + private AppConfigurationStore(IConstruct scope, ResourceGroup? parent = null, string name = "store", string version = "2023-03-01", bool isExisting = false, Func? creator = null) : base(scope, parent, name, ResourceTypeName, version, creator ?? Empty, isExisting) { } @@ -47,17 +48,6 @@ private AppConfigurationStore(IConstruct scope, string name = "store", string ve /// The resource group. /// The KeyVault instance. public static AppConfigurationStore FromExisting(IConstruct scope, string name, ResourceGroup? parent = null) - => new AppConfigurationStore(scope, name, parent: parent, isExisting: true); - - /// - protected override Resource? FindParentInScope(IConstruct scope) - { - var result = base.FindParentInScope(scope); - if (result is null) - { - result = scope.GetOrAddResourceGroup(); - } - return result; - } + => new AppConfigurationStore(scope, parent, name, isExisting: true); } } diff --git a/sdk/provisioning/Azure.Provisioning/src/authorization/RoleDefinition.cs b/sdk/provisioning/Azure.Provisioning/src/authorization/RoleDefinition.cs index a08ce8ef8ae9b..a3f734aef0d63 100644 --- a/sdk/provisioning/Azure.Provisioning/src/authorization/RoleDefinition.cs +++ b/sdk/provisioning/Azure.Provisioning/src/authorization/RoleDefinition.cs @@ -38,6 +38,11 @@ public RoleDefinition(string value) /// public static RoleDefinition KeyVaultAdministrator { get; } = new RoleDefinition("00482a5a-887f-4fb3-b363-3b7fe8e74483"); + /// + /// Cognitive Services Open AI contributor role. + /// + public static RoleDefinition CognitiveServicesOpenAIContributor { get; } = new RoleDefinition("a001fd3d-188f-4b5d-821b-7da978bf7442"); + /// Converts a string to a . public static implicit operator RoleDefinition(string value) => new RoleDefinition(value); diff --git a/sdk/provisioning/Azure.Provisioning/src/cognitiveservices/CognitiveServicesAccount.cs b/sdk/provisioning/Azure.Provisioning/src/cognitiveservices/CognitiveServicesAccount.cs new file mode 100644 index 0000000000000..891cc4c11eaa0 --- /dev/null +++ b/sdk/provisioning/Azure.Provisioning/src/cognitiveservices/CognitiveServicesAccount.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using Azure.Core; +using Azure.Provisioning.ResourceManager; +using Azure.ResourceManager.CognitiveServices; +using Azure.ResourceManager.CognitiveServices.Models; + +namespace Azure.Provisioning.CognitiveServices +{ + /// + /// Represents a Cognitive Services account. + /// + public class CognitiveServicesAccount : Resource + { + private const string ResourceTypeName = "Microsoft.CognitiveServices/accounts"; + private static readonly Func Empty = (name) => ArmCognitiveServicesModelFactory.CognitiveServicesAccountData(); + + /// + /// Creates a new instance of the class. + /// + /// The scope. + /// The kind. + /// The sku. + /// The parent. + /// The name. + /// The version. + /// The location. + public CognitiveServicesAccount( + IConstruct scope, + string? kind = default, + CognitiveServicesSku? sku = default, + ResourceGroup? parent = default, + string name = "cs", + string version = "2023-05-01", + AzureLocation? location = default) + : this(scope, parent, name, version, false, (name) => + ArmCognitiveServicesModelFactory.CognitiveServicesAccountData( + name: name, + sku: sku ?? new CognitiveServicesSku("S0"), + location: location ?? Environment.GetEnvironmentVariable("AZURE_LOCATION") ?? AzureLocation.WestUS, + kind: kind ?? "OpenAI", + properties: new CognitiveServicesAccountProperties())) + { + } + + private CognitiveServicesAccount( + IConstruct scope, + ResourceGroup? parent = default, + string name = "cosmosDB", + string version = "2023-04-15", + bool isExisting = false, + Func? creator = null) + : base(scope, parent, name, ResourceTypeName, version, creator ?? Empty, isExisting) + { + } + + /// + /// Creates a new instance of the class referencing an existing instance. + /// + /// The scope. + /// The resource name. + /// The resource group. + /// The KeyVault instance. + public static CognitiveServicesAccount FromExisting(IConstruct scope, string name, ResourceGroup? parent = null) + => new CognitiveServicesAccount(scope, parent: parent, name: name, isExisting: true); + } +} diff --git a/sdk/provisioning/Azure.Provisioning/src/cognitiveservices/CognitiveServicesAccountDeployment.cs b/sdk/provisioning/Azure.Provisioning/src/cognitiveservices/CognitiveServicesAccountDeployment.cs new file mode 100644 index 0000000000000..d9fa1f62c5a05 --- /dev/null +++ b/sdk/provisioning/Azure.Provisioning/src/cognitiveservices/CognitiveServicesAccountDeployment.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using Azure.ResourceManager.CognitiveServices; +using Azure.ResourceManager.CognitiveServices.Models; + +namespace Azure.Provisioning.CognitiveServices +{ + /// + /// Cognitive Services account deployment. + /// + public class CognitiveServicesAccountDeployment : Resource + { + private const string ResourceTypeName = "Microsoft.CognitiveServices/accounts/deployments"; + private static readonly Func Empty = (name) => ArmCognitiveServicesModelFactory.CognitiveServicesAccountDeploymentData(); + + /// + /// Creates a new instance of the class. + /// + /// The scope. + /// The model. + /// The parent. + /// The sku. + /// The name. + /// The version. + public CognitiveServicesAccountDeployment( + IConstruct scope, + CognitiveServicesAccountDeploymentModel model, + CognitiveServicesAccount? parent = default, + CognitiveServicesSku? sku = default, + string name = "cs", + string version = "2023-05-01") + : this(scope, parent, name, version, false, (name) => + ArmCognitiveServicesModelFactory.CognitiveServicesAccountDeploymentData( + name: name, + // TODO why does the deployment also have a SKU + sku: sku ?? new CognitiveServicesSku("S0"), + properties: new CognitiveServicesAccountDeploymentProperties { Model = model })) + { + } + + private CognitiveServicesAccountDeployment( + IConstruct scope, + CognitiveServicesAccount? parent = default, + string name = "cosmosDB", + string version = "2023-04-15", + bool isExisting = false, + Func? creator = null) + : base(scope, parent, name, ResourceTypeName, version, creator ?? Empty, isExisting) + { + } + + /// + /// Creates a new instance of the class referencing an existing instance. + /// + /// The scope. + /// The resource name. + /// The parent. + /// The KeyVault instance. + public static CognitiveServicesAccountDeployment FromExisting(IConstruct scope, string name, CognitiveServicesAccount parent) + => new CognitiveServicesAccountDeployment(scope, parent: parent, name: name, isExisting: true); + + /// + protected override Resource? FindParentInScope(IConstruct scope) + { + return scope.GetSingleResource() ?? new CognitiveServicesAccount(scope); + } + } +} diff --git a/sdk/provisioning/Azure.Provisioning/src/cosmosdb/CosmosDBAccount.cs b/sdk/provisioning/Azure.Provisioning/src/cosmosdb/CosmosDBAccount.cs index 1a4ff8278c779..ec711183702e7 100644 --- a/sdk/provisioning/Azure.Provisioning/src/cosmosdb/CosmosDBAccount.cs +++ b/sdk/provisioning/Azure.Provisioning/src/cosmosdb/CosmosDBAccount.cs @@ -81,17 +81,6 @@ public static CosmosDBAccount FromExisting(IConstruct scope, string name, Resour public CosmosDBAccountConnectionString GetConnectionString(CosmosDBKey? key = default) => new CosmosDBAccountConnectionString(this, key ?? CosmosDBKey.PrimaryKey); - /// - protected override Resource? FindParentInScope(IConstruct scope) - { - var result = base.FindParentInScope(scope); - if (result is null) - { - result = scope.GetOrAddResourceGroup(); - } - return result; - } - /// protected override string GetAzureName(IConstruct scope, string resourceName) => GetGloballyUniqueName(resourceName); } diff --git a/sdk/provisioning/Azure.Provisioning/src/cosmosdb/CosmosDBSqlDatabase.cs b/sdk/provisioning/Azure.Provisioning/src/cosmosdb/CosmosDBSqlDatabase.cs index eecde6634c4d1..5f2ec120cbf1f 100644 --- a/sdk/provisioning/Azure.Provisioning/src/cosmosdb/CosmosDBSqlDatabase.cs +++ b/sdk/provisioning/Azure.Provisioning/src/cosmosdb/CosmosDBSqlDatabase.cs @@ -64,5 +64,11 @@ private CosmosDBSqlDatabase( /// The KeyVault instance. public static CosmosDBSqlDatabase FromExisting(IConstruct scope, string name, CosmosDBAccount parent) => new CosmosDBSqlDatabase(scope, parent: parent, name: name, isExisting: true); + + /// + protected override Resource? FindParentInScope(IConstruct scope) + { + return scope.GetSingleResource() ?? new CosmosDBAccount(scope); + } } } diff --git a/sdk/provisioning/Azure.Provisioning/src/keyvault/KeyVault.cs b/sdk/provisioning/Azure.Provisioning/src/keyvault/KeyVault.cs index 8f923e1525800..b283d2dc27067 100644 --- a/sdk/provisioning/Azure.Provisioning/src/keyvault/KeyVault.cs +++ b/sdk/provisioning/Azure.Provisioning/src/keyvault/KeyVault.cs @@ -37,7 +37,7 @@ public static KeyVault FromExisting(IConstruct scope, string name, ResourceGroup /// The location. /// public KeyVault(IConstruct scope, ResourceGroup? parent = default, string name = "kv", string version = "2023-02-01", AzureLocation? location = default) - : this(scope, parent, name, version, location, false, (name) => ArmKeyVaultModelFactory.KeyVaultData( + : this(scope, parent, name, version, false, (name) => ArmKeyVaultModelFactory.KeyVaultData( name: name, resourceType: ResourceTypeName, location: location ?? Environment.GetEnvironmentVariable("AZURE_LOCATION") ?? AzureLocation.WestUS, @@ -64,7 +64,7 @@ public KeyVault(IConstruct scope, ResourceGroup? parent = default, string name = } } - private KeyVault(IConstruct scope, ResourceGroup? parent = default, string name = "kv", string version = "2023-02-01", AzureLocation? location = default, bool isExisting = false, Func? creator = null) + private KeyVault(IConstruct scope, ResourceGroup? parent = default, string name = "kv", string version = "2023-02-01", bool isExisting = false, Func? creator = null) : base(scope, parent, name, ResourceTypeName, version, creator ?? Empty, isExisting: isExisting) { } @@ -78,17 +78,6 @@ public void AddAccessPolicy(Output output) _ = new KeyVaultAddAccessPolicy(Scope, new Parameter(output), this); } - /// - protected override Resource? FindParentInScope(IConstruct scope) - { - var result = base.FindParentInScope(scope); - if (result is null) - { - result = scope.GetOrAddResourceGroup(); - } - return result; - } - /// protected override string GetAzureName(IConstruct scope, string resourceName) => GetGloballyUniqueName(resourceName); } diff --git a/sdk/provisioning/Azure.Provisioning/src/keyvault/KeyVaultSecret.cs b/sdk/provisioning/Azure.Provisioning/src/keyvault/KeyVaultSecret.cs index bf0ef949c93b5..95e761b671c72 100644 --- a/sdk/provisioning/Azure.Provisioning/src/keyvault/KeyVaultSecret.cs +++ b/sdk/provisioning/Azure.Provisioning/src/keyvault/KeyVaultSecret.cs @@ -68,12 +68,7 @@ public static KeyVaultSecret FromExisting(IConstruct scope, string name, KeyVaul /// protected override Resource? FindParentInScope(IConstruct scope) { - var result = base.FindParentInScope(scope); - if (result is null) - { - result = scope.GetSingleResource() ?? new KeyVault(scope); - } - return result; + return scope.GetSingleResource() ?? new KeyVault(scope); } } } diff --git a/sdk/provisioning/Azure.Provisioning/src/postgresql/PostgreSqlFlexibleServer.cs b/sdk/provisioning/Azure.Provisioning/src/postgresql/PostgreSqlFlexibleServer.cs index 9916cee8efb6e..4f79b96a8c66d 100644 --- a/sdk/provisioning/Azure.Provisioning/src/postgresql/PostgreSqlFlexibleServer.cs +++ b/sdk/provisioning/Azure.Provisioning/src/postgresql/PostgreSqlFlexibleServer.cs @@ -52,7 +52,7 @@ public PostgreSqlFlexibleServer( string name = "postgres", string version = "2020-06-01", AzureLocation? location = default) - : this(scope, administratorLogin, administratorPassword, sku, highAvailability, storage, backup, network, availabilityZone, parent, name, version, location, false, (name) => ArmPostgreSqlFlexibleServersModelFactory.PostgreSqlFlexibleServerData( + : this(scope, parent, name, version, false, (name) => ArmPostgreSqlFlexibleServersModelFactory.PostgreSqlFlexibleServerData( name: name, // create new instances so the properties can be overriden by user if needed version: serverVersion ?? new PostgreSqlFlexibleServerVersion(), @@ -72,35 +72,15 @@ public PostgreSqlFlexibleServer( private PostgreSqlFlexibleServer( IConstruct scope, - Parameter administratorLogin = default, - Parameter administratorPassword = default, - PostgreSqlFlexibleServerSku? sku = default, - PostgreSqlFlexibleServerHighAvailability? highAvailability = default, - PostgreSqlFlexibleServerStorage? storage = default, - PostgreSqlFlexibleServerBackupProperties? backup = default, - PostgreSqlFlexibleServerNetwork? network = default, - string? availabilityZone = default, ResourceGroup? parent = default, string name = "postgres", string version = "2020-06-01", - AzureLocation? location = default, bool isExisting = false, Func? creator = null) : base(scope, parent, name, ResourceTypeName, version, creator ?? Empty, isExisting) { } - /// - protected override Resource? FindParentInScope(IConstruct scope) - { - var result = base.FindParentInScope(scope); - if (result is null) - { - result = scope.GetOrAddResourceGroup(); - } - return result; - } - /// /// Creates a new instance of the class referencing an existing instance. /// diff --git a/sdk/provisioning/Azure.Provisioning/src/redis/RedisCache.cs b/sdk/provisioning/Azure.Provisioning/src/redis/RedisCache.cs index d15fe4d13fa16..66b5df8bf97d2 100644 --- a/sdk/provisioning/Azure.Provisioning/src/redis/RedisCache.cs +++ b/sdk/provisioning/Azure.Provisioning/src/redis/RedisCache.cs @@ -26,7 +26,7 @@ public class RedisCache : Resource /// /// public RedisCache(IConstruct scope, RedisSku? sku = default, ResourceGroup? parent = default, string name = "redis", AzureLocation? location = default) - : this(scope, sku, parent, name, location, false, (name) => ArmRedisModelFactory.RedisData( + : this(scope, sku, parent, name, false, (name) => ArmRedisModelFactory.RedisData( name: name, location: location ?? Environment.GetEnvironmentVariable("AZURE_LOCATION") ?? AzureLocation.WestUS, enableNonSslPort: false, @@ -38,7 +38,7 @@ public RedisCache(IConstruct scope, RedisSku? sku = default, ResourceGroup? pare AssignProperty(data => data.Name, GetAzureName(scope, name)); } - private RedisCache(IConstruct scope, RedisSku? sku = default, ResourceGroup? parent = default, string name = "redis", AzureLocation? location = default, bool isExisting = false, Func? creator = null) + private RedisCache(IConstruct scope, RedisSku? sku = default, ResourceGroup? parent = default, string name = "redis", bool isExisting = false, Func? creator = null) : base(scope, parent, name, ResourceTypeName, "2020-06-01", creator ?? Empty, isExisting) { } @@ -49,17 +49,6 @@ private RedisCache(IConstruct scope, RedisSku? sku = default, ResourceGroup? par public RedisCacheConnectionString GetConnectionString(bool useSecondary = false) => new RedisCacheConnectionString(this, useSecondary); - /// - protected override Resource? FindParentInScope(IConstruct scope) - { - var result = base.FindParentInScope(scope); - if (result is null) - { - result = scope.GetOrAddResourceGroup(); - } - return result; - } - /// /// Creates a new instance of the class referencing an existing instance. /// diff --git a/sdk/provisioning/Azure.Provisioning/src/sqlmanagement/SqlDatabase.cs b/sdk/provisioning/Azure.Provisioning/src/sqlmanagement/SqlDatabase.cs index 738c65c3f5703..0f22d60433ec8 100644 --- a/sdk/provisioning/Azure.Provisioning/src/sqlmanagement/SqlDatabase.cs +++ b/sdk/provisioning/Azure.Provisioning/src/sqlmanagement/SqlDatabase.cs @@ -59,12 +59,7 @@ public static SqlDatabase FromExisting(IConstruct scope, string name, SqlServer /// protected override Resource? FindParentInScope(IConstruct scope) { - var result = base.FindParentInScope(scope); - if (result is null) - { - result = scope.GetSingleResource() ?? new SqlServer(scope, "sql"); - } - return result; + return scope.GetSingleResource() ?? new SqlServer(scope, "sql"); } } } diff --git a/sdk/provisioning/Azure.Provisioning/src/sqlmanagement/SqlFirewallRule.cs b/sdk/provisioning/Azure.Provisioning/src/sqlmanagement/SqlFirewallRule.cs index 349c3ccd16e10..5cc2822665c4f 100644 --- a/sdk/provisioning/Azure.Provisioning/src/sqlmanagement/SqlFirewallRule.cs +++ b/sdk/provisioning/Azure.Provisioning/src/sqlmanagement/SqlFirewallRule.cs @@ -50,12 +50,7 @@ public static SqlFirewallRule FromExisting(IConstruct scope, string name, SqlSer /// protected override Resource? FindParentInScope(IConstruct scope) { - var result = base.FindParentInScope(scope); - if (result is null) - { - result = scope.GetSingleResource() ?? new SqlServer(scope, "sql"); - } - return result; + return scope.GetSingleResource() ?? new SqlServer(scope, "sql"); } } } diff --git a/sdk/provisioning/Azure.Provisioning/src/sqlmanagement/SqlServer.cs b/sdk/provisioning/Azure.Provisioning/src/sqlmanagement/SqlServer.cs index ca5474067ef60..09d8377b55034 100644 --- a/sdk/provisioning/Azure.Provisioning/src/sqlmanagement/SqlServer.cs +++ b/sdk/provisioning/Azure.Provisioning/src/sqlmanagement/SqlServer.cs @@ -37,7 +37,7 @@ public SqlServer( SqlServerAdministrator? administrator = default, string version = "2022-08-01-preview", AzureLocation? location = default) - : this(scope, name, parent, adminLogin, adminPassword, administrator, version, location, false, (name) => ArmSqlModelFactory.SqlServerData( + : this(scope, name, parent, version, false, (name) => ArmSqlModelFactory.SqlServerData( name: name, location: location ?? Environment.GetEnvironmentVariable("AZURE_LOCATION") ?? AzureLocation.WestUS, resourceType: ResourceTypeName, @@ -71,11 +71,7 @@ private SqlServer( IConstruct scope, string name, ResourceGroup? parent = null, - Parameter? adminLogin = default, - Parameter? adminPassword = default, - SqlServerAdministrator? administrator = default, string version = "2022-08-01-preview", - AzureLocation? location = default, bool isExisting = false, Func? creator = null) : base(scope, parent, name, ResourceTypeName, version, creator ?? Empty, isExisting) @@ -92,17 +88,6 @@ private SqlServer( public static SqlServer FromExisting(IConstruct scope, string name, ResourceGroup? parent = null) => new SqlServer(scope, parent: parent, name: name, isExisting: true); - /// - protected override Resource? FindParentInScope(IConstruct scope) - { - var result = base.FindParentInScope(scope); - if (result is null) - { - result = scope.GetOrAddResourceGroup(); - } - return result; - } - /// protected override string GetAzureName(IConstruct scope, string resourceName) => GetGloballyUniqueName(resourceName); } diff --git a/sdk/provisioning/Azure.Provisioning/src/storage/BlobService.cs b/sdk/provisioning/Azure.Provisioning/src/storage/BlobService.cs index 21af29278494f..59c6a14f774d9 100644 --- a/sdk/provisioning/Azure.Provisioning/src/storage/BlobService.cs +++ b/sdk/provisioning/Azure.Provisioning/src/storage/BlobService.cs @@ -45,12 +45,7 @@ public static BlobService FromExisting(IConstruct scope, string name, StorageAcc /// protected override Resource? FindParentInScope(IConstruct scope) { - var result = base.FindParentInScope(scope); - if (result is null) - { - result = scope.GetSingleResource() ?? new StorageAccount(scope, StorageKind.BlockBlobStorage, StorageSkuName.PremiumLrs); - } - return result; + return scope.GetSingleResource() ?? new StorageAccount(scope, StorageKind.BlockBlobStorage, StorageSkuName.PremiumLrs); } } } diff --git a/sdk/provisioning/Azure.Provisioning/src/storage/StorageAccount.cs b/sdk/provisioning/Azure.Provisioning/src/storage/StorageAccount.cs index 7966ebbc2ef79..0f7260560f54a 100644 --- a/sdk/provisioning/Azure.Provisioning/src/storage/StorageAccount.cs +++ b/sdk/provisioning/Azure.Provisioning/src/storage/StorageAccount.cs @@ -26,7 +26,7 @@ public class StorageAccount : Resource /// The parent. /// The name. public StorageAccount(IConstruct scope, StorageKind kind, StorageSkuName sku, ResourceGroup? parent = null, string name = "sa") - : this(scope, kind, sku, parent, name, false, (name) => ArmStorageModelFactory.StorageAccountData( + : this(scope, parent, name, false, (name) => ArmStorageModelFactory.StorageAccountData( name: name, resourceType: ResourceTypeName, location: Environment.GetEnvironmentVariable("AZURE_LOCATION") ?? AzureLocation.WestUS, @@ -38,7 +38,7 @@ public StorageAccount(IConstruct scope, StorageKind kind, StorageSkuName sku, Re AssignProperty(data => data.Name, GetAzureName(scope, name)); } - private StorageAccount(IConstruct scope, StorageKind kind = default, StorageSkuName sku = default, ResourceGroup? parent = null, string name = "sa", bool isExisting = true, Func? creator = null) + private StorageAccount(IConstruct scope, ResourceGroup? parent = null, string name = "sa", bool isExisting = true, Func? creator = null) : base(scope, parent, name, ResourceTypeName, "2022-09-01", creator ?? Empty, isExisting) { } @@ -53,17 +53,6 @@ private StorageAccount(IConstruct scope, StorageKind kind = default, StorageSkuN public static StorageAccount FromExisting(IConstruct scope, string name, ResourceGroup? parent = null) => new StorageAccount(scope, parent: parent, name: name, isExisting: true); - /// - protected override Resource? FindParentInScope(IConstruct scope) - { - var result = base.FindParentInScope(scope); - if (result is null) - { - result = scope.GetOrAddResourceGroup(); - } - return result; - } - /// protected override string GetAzureName(IConstruct scope, string resourceName) => GetGloballyUniqueName(resourceName); } diff --git a/sdk/provisioning/Azure.Provisioning/src/websites/AppServicePlan.cs b/sdk/provisioning/Azure.Provisioning/src/websites/AppServicePlan.cs index 1045c0374e60e..5bb255a971474 100644 --- a/sdk/provisioning/Azure.Provisioning/src/websites/AppServicePlan.cs +++ b/sdk/provisioning/Azure.Provisioning/src/websites/AppServicePlan.cs @@ -48,16 +48,5 @@ private AppServicePlan(IConstruct scope, string name, string version = "2021-02- /// The KeyVault instance. public static AppServicePlan FromExisting(IConstruct scope, string name, ResourceGroup? parent = null) => new AppServicePlan(scope, parent: parent, name: name, isExisting: true); - - /// - protected override Resource? FindParentInScope(IConstruct scope) - { - var result = base.FindParentInScope(scope); - if (result is null) - { - result = scope.GetOrAddResourceGroup(); - } - return result; - } } } diff --git a/sdk/provisioning/Azure.Provisioning/src/websites/WebSite.cs b/sdk/provisioning/Azure.Provisioning/src/websites/WebSite.cs index bb1b3c2854197..ebc57abfc1e08 100644 --- a/sdk/provisioning/Azure.Provisioning/src/websites/WebSite.cs +++ b/sdk/provisioning/Azure.Provisioning/src/websites/WebSite.cs @@ -125,16 +125,5 @@ public void AddLogConfig(string resourceName) var logConfig = new WebSiteConfigLogs(Scope, resourceName, this); logConfig.AddDependency(AppSettings); } - - /// - protected override Resource? FindParentInScope(IConstruct scope) - { - var result = base.FindParentInScope(scope); - if (result is null) - { - result = scope.GetOrAddResourceGroup(); - } - return result; - } } } diff --git a/sdk/provisioning/Azure.Provisioning/tests/Infrastructure/CognitiveServices/main.bicep b/sdk/provisioning/Azure.Provisioning/tests/Infrastructure/CognitiveServices/main.bicep new file mode 100644 index 0000000000000..7aa72dc21e7e4 --- /dev/null +++ b/sdk/provisioning/Azure.Provisioning/tests/Infrastructure/CognitiveServices/main.bicep @@ -0,0 +1,35 @@ +targetScope = 'resourceGroup' + +@description('') +param location string = resourceGroup().location + +@description('') +param publicNetworkAccess string = 'Enabled' + + +resource cognitiveServicesAccount_ZfMvJY5Po 'Microsoft.CognitiveServices/accounts@2023-05-01' = { + name: 'cs-TEST' + location: location + kind: 'OpenAI' + sku: { + name: 'S0' + } + properties: { + publicNetworkAccess: publicNetworkAccess + } +} + +resource cognitiveServicesAccountDeployment_JeeW2XLVR 'Microsoft.CognitiveServices/accounts/deployments@2023-05-01' = { + parent: cognitiveServicesAccount_ZfMvJY5Po + name: 'cs' + sku: { + name: 'S0' + } + properties: { + model: { + name: 'text-embedding-3-large' + format: 'OpenAI' + version: '1' + } + } +} diff --git a/sdk/provisioning/Azure.Provisioning/tests/ProvisioningTests.cs b/sdk/provisioning/Azure.Provisioning/tests/ProvisioningTests.cs index d211dda8aaa9a..09237b637c8bc 100644 --- a/sdk/provisioning/Azure.Provisioning/tests/ProvisioningTests.cs +++ b/sdk/provisioning/Azure.Provisioning/tests/ProvisioningTests.cs @@ -11,7 +11,6 @@ using Azure.Core; using Azure.Core.TestFramework; using Azure.Core.Tests.TestFramework; -using Azure.Identity; using Azure.Provisioning.AppService; using Azure.Provisioning.KeyVaults; using Azure.Provisioning.Sql; @@ -19,11 +18,12 @@ using Azure.Provisioning.Storage; using Azure.Provisioning.AppConfiguration; using Azure.Provisioning.Authorization; +using Azure.Provisioning.CognitiveServices; using Azure.Provisioning.CosmosDB; using Azure.Provisioning.PostgreSql; using Azure.Provisioning.Redis; -using Azure.ResourceManager; using Azure.ResourceManager.Authorization.Models; +using Azure.ResourceManager.CognitiveServices.Models; using Azure.ResourceManager.CosmosDB.Models; using Azure.ResourceManager.PostgreSql.FlexibleServers.Models; using Azure.ResourceManager.Resources; @@ -326,6 +326,29 @@ await ValidateBicepAsync( interactiveMode: true); } + [RecordedTest] + public void CognitiveServices() + { + TestInfrastructure infrastructure = new TestInfrastructure(configuration: new Configuration { UseInteractiveMode = true }); + var account = new CognitiveServicesAccount(infrastructure, location: AzureLocation.EastUS); + account.AssignProperty(data => data.Properties.PublicNetworkAccess, new Parameter("publicNetworkAccess", defaultValue: "Enabled")); + + _ = new CognitiveServicesAccountDeployment( + infrastructure, + new CognitiveServicesAccountDeploymentModel + { + Name = "text-embedding-3-large", + Format = "OpenAI", + Version = "1" + }, + account); + + infrastructure.Build(GetOutputPath()); + + // couldn't fine a deployable combination of sku and model using test subscription + // await ValidateBicepAsync(interactiveMode: true); + } + [RecordedTest] public async Task WebSiteUsingL2() {