-
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.
- Loading branch information
1 parent
0835c93
commit 0ce2e4a
Showing
25 changed files
with
280 additions
and
172 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
27 changes: 17 additions & 10 deletions
27
sdk/provisioning/Azure.Provisioning/api/Azure.Provisioning.net6.0.cs
Large diffs are not rendered by default.
Oops, something went wrong.
27 changes: 17 additions & 10 deletions
27
sdk/provisioning/Azure.Provisioning/api/Azure.Provisioning.netstandard2.0.cs
Large diffs are not rendered by default.
Oops, something went wrong.
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
69 changes: 69 additions & 0 deletions
69
sdk/provisioning/Azure.Provisioning/src/cognitiveservices/CognitiveServicesAccount.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,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 | ||
{ | ||
/// <summary> | ||
/// Represents a Cognitive Services account. | ||
/// </summary> | ||
public class CognitiveServicesAccount : Resource<CognitiveServicesAccountData> | ||
{ | ||
private const string ResourceTypeName = "Microsoft.CognitiveServices/accounts"; | ||
private static readonly Func<string, CognitiveServicesAccountData> Empty = (name) => ArmCognitiveServicesModelFactory.CognitiveServicesAccountData(); | ||
|
||
/// <summary> | ||
/// Creates a new instance of the <see cref="CognitiveServicesAccount"/> class. | ||
/// </summary> | ||
/// <param name="scope">The scope.</param> | ||
/// <param name="kind">The kind.</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 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<string, CognitiveServicesAccountData>? creator = null) | ||
: base(scope, parent, name, ResourceTypeName, version, creator ?? Empty, isExisting) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Creates a new instance of the <see cref="CognitiveServicesAccount"/> 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 CognitiveServicesAccount FromExisting(IConstruct scope, string name, ResourceGroup? parent = null) | ||
=> new CognitiveServicesAccount(scope, parent: parent, name: name, isExisting: true); | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
...ovisioning/Azure.Provisioning/src/cognitiveservices/CognitiveServicesAccountDeployment.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,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 | ||
{ | ||
/// <summary> | ||
/// Cognitive Services account deployment. | ||
/// </summary> | ||
public class CognitiveServicesAccountDeployment : Resource<CognitiveServicesAccountDeploymentData> | ||
{ | ||
private const string ResourceTypeName = "Microsoft.CognitiveServices/accounts/deployments"; | ||
private static readonly Func<string, CognitiveServicesAccountDeploymentData> Empty = (name) => ArmCognitiveServicesModelFactory.CognitiveServicesAccountDeploymentData(); | ||
|
||
/// <summary> | ||
/// Creates a new instance of the <see cref="CognitiveServicesAccount"/> class. | ||
/// </summary> | ||
/// <param name="scope">The scope.</param> | ||
/// <param name="model">The model.</param> | ||
/// <param name="parent">The parent.</param> | ||
/// <param name="sku">The sku.</param> | ||
/// <param name="name">The name.</param> | ||
/// <param name="version">The version.</param> | ||
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<string, CognitiveServicesAccountDeploymentData>? creator = null) | ||
: base(scope, parent, name, ResourceTypeName, version, creator ?? Empty, isExisting) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Creates a new instance of the <see cref="CognitiveServicesAccount"/> class referencing an existing instance. | ||
/// </summary> | ||
/// <param name="scope">The scope.</param> | ||
/// <param name="name">The resource name.</param> | ||
/// <param name="parent">The parent.</param> | ||
/// <returns>The KeyVault instance.</returns> | ||
public static CognitiveServicesAccountDeployment FromExisting(IConstruct scope, string name, CognitiveServicesAccount parent) | ||
=> new CognitiveServicesAccountDeployment(scope, parent: parent, name: name, isExisting: true); | ||
|
||
/// <inheritdoc/> | ||
protected override Resource? FindParentInScope(IConstruct scope) | ||
{ | ||
return scope.GetSingleResource<CognitiveServicesAccount>() ?? new CognitiveServicesAccount(scope); | ||
} | ||
} | ||
} |
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.