diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/api/Azure.ResourceManager.CognitiveServices.netstandard2.0.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/api/Azure.ResourceManager.CognitiveServices.netstandard2.0.cs index 10c45010f656b..db289b6670558 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/api/Azure.ResourceManager.CognitiveServices.netstandard2.0.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/api/Azure.ResourceManager.CognitiveServices.netstandard2.0.cs @@ -49,6 +49,7 @@ public CognitiveServicesAccountDeploymentData() { } public Azure.ETag? ETag { get { throw null; } } public Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesAccountDeploymentProperties Properties { get { throw null; } set { } } public Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesSku Sku { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } } public partial class CognitiveServicesAccountDeploymentResource : Azure.ResourceManager.ArmResource { @@ -56,13 +57,21 @@ public partial class CognitiveServicesAccountDeploymentResource : Azure.Resource protected CognitiveServicesAccountDeploymentResource() { } public virtual Azure.ResourceManager.CognitiveServices.CognitiveServicesAccountDeploymentData Data { get { throw null; } } public virtual bool HasData { get { throw null; } } + public virtual Azure.Response AddTag(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> AddTagAsync(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string deploymentName) { throw null; } public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.CognitiveServices.CognitiveServicesAccountDeploymentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.CognitiveServices.CognitiveServicesAccountDeploymentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSkus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSkusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.CognitiveServices.Models.PatchResourceTagsAndSku deployment, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.CognitiveServices.Models.PatchResourceTagsAndSku deployment, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class CognitiveServicesAccountResource : Azure.ResourceManager.ArmResource { @@ -86,12 +95,21 @@ protected CognitiveServicesAccountResource() { } public virtual Azure.Response GetCommitmentPlan(string commitmentPlanName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetCommitmentPlanAsync(string commitmentPlanName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.CognitiveServices.CommitmentPlanCollection GetCommitmentPlans() { throw null; } + public virtual Azure.Response GetEncryptionScope(string encryptionScopeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetEncryptionScopeAsync(string encryptionScopeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.CognitiveServices.EncryptionScopeCollection GetEncryptionScopes() { throw null; } public virtual Azure.Response GetKeys(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetKeysAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetModels(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetModelsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetPrivateLinkResources(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetPrivateLinkResourcesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetRaiBlocklist(string raiBlocklistName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetRaiBlocklistAsync(string raiBlocklistName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.CognitiveServices.RaiBlocklistCollection GetRaiBlocklists() { throw null; } + public virtual Azure.ResourceManager.CognitiveServices.RaiPolicyCollection GetRaiPolicies() { throw null; } + public virtual Azure.Response GetRaiPolicy(string raiPolicyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetRaiPolicyAsync(string raiPolicyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetSkus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetSkusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetUsages(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -142,8 +160,8 @@ protected CognitiveServicesCommitmentPlanResource() { } public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesCommitmentPlanPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesCommitmentPlanPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.CognitiveServices.Models.PatchResourceTagsAndSku commitmentPlan, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.CognitiveServices.Models.PatchResourceTagsAndSku commitmentPlan, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class CognitiveServicesDeletedAccountCollection : Azure.ResourceManager.ArmCollection { @@ -215,8 +233,14 @@ public static partial class CognitiveServicesExtensions public static Azure.AsyncPageable GetCommitmentTiersAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.Pageable GetDeletedAccounts(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetDeletedAccountsAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.CognitiveServices.EncryptionScopeResource GetEncryptionScopeResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.Pageable GetModels(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetModelsAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.CognitiveServices.RaiBlocklistItemResource GetRaiBlocklistItemResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.CognitiveServices.RaiBlocklistResource GetRaiBlocklistResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Pageable GetRaiContentFilters(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetRaiContentFiltersAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.CognitiveServices.RaiPolicyResource GetRaiPolicyResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.Pageable GetResourceSkus(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetResourceSkusAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.Pageable GetUsages(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -281,6 +305,7 @@ public partial class CommitmentPlanAccountAssociationData : Azure.ResourceManage public CommitmentPlanAccountAssociationData() { } public string AccountId { get { throw null; } set { } } public Azure.ETag? ETag { get { throw null; } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } } public partial class CommitmentPlanAccountAssociationResource : Azure.ResourceManager.ArmResource { @@ -288,11 +313,17 @@ public partial class CommitmentPlanAccountAssociationResource : Azure.ResourceMa protected CommitmentPlanAccountAssociationResource() { } public virtual Azure.ResourceManager.CognitiveServices.CommitmentPlanAccountAssociationData Data { get { throw null; } } public virtual bool HasData { get { throw null; } } + public virtual Azure.Response AddTag(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> AddTagAsync(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string commitmentPlanName, string commitmentPlanAssociationName) { throw null; } public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.CognitiveServices.CommitmentPlanAccountAssociationData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.CognitiveServices.CommitmentPlanAccountAssociationData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } @@ -343,6 +374,185 @@ protected CommitmentPlanResource() { } public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.CognitiveServices.CommitmentPlanData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.CognitiveServices.CommitmentPlanData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } + public partial class EncryptionScopeCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected EncryptionScopeCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string encryptionScopeName, Azure.ResourceManager.CognitiveServices.EncryptionScopeData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string encryptionScopeName, Azure.ResourceManager.CognitiveServices.EncryptionScopeData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string encryptionScopeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string encryptionScopeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string encryptionScopeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string encryptionScopeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string encryptionScopeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string encryptionScopeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class EncryptionScopeData : Azure.ResourceManager.Models.ResourceData + { + public EncryptionScopeData() { } + public Azure.ETag? ETag { get { throw null; } } + public Azure.ResourceManager.CognitiveServices.Models.EncryptionScopeProperties Properties { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + } + public partial class EncryptionScopeResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected EncryptionScopeResource() { } + public virtual Azure.ResourceManager.CognitiveServices.EncryptionScopeData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public virtual Azure.Response AddTag(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> AddTagAsync(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string encryptionScopeName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.CognitiveServices.EncryptionScopeData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.CognitiveServices.EncryptionScopeData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class RaiBlocklistCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected RaiBlocklistCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string raiBlocklistName, Azure.ResourceManager.CognitiveServices.RaiBlocklistData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string raiBlocklistName, Azure.ResourceManager.CognitiveServices.RaiBlocklistData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string raiBlocklistName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string raiBlocklistName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string raiBlocklistName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string raiBlocklistName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string raiBlocklistName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string raiBlocklistName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class RaiBlocklistData : Azure.ResourceManager.Models.ResourceData + { + public RaiBlocklistData() { } + public Azure.ETag? ETag { get { throw null; } } + public string RaiBlocklistDescription { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + } + public partial class RaiBlocklistItemCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected RaiBlocklistItemCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string raiBlocklistItemName, Azure.ResourceManager.CognitiveServices.RaiBlocklistItemData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string raiBlocklistItemName, Azure.ResourceManager.CognitiveServices.RaiBlocklistItemData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string raiBlocklistItemName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string raiBlocklistItemName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string raiBlocklistItemName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string raiBlocklistItemName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string raiBlocklistItemName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string raiBlocklistItemName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class RaiBlocklistItemData : Azure.ResourceManager.Models.ResourceData + { + public RaiBlocklistItemData() { } + public Azure.ETag? ETag { get { throw null; } } + public Azure.ResourceManager.CognitiveServices.Models.RaiBlocklistItemProperties Properties { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + } + public partial class RaiBlocklistItemResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected RaiBlocklistItemResource() { } + public virtual Azure.ResourceManager.CognitiveServices.RaiBlocklistItemData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public virtual Azure.Response AddTag(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> AddTagAsync(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName, string raiBlocklistItemName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.CognitiveServices.RaiBlocklistItemData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.CognitiveServices.RaiBlocklistItemData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class RaiBlocklistResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected RaiBlocklistResource() { } + public virtual Azure.ResourceManager.CognitiveServices.RaiBlocklistData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public virtual Azure.Response AddTag(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> AddTagAsync(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetRaiBlocklistItem(string raiBlocklistItemName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetRaiBlocklistItemAsync(string raiBlocklistItemName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.CognitiveServices.RaiBlocklistItemCollection GetRaiBlocklistItems() { throw null; } + public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.CognitiveServices.RaiBlocklistData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.CognitiveServices.RaiBlocklistData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class RaiPolicyCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected RaiPolicyCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string raiPolicyName, Azure.ResourceManager.CognitiveServices.RaiPolicyData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string raiPolicyName, Azure.ResourceManager.CognitiveServices.RaiPolicyData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string raiPolicyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string raiPolicyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string raiPolicyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string raiPolicyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string raiPolicyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string raiPolicyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class RaiPolicyData : Azure.ResourceManager.Models.ResourceData + { + public RaiPolicyData() { } + public Azure.ETag? ETag { get { throw null; } } + public Azure.ResourceManager.CognitiveServices.Models.RaiPolicyProperties Properties { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + } + public partial class RaiPolicyResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected RaiPolicyResource() { } + public virtual Azure.ResourceManager.CognitiveServices.RaiPolicyData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public virtual Azure.Response AddTag(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> AddTagAsync(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string raiPolicyName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.CognitiveServices.RaiPolicyData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.CognitiveServices.RaiPolicyData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } } namespace Azure.ResourceManager.CognitiveServices.Mocking { @@ -356,6 +566,10 @@ protected MockableCognitiveServicesArmClient() { } public virtual Azure.ResourceManager.CognitiveServices.CognitiveServicesPrivateEndpointConnectionResource GetCognitiveServicesPrivateEndpointConnectionResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.CognitiveServices.CommitmentPlanAccountAssociationResource GetCommitmentPlanAccountAssociationResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.CognitiveServices.CommitmentPlanResource GetCommitmentPlanResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CognitiveServices.EncryptionScopeResource GetEncryptionScopeResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CognitiveServices.RaiBlocklistItemResource GetRaiBlocklistItemResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CognitiveServices.RaiBlocklistResource GetRaiBlocklistResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.CognitiveServices.RaiPolicyResource GetRaiPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } } public partial class MockableCognitiveServicesResourceGroupResource : Azure.ResourceManager.ArmResource { @@ -387,6 +601,8 @@ protected MockableCognitiveServicesSubscriptionResource() { } public virtual Azure.AsyncPageable GetDeletedAccountsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetModels(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetModelsAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetRaiContentFilters(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetRaiContentFiltersAsync(Azure.Core.AzureLocation location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetResourceSkus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetResourceSkusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetUsages(Azure.Core.AzureLocation location, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -420,17 +636,36 @@ internal AbusePenalty() { } public static bool operator !=(Azure.ResourceManager.CognitiveServices.Models.AbusePenaltyAction left, Azure.ResourceManager.CognitiveServices.Models.AbusePenaltyAction right) { throw null; } public override string ToString() { throw null; } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AllowedContentLevel : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AllowedContentLevel(string value) { throw null; } + public static Azure.ResourceManager.CognitiveServices.Models.AllowedContentLevel High { get { throw null; } } + public static Azure.ResourceManager.CognitiveServices.Models.AllowedContentLevel Low { get { throw null; } } + public static Azure.ResourceManager.CognitiveServices.Models.AllowedContentLevel Medium { get { throw null; } } + public bool Equals(Azure.ResourceManager.CognitiveServices.Models.AllowedContentLevel other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.CognitiveServices.Models.AllowedContentLevel left, Azure.ResourceManager.CognitiveServices.Models.AllowedContentLevel right) { throw null; } + public static implicit operator Azure.ResourceManager.CognitiveServices.Models.AllowedContentLevel (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.CognitiveServices.Models.AllowedContentLevel left, Azure.ResourceManager.CognitiveServices.Models.AllowedContentLevel right) { throw null; } + public override string ToString() { throw null; } + } public static partial class ArmCognitiveServicesModelFactory { public static Azure.ResourceManager.CognitiveServices.Models.AbusePenalty AbusePenalty(Azure.ResourceManager.CognitiveServices.Models.AbusePenaltyAction? action = default(Azure.ResourceManager.CognitiveServices.Models.AbusePenaltyAction?), float? rateLimitPercentage = default(float?), System.DateTimeOffset? expiration = default(System.DateTimeOffset?)) { throw null; } public static Azure.ResourceManager.CognitiveServices.Models.AvailableCognitiveServicesSku AvailableCognitiveServicesSku(string resourceType = null, string name = null, string tier = null, string kind = null, System.Collections.Generic.IEnumerable locations = null, System.Collections.Generic.IEnumerable restrictions = null) { throw null; } public static Azure.ResourceManager.CognitiveServices.CognitiveServicesAccountData CognitiveServicesAccountData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string kind = null, Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesSku sku = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null, Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesAccountProperties properties = null, Azure.ETag? etag = default(Azure.ETag?)) { throw null; } - public static Azure.ResourceManager.CognitiveServices.CognitiveServicesAccountDeploymentData CognitiveServicesAccountDeploymentData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesSku sku = null, Azure.ETag? etag = default(Azure.ETag?), Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesAccountDeploymentProperties properties = null) { throw null; } + public static Azure.ResourceManager.CognitiveServices.CognitiveServicesAccountDeploymentData CognitiveServicesAccountDeploymentData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesSku sku = null, Azure.ETag? etag = default(Azure.ETag?), System.Collections.Generic.IDictionary tags = null, Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesAccountDeploymentProperties properties = null) { throw null; } public static Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesAccountDeploymentModel CognitiveServicesAccountDeploymentModel(string format = null, string name = null, string version = null, string source = null, Azure.ResourceManager.CognitiveServices.Models.ServiceAccountCallRateLimit callRateLimit = null) { throw null; } - public static Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesAccountDeploymentProperties CognitiveServicesAccountDeploymentProperties(Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesAccountDeploymentProvisioningState? provisioningState = default(Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesAccountDeploymentProvisioningState?), Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesAccountDeploymentModel model = null, Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesAccountDeploymentScaleSettings scaleSettings = null, System.Collections.Generic.IReadOnlyDictionary capabilities = null, string raiPolicyName = null, Azure.ResourceManager.CognitiveServices.Models.ServiceAccountCallRateLimit callRateLimit = null, System.Collections.Generic.IEnumerable rateLimits = null, Azure.ResourceManager.CognitiveServices.Models.DeploymentModelVersionUpgradeOption? versionUpgradeOption = default(Azure.ResourceManager.CognitiveServices.Models.DeploymentModelVersionUpgradeOption?)) { throw null; } + public static Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesAccountDeploymentProperties CognitiveServicesAccountDeploymentProperties(Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesAccountDeploymentProvisioningState? provisioningState = default(Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesAccountDeploymentProvisioningState?), Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesAccountDeploymentModel model = null, Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesAccountDeploymentScaleSettings scaleSettings = null, System.Collections.Generic.IReadOnlyDictionary capabilities = null, string raiPolicyName = null, Azure.ResourceManager.CognitiveServices.Models.ServiceAccountCallRateLimit callRateLimit = null, System.Collections.Generic.IEnumerable rateLimits = null, Azure.ResourceManager.CognitiveServices.Models.DeploymentModelVersionUpgradeOption? versionUpgradeOption = default(Azure.ResourceManager.CognitiveServices.Models.DeploymentModelVersionUpgradeOption?), bool? dynamicThrottlingEnabled = default(bool?), int? currentCapacity = default(int?), Azure.ResourceManager.CognitiveServices.Models.DeploymentCapacitySettings capacitySettings = null) { throw null; } public static Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesAccountDeploymentScaleSettings CognitiveServicesAccountDeploymentScaleSettings(Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesAccountDeploymentScaleType? scaleType = default(Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesAccountDeploymentScaleType?), int? capacity = default(int?), int? activeCapacity = default(int?)) { throw null; } public static Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesAccountModel CognitiveServicesAccountModel(string format = null, string name = null, string version = null, string source = null, Azure.ResourceManager.CognitiveServices.Models.ServiceAccountCallRateLimit callRateLimit = null, Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesAccountDeploymentModel baseModel = null, bool? isDefaultVersion = default(bool?), System.Collections.Generic.IEnumerable skus = null, int? maxCapacity = default(int?), System.Collections.Generic.IDictionary capabilities = null, System.Collections.Generic.IDictionary finetuneCapabilities = null, Azure.ResourceManager.CognitiveServices.Models.ServiceAccountModelDeprecationInfo deprecation = null, Azure.ResourceManager.CognitiveServices.Models.ModelLifecycleStatus? lifecycleStatus = default(Azure.ResourceManager.CognitiveServices.Models.ModelLifecycleStatus?), Azure.ResourceManager.Models.SystemData systemData = null) { throw null; } - public static Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesAccountProperties CognitiveServicesAccountProperties(Azure.ResourceManager.CognitiveServices.Models.ServiceAccountProvisioningState? provisioningState = default(Azure.ResourceManager.CognitiveServices.Models.ServiceAccountProvisioningState?), string endpoint = null, System.Collections.Generic.IEnumerable capabilities = null, bool? isMigrated = default(bool?), string migrationToken = null, Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesSkuChangeInfo skuChangeInfo = null, string customSubDomainName = null, Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesNetworkRuleSet networkAcls = null, Azure.ResourceManager.CognitiveServices.Models.ServiceAccountEncryptionProperties encryption = null, System.Collections.Generic.IEnumerable userOwnedStorage = null, System.Collections.Generic.IEnumerable privateEndpointConnections = null, Azure.ResourceManager.CognitiveServices.Models.ServiceAccountPublicNetworkAccess? publicNetworkAccess = default(Azure.ResourceManager.CognitiveServices.Models.ServiceAccountPublicNetworkAccess?), Azure.ResourceManager.CognitiveServices.Models.ServiceAccountApiProperties apiProperties = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), Azure.ResourceManager.CognitiveServices.Models.ServiceAccountCallRateLimit callRateLimit = null, bool? enableDynamicThrottling = default(bool?), Azure.ResourceManager.CognitiveServices.Models.ServiceAccountQuotaLimit quotaLimit = null, bool? restrictOutboundNetworkAccess = default(bool?), System.Collections.Generic.IEnumerable allowedFqdnList = null, bool? disableLocalAuth = default(bool?), System.Collections.Generic.IReadOnlyDictionary endpoints = null, bool? restore = default(bool?), System.DateTimeOffset? deletedOn = default(System.DateTimeOffset?), string scheduledPurgeDate = null, Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesMultiRegionSettings locations = null, System.Collections.Generic.IEnumerable commitmentPlanAssociations = null, Azure.ResourceManager.CognitiveServices.Models.AbusePenalty abusePenalty = null) { throw null; } + public static Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesAccountProperties CognitiveServicesAccountProperties(Azure.ResourceManager.CognitiveServices.Models.ServiceAccountProvisioningState? provisioningState = default(Azure.ResourceManager.CognitiveServices.Models.ServiceAccountProvisioningState?), string endpoint = null, System.Collections.Generic.IEnumerable capabilities = null, bool? isMigrated = default(bool?), string migrationToken = null, Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesSkuChangeInfo skuChangeInfo = null, string customSubDomainName = null, Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesNetworkRuleSet networkAcls = null, Azure.ResourceManager.CognitiveServices.Models.ServiceAccountEncryptionProperties encryption = null, System.Collections.Generic.IEnumerable userOwnedStorage = null, Azure.ResourceManager.CognitiveServices.Models.UserOwnedAmlWorkspace amlWorkspace = null, System.Collections.Generic.IEnumerable privateEndpointConnections = null, Azure.ResourceManager.CognitiveServices.Models.ServiceAccountPublicNetworkAccess? publicNetworkAccess = default(Azure.ResourceManager.CognitiveServices.Models.ServiceAccountPublicNetworkAccess?), Azure.ResourceManager.CognitiveServices.Models.ServiceAccountApiProperties apiProperties = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), Azure.ResourceManager.CognitiveServices.Models.ServiceAccountCallRateLimit callRateLimit = null, bool? enableDynamicThrottling = default(bool?), Azure.ResourceManager.CognitiveServices.Models.ServiceAccountQuotaLimit quotaLimit = null, bool? restrictOutboundNetworkAccess = default(bool?), System.Collections.Generic.IEnumerable allowedFqdnList = null, bool? disableLocalAuth = default(bool?), System.Collections.Generic.IReadOnlyDictionary endpoints = null, bool? restore = default(bool?), System.DateTimeOffset? deletedOn = default(System.DateTimeOffset?), string scheduledPurgeDate = null, Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesMultiRegionSettings locations = null, System.Collections.Generic.IEnumerable commitmentPlanAssociations = null, Azure.ResourceManager.CognitiveServices.Models.AbusePenalty abusePenalty = null) { throw null; } public static Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesAccountSku CognitiveServicesAccountSku(Azure.Core.ResourceType? resourceType = default(Azure.Core.ResourceType?), Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesSku sku = null) { throw null; } public static Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesDomainAvailabilityList CognitiveServicesDomainAvailabilityList(bool? isSubdomainAvailable = default(bool?), string reason = null, string subdomainName = null, string domainAvailabilityType = null, string kind = null) { throw null; } public static Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesModel CognitiveServicesModel(Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesAccountModel model = null, string kind = null, string skuName = null) { throw null; } @@ -445,12 +680,19 @@ public static partial class ArmCognitiveServicesModelFactory public static Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesSkuRestrictions CognitiveServicesSkuRestrictions(Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesSkuRestrictionsType? restrictionsType = default(Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesSkuRestrictionsType?), System.Collections.Generic.IEnumerable values = null, Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesSkuRestrictionInfo restrictionInfo = null, Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesSkuRestrictionReasonCode? reasonCode = default(Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesSkuRestrictionReasonCode?)) { throw null; } public static Azure.ResourceManager.CognitiveServices.Models.CommitmentCost CommitmentCost(string commitmentMeterId = null, string overageMeterId = null) { throw null; } public static Azure.ResourceManager.CognitiveServices.Models.CommitmentPeriod CommitmentPeriod(string tier = null, int? count = default(int?), Azure.ResourceManager.CognitiveServices.Models.CommitmentQuota quota = null, System.DateTimeOffset? startOn = default(System.DateTimeOffset?), System.DateTimeOffset? endOn = default(System.DateTimeOffset?)) { throw null; } - public static Azure.ResourceManager.CognitiveServices.CommitmentPlanAccountAssociationData CommitmentPlanAccountAssociationData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ETag? etag = default(Azure.ETag?), string accountId = null) { throw null; } + public static Azure.ResourceManager.CognitiveServices.CommitmentPlanAccountAssociationData CommitmentPlanAccountAssociationData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ETag? etag = default(Azure.ETag?), System.Collections.Generic.IDictionary tags = null, string accountId = null) { throw null; } public static Azure.ResourceManager.CognitiveServices.Models.CommitmentPlanAssociation CommitmentPlanAssociation(Azure.Core.ResourceIdentifier commitmentPlanId = null, string commitmentPlanLocation = null) { throw null; } public static Azure.ResourceManager.CognitiveServices.CommitmentPlanData CommitmentPlanData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ETag? etag = default(Azure.ETag?), string kind = null, Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesSku sku = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), Azure.ResourceManager.CognitiveServices.Models.CommitmentPlanProperties properties = null) { throw null; } public static Azure.ResourceManager.CognitiveServices.Models.CommitmentPlanProperties CommitmentPlanProperties(Azure.ResourceManager.CognitiveServices.Models.CommitmentPlanProvisioningState? provisioningState = default(Azure.ResourceManager.CognitiveServices.Models.CommitmentPlanProvisioningState?), System.Guid? commitmentPlanGuid = default(System.Guid?), Azure.ResourceManager.CognitiveServices.Models.ServiceAccountHostingModel? hostingModel = default(Azure.ResourceManager.CognitiveServices.Models.ServiceAccountHostingModel?), string planType = null, Azure.ResourceManager.CognitiveServices.Models.CommitmentPeriod current = null, bool? autoRenew = default(bool?), Azure.ResourceManager.CognitiveServices.Models.CommitmentPeriod next = null, Azure.ResourceManager.CognitiveServices.Models.CommitmentPeriod last = null, System.Collections.Generic.IEnumerable provisioningIssues = null) { throw null; } public static Azure.ResourceManager.CognitiveServices.Models.CommitmentQuota CommitmentQuota(long? quantity = default(long?), string unit = null) { throw null; } public static Azure.ResourceManager.CognitiveServices.Models.CommitmentTier CommitmentTier(string kind = null, string skuName = null, Azure.ResourceManager.CognitiveServices.Models.ServiceAccountHostingModel? hostingModel = default(Azure.ResourceManager.CognitiveServices.Models.ServiceAccountHostingModel?), string planType = null, string tier = null, int? maxCount = default(int?), Azure.ResourceManager.CognitiveServices.Models.CommitmentQuota quota = null, Azure.ResourceManager.CognitiveServices.Models.CommitmentCost cost = null) { throw null; } + public static Azure.ResourceManager.CognitiveServices.EncryptionScopeData EncryptionScopeData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ETag? etag = default(Azure.ETag?), System.Collections.Generic.IDictionary tags = null, Azure.ResourceManager.CognitiveServices.Models.EncryptionScopeProperties properties = null) { throw null; } + public static Azure.ResourceManager.CognitiveServices.Models.EncryptionScopeProperties EncryptionScopeProperties(Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesKeyVaultProperties keyVaultProperties = null, Azure.ResourceManager.CognitiveServices.Models.ServiceAccountEncryptionKeySource? keySource = default(Azure.ResourceManager.CognitiveServices.Models.ServiceAccountEncryptionKeySource?), Azure.ResourceManager.CognitiveServices.Models.EncryptionScopeProvisioningState? provisioningState = default(Azure.ResourceManager.CognitiveServices.Models.EncryptionScopeProvisioningState?), Azure.ResourceManager.CognitiveServices.Models.EncryptionScopeState? state = default(Azure.ResourceManager.CognitiveServices.Models.EncryptionScopeState?)) { throw null; } + public static Azure.ResourceManager.CognitiveServices.RaiBlocklistData RaiBlocklistData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ETag? etag = default(Azure.ETag?), System.Collections.Generic.IDictionary tags = null, string raiBlocklistDescription = null) { throw null; } + public static Azure.ResourceManager.CognitiveServices.RaiBlocklistItemData RaiBlocklistItemData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ETag? etag = default(Azure.ETag?), System.Collections.Generic.IDictionary tags = null, Azure.ResourceManager.CognitiveServices.Models.RaiBlocklistItemProperties properties = null) { throw null; } + public static Azure.ResourceManager.CognitiveServices.Models.RaiContentFilter RaiContentFilter(string policyName = null, string description = null, Azure.ResourceManager.CognitiveServices.Models.RaiContentFilterType? filterType = default(Azure.ResourceManager.CognitiveServices.Models.RaiContentFilterType?)) { throw null; } + public static Azure.ResourceManager.CognitiveServices.RaiPolicyData RaiPolicyData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ETag? etag = default(Azure.ETag?), System.Collections.Generic.IDictionary tags = null, Azure.ResourceManager.CognitiveServices.Models.RaiPolicyProperties properties = null) { throw null; } + public static Azure.ResourceManager.CognitiveServices.Models.RaiPolicyProperties RaiPolicyProperties(Azure.ResourceManager.CognitiveServices.Models.RaiPolicyType? policyType = default(Azure.ResourceManager.CognitiveServices.Models.RaiPolicyType?), Azure.ResourceManager.CognitiveServices.Models.RaiPolicyMode? mode = default(Azure.ResourceManager.CognitiveServices.Models.RaiPolicyMode?), string basePolicyName = null, System.Collections.Generic.IEnumerable promptBlocklists = null, System.Collections.Generic.IEnumerable completionBlocklists = null, System.Collections.Generic.IEnumerable contentFilters = null) { throw null; } public static Azure.ResourceManager.CognitiveServices.Models.ServiceAccountApiKeys ServiceAccountApiKeys(string key1 = null, string key2 = null) { throw null; } public static Azure.ResourceManager.CognitiveServices.Models.ServiceAccountCallRateLimit ServiceAccountCallRateLimit(float? count = default(float?), float? renewalPeriod = default(float?), System.Collections.Generic.IEnumerable rules = null) { throw null; } public static Azure.ResourceManager.CognitiveServices.Models.ServiceAccountQuotaLimit ServiceAccountQuotaLimit(float? count = default(float?), float? renewalPeriod = default(float?), System.Collections.Generic.IEnumerable rules = null) { throw null; } @@ -458,6 +700,7 @@ public static partial class ArmCognitiveServicesModelFactory public static Azure.ResourceManager.CognitiveServices.Models.ServiceAccountThrottlingRule ServiceAccountThrottlingRule(string key = null, float? renewalPeriod = default(float?), float? count = default(float?), float? minCount = default(float?), bool? isDynamicThrottlingEnabled = default(bool?), System.Collections.Generic.IEnumerable matchPatterns = null) { throw null; } public static Azure.ResourceManager.CognitiveServices.Models.ServiceAccountUsage ServiceAccountUsage(Azure.ResourceManager.CognitiveServices.Models.ServiceAccountUsageUnitType? unit = default(Azure.ResourceManager.CognitiveServices.Models.ServiceAccountUsageUnitType?), Azure.ResourceManager.CognitiveServices.Models.ServiceAccountUsageMetricName name = null, string quotaPeriod = null, double? limit = default(double?), double? currentValue = default(double?), string nextResetTime = null, Azure.ResourceManager.CognitiveServices.Models.ServiceAccountQuotaUsageStatus? status = default(Azure.ResourceManager.CognitiveServices.Models.ServiceAccountQuotaUsageStatus?)) { throw null; } public static Azure.ResourceManager.CognitiveServices.Models.ServiceAccountUsageMetricName ServiceAccountUsageMetricName(string value = null, string localizedValue = null) { throw null; } + public static Azure.ResourceManager.CognitiveServices.Models.SkuResource SkuResource(string resourceType = null, Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesSku sku = null, Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesCapacityConfig capacity = null) { throw null; } } public partial class AvailableCognitiveServicesSku { @@ -469,6 +712,24 @@ internal AvailableCognitiveServicesSku() { } public System.Collections.Generic.IReadOnlyList Restrictions { get { throw null; } } public string Tier { get { throw null; } } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ByPassSelection : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ByPassSelection(string value) { throw null; } + public static Azure.ResourceManager.CognitiveServices.Models.ByPassSelection AzureServices { get { throw null; } } + public static Azure.ResourceManager.CognitiveServices.Models.ByPassSelection None { get { throw null; } } + public bool Equals(Azure.ResourceManager.CognitiveServices.Models.ByPassSelection other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.CognitiveServices.Models.ByPassSelection left, Azure.ResourceManager.CognitiveServices.Models.ByPassSelection right) { throw null; } + public static implicit operator Azure.ResourceManager.CognitiveServices.Models.ByPassSelection (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.CognitiveServices.Models.ByPassSelection left, Azure.ResourceManager.CognitiveServices.Models.ByPassSelection right) { throw null; } + public override string ToString() { throw null; } + } public partial class CognitiveServicesAccountDeploymentModel { public CognitiveServicesAccountDeploymentModel() { } @@ -483,6 +744,9 @@ public partial class CognitiveServicesAccountDeploymentProperties public CognitiveServicesAccountDeploymentProperties() { } public Azure.ResourceManager.CognitiveServices.Models.ServiceAccountCallRateLimit CallRateLimit { get { throw null; } } public System.Collections.Generic.IReadOnlyDictionary Capabilities { get { throw null; } } + public Azure.ResourceManager.CognitiveServices.Models.DeploymentCapacitySettings CapacitySettings { get { throw null; } set { } } + public int? CurrentCapacity { get { throw null; } set { } } + public bool? DynamicThrottlingEnabled { get { throw null; } } public Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesAccountDeploymentModel Model { get { throw null; } set { } } public Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesAccountDeploymentProvisioningState? ProvisioningState { get { throw null; } } public string RaiPolicyName { get { throw null; } set { } } @@ -557,6 +821,7 @@ public partial class CognitiveServicesAccountProperties public CognitiveServicesAccountProperties() { } public Azure.ResourceManager.CognitiveServices.Models.AbusePenalty AbusePenalty { get { throw null; } } public System.Collections.Generic.IList AllowedFqdnList { get { throw null; } } + public Azure.ResourceManager.CognitiveServices.Models.UserOwnedAmlWorkspace AmlWorkspace { get { throw null; } set { } } public Azure.ResourceManager.CognitiveServices.Models.ServiceAccountApiProperties ApiProperties { get { throw null; } set { } } public Azure.ResourceManager.CognitiveServices.Models.ServiceAccountCallRateLimit CallRateLimit { get { throw null; } } public System.Collections.Generic.IReadOnlyList Capabilities { get { throw null; } } @@ -592,16 +857,12 @@ internal CognitiveServicesAccountSku() { } public partial class CognitiveServicesCapacityConfig { public CognitiveServicesCapacityConfig() { } + public System.Collections.Generic.IList AllowedValues { get { throw null; } } public int? Default { get { throw null; } set { } } public int? Maximum { get { throw null; } set { } } public int? Minimum { get { throw null; } set { } } public int? Step { get { throw null; } set { } } } - public partial class CognitiveServicesCommitmentPlanPatch : Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesPatchResourceTags - { - public CognitiveServicesCommitmentPlanPatch() { } - public Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesSku Sku { get { throw null; } set { } } - } public partial class CognitiveServicesDomainAvailabilityContent { public CognitiveServicesDomainAvailabilityContent(string subdomainName, Azure.Core.ResourceType resourceType) { } @@ -674,6 +935,7 @@ public CognitiveServicesMultiRegionSettings() { } public partial class CognitiveServicesNetworkRuleSet { public CognitiveServicesNetworkRuleSet() { } + public Azure.ResourceManager.CognitiveServices.Models.ByPassSelection? Bypass { get { throw null; } set { } } public Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesNetworkRuleAction? DefaultAction { get { throw null; } set { } } public System.Collections.Generic.IList IPRules { get { throw null; } } public System.Collections.Generic.IList VirtualNetworkRules { get { throw null; } } @@ -947,6 +1209,12 @@ internal CommitmentTier() { } public string SkuName { get { throw null; } } public string Tier { get { throw null; } } } + public partial class DeploymentCapacitySettings + { + public DeploymentCapacitySettings() { } + public int? DesignatedCapacity { get { throw null; } set { } } + public int? Priority { get { throw null; } set { } } + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct DeploymentModelVersionUpgradeOption : System.IEquatable { @@ -966,6 +1234,53 @@ internal CommitmentTier() { } public static bool operator !=(Azure.ResourceManager.CognitiveServices.Models.DeploymentModelVersionUpgradeOption left, Azure.ResourceManager.CognitiveServices.Models.DeploymentModelVersionUpgradeOption right) { throw null; } public override string ToString() { throw null; } } + public partial class EncryptionScopeProperties : Azure.ResourceManager.CognitiveServices.Models.ServiceAccountEncryptionProperties + { + public EncryptionScopeProperties() { } + public Azure.ResourceManager.CognitiveServices.Models.EncryptionScopeProvisioningState? ProvisioningState { get { throw null; } } + public Azure.ResourceManager.CognitiveServices.Models.EncryptionScopeState? State { get { throw null; } set { } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct EncryptionScopeProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public EncryptionScopeProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.CognitiveServices.Models.EncryptionScopeProvisioningState Accepted { get { throw null; } } + public static Azure.ResourceManager.CognitiveServices.Models.EncryptionScopeProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.CognitiveServices.Models.EncryptionScopeProvisioningState Creating { get { throw null; } } + public static Azure.ResourceManager.CognitiveServices.Models.EncryptionScopeProvisioningState Deleting { get { throw null; } } + public static Azure.ResourceManager.CognitiveServices.Models.EncryptionScopeProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.CognitiveServices.Models.EncryptionScopeProvisioningState Moving { get { throw null; } } + public static Azure.ResourceManager.CognitiveServices.Models.EncryptionScopeProvisioningState Succeeded { get { throw null; } } + public bool Equals(Azure.ResourceManager.CognitiveServices.Models.EncryptionScopeProvisioningState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.CognitiveServices.Models.EncryptionScopeProvisioningState left, Azure.ResourceManager.CognitiveServices.Models.EncryptionScopeProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.CognitiveServices.Models.EncryptionScopeProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.CognitiveServices.Models.EncryptionScopeProvisioningState left, Azure.ResourceManager.CognitiveServices.Models.EncryptionScopeProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct EncryptionScopeState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public EncryptionScopeState(string value) { throw null; } + public static Azure.ResourceManager.CognitiveServices.Models.EncryptionScopeState Disabled { get { throw null; } } + public static Azure.ResourceManager.CognitiveServices.Models.EncryptionScopeState Enabled { get { throw null; } } + public bool Equals(Azure.ResourceManager.CognitiveServices.Models.EncryptionScopeState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.CognitiveServices.Models.EncryptionScopeState left, Azure.ResourceManager.CognitiveServices.Models.EncryptionScopeState right) { throw null; } + public static implicit operator Azure.ResourceManager.CognitiveServices.Models.EncryptionScopeState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.CognitiveServices.Models.EncryptionScopeState left, Azure.ResourceManager.CognitiveServices.Models.EncryptionScopeState right) { throw null; } + public override string ToString() { throw null; } + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct ModelLifecycleStatus : System.IEquatable { @@ -984,6 +1299,122 @@ internal CommitmentTier() { } public static bool operator !=(Azure.ResourceManager.CognitiveServices.Models.ModelLifecycleStatus left, Azure.ResourceManager.CognitiveServices.Models.ModelLifecycleStatus right) { throw null; } public override string ToString() { throw null; } } + public partial class PatchResourceTagsAndSku : Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesPatchResourceTags + { + public PatchResourceTagsAndSku() { } + public Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesSku Sku { get { throw null; } set { } } + } + public partial class RaiBlocklistConfig + { + public RaiBlocklistConfig() { } + public bool? Blocking { get { throw null; } set { } } + public string BlocklistName { get { throw null; } set { } } + } + public partial class RaiBlocklistItemProperties + { + public RaiBlocklistItemProperties() { } + public bool? IsRegex { get { throw null; } set { } } + public string Pattern { get { throw null; } set { } } + } + public partial class RaiContentFilter + { + internal RaiContentFilter() { } + public string Description { get { throw null; } } + public Azure.ResourceManager.CognitiveServices.Models.RaiContentFilterType? FilterType { get { throw null; } } + public string PolicyName { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct RaiContentFilterType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public RaiContentFilterType(string value) { throw null; } + public static Azure.ResourceManager.CognitiveServices.Models.RaiContentFilterType MultiLevel { get { throw null; } } + public static Azure.ResourceManager.CognitiveServices.Models.RaiContentFilterType Switch { get { throw null; } } + public bool Equals(Azure.ResourceManager.CognitiveServices.Models.RaiContentFilterType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.CognitiveServices.Models.RaiContentFilterType left, Azure.ResourceManager.CognitiveServices.Models.RaiContentFilterType right) { throw null; } + public static implicit operator Azure.ResourceManager.CognitiveServices.Models.RaiContentFilterType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.CognitiveServices.Models.RaiContentFilterType left, Azure.ResourceManager.CognitiveServices.Models.RaiContentFilterType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class RaiPolicyContentFilter + { + public RaiPolicyContentFilter() { } + public Azure.ResourceManager.CognitiveServices.Models.AllowedContentLevel? AllowedContentLevel { get { throw null; } set { } } + public bool? Blocking { get { throw null; } set { } } + public bool? Enabled { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + public Azure.ResourceManager.CognitiveServices.Models.RaiPolicyContentSource? Source { get { throw null; } set { } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct RaiPolicyContentSource : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public RaiPolicyContentSource(string value) { throw null; } + public static Azure.ResourceManager.CognitiveServices.Models.RaiPolicyContentSource Completion { get { throw null; } } + public static Azure.ResourceManager.CognitiveServices.Models.RaiPolicyContentSource Prompt { get { throw null; } } + public bool Equals(Azure.ResourceManager.CognitiveServices.Models.RaiPolicyContentSource other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.CognitiveServices.Models.RaiPolicyContentSource left, Azure.ResourceManager.CognitiveServices.Models.RaiPolicyContentSource right) { throw null; } + public static implicit operator Azure.ResourceManager.CognitiveServices.Models.RaiPolicyContentSource (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.CognitiveServices.Models.RaiPolicyContentSource left, Azure.ResourceManager.CognitiveServices.Models.RaiPolicyContentSource right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct RaiPolicyMode : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public RaiPolicyMode(string value) { throw null; } + public static Azure.ResourceManager.CognitiveServices.Models.RaiPolicyMode Blocking { get { throw null; } } + public static Azure.ResourceManager.CognitiveServices.Models.RaiPolicyMode Default { get { throw null; } } + public static Azure.ResourceManager.CognitiveServices.Models.RaiPolicyMode Deferred { get { throw null; } } + public bool Equals(Azure.ResourceManager.CognitiveServices.Models.RaiPolicyMode other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.CognitiveServices.Models.RaiPolicyMode left, Azure.ResourceManager.CognitiveServices.Models.RaiPolicyMode right) { throw null; } + public static implicit operator Azure.ResourceManager.CognitiveServices.Models.RaiPolicyMode (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.CognitiveServices.Models.RaiPolicyMode left, Azure.ResourceManager.CognitiveServices.Models.RaiPolicyMode right) { throw null; } + public override string ToString() { throw null; } + } + public partial class RaiPolicyProperties + { + public RaiPolicyProperties() { } + public string BasePolicyName { get { throw null; } set { } } + public System.Collections.Generic.IList CompletionBlocklists { get { throw null; } } + public System.Collections.Generic.IList ContentFilters { get { throw null; } } + public Azure.ResourceManager.CognitiveServices.Models.RaiPolicyMode? Mode { get { throw null; } set { } } + public Azure.ResourceManager.CognitiveServices.Models.RaiPolicyType? PolicyType { get { throw null; } } + public System.Collections.Generic.IList PromptBlocklists { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct RaiPolicyType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public RaiPolicyType(string value) { throw null; } + public static Azure.ResourceManager.CognitiveServices.Models.RaiPolicyType SystemManaged { get { throw null; } } + public static Azure.ResourceManager.CognitiveServices.Models.RaiPolicyType UserManaged { get { throw null; } } + public bool Equals(Azure.ResourceManager.CognitiveServices.Models.RaiPolicyType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.CognitiveServices.Models.RaiPolicyType left, Azure.ResourceManager.CognitiveServices.Models.RaiPolicyType right) { throw null; } + public static implicit operator Azure.ResourceManager.CognitiveServices.Models.RaiPolicyType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.CognitiveServices.Models.RaiPolicyType left, Azure.ResourceManager.CognitiveServices.Models.RaiPolicyType right) { throw null; } + public override string ToString() { throw null; } + } public partial class RegenerateServiceAccountKeyContent { public RegenerateServiceAccountKeyContent(Azure.ResourceManager.CognitiveServices.Models.ServiceAccountKeyName keyName) { } @@ -1214,4 +1645,17 @@ public ServiceAccountUserOwnedStorage() { } public System.Guid? IdentityClientId { get { throw null; } set { } } public Azure.Core.ResourceIdentifier ResourceId { get { throw null; } set { } } } + public partial class SkuResource + { + internal SkuResource() { } + public Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesCapacityConfig Capacity { get { throw null; } } + public string ResourceType { get { throw null; } } + public Azure.ResourceManager.CognitiveServices.Models.CognitiveServicesSku Sku { get { throw null; } } + } + public partial class UserOwnedAmlWorkspace + { + public UserOwnedAmlWorkspace() { } + public System.Guid? IdentityClientId { get { throw null; } set { } } + public string ResourceId { get { throw null; } set { } } + } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesAccountCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesAccountCollection.cs index bea8d68217a34..1f746a6f86e61 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesAccountCollection.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesAccountCollection.cs @@ -25,7 +25,7 @@ public partial class Sample_CognitiveServicesAccountCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_CreateAccount() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/CreateAccount.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/CreateAccount.json // this example is just showing the usage of "Accounts_Create" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -86,7 +86,7 @@ public async Task CreateOrUpdate_CreateAccount() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_CreateAccountMin() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/CreateAccountMin.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/CreateAccountMin.json // this example is just showing the usage of "Accounts_Create" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -128,7 +128,7 @@ public async Task CreateOrUpdate_CreateAccountMin() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAccount() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetAccount.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetAccount.json // this example is just showing the usage of "Accounts_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -162,7 +162,7 @@ public async Task Get_GetAccount() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetAccount() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetAccount.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetAccount.json // this example is just showing the usage of "Accounts_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -192,7 +192,7 @@ public async Task Exists_GetAccount() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetAccount() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetAccount.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetAccount.json // this example is just showing the usage of "Accounts_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -234,7 +234,7 @@ public async Task GetIfExists_GetAccount() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListAccountsByResourceGroup() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListAccountsByResourceGroup.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListAccountsByResourceGroup.json // this example is just showing the usage of "Accounts_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesAccountDeploymentCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesAccountDeploymentCollection.cs index ee867f7723765..452ba1d69fb6a 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesAccountDeploymentCollection.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesAccountDeploymentCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_CognitiveServicesAccountDeploymentCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListDeployments() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListDeployments.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListDeployments.json // this example is just showing the usage of "Deployments_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -60,7 +60,7 @@ public async Task GetAll_ListDeployments() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetDeployment() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetDeployment.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetDeployment.json // this example is just showing the usage of "Deployments_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -95,7 +95,7 @@ public async Task Get_GetDeployment() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetDeployment() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetDeployment.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetDeployment.json // this example is just showing the usage of "Deployments_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -126,7 +126,7 @@ public async Task Exists_GetDeployment() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetDeployment() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetDeployment.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetDeployment.json // this example is just showing the usage of "Deployments_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -169,7 +169,7 @@ public async Task GetIfExists_GetDeployment() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_PutDeployment() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/PutDeployment.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/PutDeployment.json // this example is just showing the usage of "Deployments_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -192,6 +192,10 @@ public async Task CreateOrUpdate_PutDeployment() string deploymentName = "deploymentName"; CognitiveServicesAccountDeploymentData data = new CognitiveServicesAccountDeploymentData() { + Sku = new CognitiveServicesSku("Standard") + { + Capacity = 1, + }, Properties = new CognitiveServicesAccountDeploymentProperties() { Model = new CognitiveServicesAccountDeploymentModel() @@ -200,11 +204,6 @@ public async Task CreateOrUpdate_PutDeployment() Name = "ada", Version = "1", }, - ScaleSettings = new CognitiveServicesAccountDeploymentScaleSettings() - { - ScaleType = CognitiveServicesAccountDeploymentScaleType.Manual, - Capacity = 1, - }, }, }; ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, deploymentName, data); diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesAccountDeploymentResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesAccountDeploymentResource.cs index c914906f3ba03..1df18b5c0e4e6 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesAccountDeploymentResource.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesAccountDeploymentResource.cs @@ -23,7 +23,7 @@ public partial class Sample_CognitiveServicesAccountDeploymentResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetDeployment() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetDeployment.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetDeployment.json // this example is just showing the usage of "Deployments_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -50,13 +50,13 @@ public async Task Get_GetDeployment() Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } - // PutDeployment + // UpdateDeployment [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Update_PutDeployment() + public async Task Update_UpdateDeployment() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/PutDeployment.json - // this example is just showing the usage of "Deployments_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/UpdateDeployment.json + // this example is just showing the usage of "Deployments_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -65,7 +65,7 @@ public async Task Update_PutDeployment() // this example assumes you already have this CognitiveServicesAccountDeploymentResource created on azure // for more information of creating CognitiveServicesAccountDeploymentResource, please refer to the document of CognitiveServicesAccountDeploymentResource - string subscriptionId = "subscriptionId"; + string subscriptionId = "00000000-0000-0000-0000-000000000000"; string resourceGroupName = "resourceGroupName"; string accountName = "accountName"; string deploymentName = "deploymentName"; @@ -73,24 +73,14 @@ public async Task Update_PutDeployment() CognitiveServicesAccountDeploymentResource cognitiveServicesAccountDeployment = client.GetCognitiveServicesAccountDeploymentResource(cognitiveServicesAccountDeploymentResourceId); // invoke the operation - CognitiveServicesAccountDeploymentData data = new CognitiveServicesAccountDeploymentData() + PatchResourceTagsAndSku deployment = new PatchResourceTagsAndSku() { - Properties = new CognitiveServicesAccountDeploymentProperties() + Sku = new CognitiveServicesSku("Standard") { - Model = new CognitiveServicesAccountDeploymentModel() - { - Format = "OpenAI", - Name = "ada", - Version = "1", - }, - ScaleSettings = new CognitiveServicesAccountDeploymentScaleSettings() - { - ScaleType = CognitiveServicesAccountDeploymentScaleType.Manual, - Capacity = 1, - }, + Capacity = 1, }, }; - ArmOperation lro = await cognitiveServicesAccountDeployment.UpdateAsync(WaitUntil.Completed, data); + ArmOperation lro = await cognitiveServicesAccountDeployment.UpdateAsync(WaitUntil.Completed, deployment); CognitiveServicesAccountDeploymentResource result = lro.Value; // the variable result is a resource, you could call other operations on this instance as well @@ -105,7 +95,7 @@ public async Task Update_PutDeployment() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_DeleteDeployment() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/DeleteDeployment.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/DeleteDeployment.json // this example is just showing the usage of "Deployments_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -127,5 +117,36 @@ public async Task Delete_DeleteDeployment() Console.WriteLine($"Succeeded"); } + + // ListDeploymentSkus + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetSkus_ListDeploymentSkus() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListDeploymentSkus.json + // this example is just showing the usage of "Deployments_ListSkus" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CognitiveServicesAccountDeploymentResource created on azure + // for more information of creating CognitiveServicesAccountDeploymentResource, please refer to the document of CognitiveServicesAccountDeploymentResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resourceGroupName"; + string accountName = "accountName"; + string deploymentName = "deploymentName"; + ResourceIdentifier cognitiveServicesAccountDeploymentResourceId = CognitiveServicesAccountDeploymentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, deploymentName); + CognitiveServicesAccountDeploymentResource cognitiveServicesAccountDeployment = client.GetCognitiveServicesAccountDeploymentResource(cognitiveServicesAccountDeploymentResourceId); + + // invoke the operation and iterate over the result + await foreach (SkuResource item in cognitiveServicesAccountDeployment.GetSkusAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesAccountResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesAccountResource.cs index 4f6b37db91cca..bcda84fabef1c 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesAccountResource.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesAccountResource.cs @@ -24,7 +24,7 @@ public partial class Sample_CognitiveServicesAccountResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_UpdateAccount() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/UpdateAccount.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/UpdateAccount.json // this example is just showing the usage of "Accounts_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -60,7 +60,7 @@ public async Task Update_UpdateAccount() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_DeleteAccount() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/DeleteAccount.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/DeleteAccount.json // this example is just showing the usage of "Accounts_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -87,7 +87,7 @@ public async Task Delete_DeleteAccount() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAccount() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetAccount.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetAccount.json // this example is just showing the usage of "Accounts_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -118,7 +118,7 @@ public async Task Get_GetAccount() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetCognitiveServicesAccounts_ListAccountsBySubscription() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListAccountsBySubscription.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListAccountsBySubscription.json // this example is just showing the usage of "Accounts_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -150,7 +150,7 @@ public async Task GetCognitiveServicesAccounts_ListAccountsBySubscription() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetKeys_ListKeys() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListKeys.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListKeys.json // this example is just showing the usage of "Accounts_ListKeys" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -177,7 +177,7 @@ public async Task GetKeys_ListKeys() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task RegenerateKey_RegenerateKeys() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/RegenerateKey.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/RegenerateKey.json // this example is just showing the usage of "Accounts_RegenerateKey" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -205,7 +205,7 @@ public async Task RegenerateKey_RegenerateKeys() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetSkus_ListSKUs() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListSkus.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListSkus.json // this example is just showing the usage of "Accounts_ListSkus" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -235,7 +235,7 @@ public async Task GetSkus_ListSKUs() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetUsages_GetUsages() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetUsages.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetUsages.json // this example is just showing the usage of "Accounts_ListUsages" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -265,7 +265,7 @@ public async Task GetUsages_GetUsages() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetModels_ListAccountModels() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListAccountModels.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListAccountModels.json // this example is just showing the usage of "Accounts_ListModels" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -295,7 +295,7 @@ public async Task GetModels_ListAccountModels() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetPrivateLinkResources_ListPrivateLinkResources() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListPrivateLinkResources.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListPrivateLinkResources.json // this example is just showing the usage of "PrivateLinkResources_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesCommitmentPlanCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesCommitmentPlanCollection.cs index e33766fb87d24..2b175b5ca0dd3 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesCommitmentPlanCollection.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesCommitmentPlanCollection.cs @@ -24,7 +24,7 @@ public partial class Sample_CognitiveServicesCommitmentPlanCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_CreateCommitmentPlan() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/CreateSharedCommitmentPlan.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/CreateSharedCommitmentPlan.json // this example is just showing the usage of "CommitmentPlans_CreateOrUpdatePlan" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -75,7 +75,7 @@ public async Task CreateOrUpdate_CreateCommitmentPlan() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetCommitmentPlan() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetSharedCommitmentPlan.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetSharedCommitmentPlan.json // this example is just showing the usage of "CommitmentPlans_GetPlan" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -109,7 +109,7 @@ public async Task Get_GetCommitmentPlan() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetCommitmentPlan() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetSharedCommitmentPlan.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetSharedCommitmentPlan.json // this example is just showing the usage of "CommitmentPlans_GetPlan" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -139,7 +139,7 @@ public async Task Exists_GetCommitmentPlan() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetCommitmentPlan() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetSharedCommitmentPlan.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetSharedCommitmentPlan.json // this example is just showing the usage of "CommitmentPlans_GetPlan" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -181,7 +181,7 @@ public async Task GetIfExists_GetCommitmentPlan() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListCommitmentPlansByResourceGroup() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListSharedCommitmentPlansByResourceGroup.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListSharedCommitmentPlansByResourceGroup.json // this example is just showing the usage of "CommitmentPlans_ListPlansByResourceGroup" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesCommitmentPlanResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesCommitmentPlanResource.cs index a7613428d4ebf..8e54e4e8c1ecb 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesCommitmentPlanResource.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesCommitmentPlanResource.cs @@ -24,7 +24,7 @@ public partial class Sample_CognitiveServicesCommitmentPlanResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_CreateCommitmentPlan() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/UpdateSharedCommitmentPlan.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/UpdateSharedCommitmentPlan.json // this example is just showing the usage of "CommitmentPlans_UpdatePlan" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -41,14 +41,14 @@ public async Task Update_CreateCommitmentPlan() CognitiveServicesCommitmentPlanResource cognitiveServicesCommitmentPlan = client.GetCognitiveServicesCommitmentPlanResource(cognitiveServicesCommitmentPlanResourceId); // invoke the operation - CognitiveServicesCommitmentPlanPatch patch = new CognitiveServicesCommitmentPlanPatch() + PatchResourceTagsAndSku commitmentPlan = new PatchResourceTagsAndSku() { Tags = { ["name"] = "value", }, }; - ArmOperation lro = await cognitiveServicesCommitmentPlan.UpdateAsync(WaitUntil.Completed, patch); + ArmOperation lro = await cognitiveServicesCommitmentPlan.UpdateAsync(WaitUntil.Completed, commitmentPlan); CognitiveServicesCommitmentPlanResource result = lro.Value; // the variable result is a resource, you could call other operations on this instance as well @@ -63,7 +63,7 @@ public async Task Update_CreateCommitmentPlan() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_DeleteCommitmentPlan() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/DeleteSharedCommitmentPlan.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/DeleteSharedCommitmentPlan.json // this example is just showing the usage of "CommitmentPlans_DeletePlan" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -90,7 +90,7 @@ public async Task Delete_DeleteCommitmentPlan() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetCommitmentPlan() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetSharedCommitmentPlan.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetSharedCommitmentPlan.json // this example is just showing the usage of "CommitmentPlans_GetPlan" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -121,7 +121,7 @@ public async Task Get_GetCommitmentPlan() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetCognitiveServicesCommitmentPlans_ListAccountsBySubscription() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListSharedCommitmentPlansBySubscription.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListSharedCommitmentPlansBySubscription.json // this example is just showing the usage of "CommitmentPlans_ListPlansBySubscription" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesDeletedAccountCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesDeletedAccountCollection.cs index 06144ff0cd04e..86ef244307a92 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesDeletedAccountCollection.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesDeletedAccountCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_CognitiveServicesDeletedAccountCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAccount() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetDeletedAccount.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetDeletedAccount.json // this example is just showing the usage of "DeletedAccounts_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -58,7 +58,7 @@ public async Task Get_GetAccount() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetAccount() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetDeletedAccount.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetDeletedAccount.json // this example is just showing the usage of "DeletedAccounts_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -89,7 +89,7 @@ public async Task Exists_GetAccount() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetAccount() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetDeletedAccount.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetDeletedAccount.json // this example is just showing the usage of "DeletedAccounts_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesDeletedAccountResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesDeletedAccountResource.cs index 377e756e2e701..8dbf6e174d337 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesDeletedAccountResource.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesDeletedAccountResource.cs @@ -23,7 +23,7 @@ public partial class Sample_CognitiveServicesDeletedAccountResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAccount() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetDeletedAccount.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetDeletedAccount.json // this example is just showing the usage of "DeletedAccounts_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -55,7 +55,7 @@ public async Task Get_GetAccount() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_DeleteAccount() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/PurgeDeletedAccount.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/PurgeDeletedAccount.json // this example is just showing the usage of "DeletedAccounts_Purge" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -83,7 +83,7 @@ public async Task Delete_DeleteAccount() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetDeletedAccounts_ListDeletedAccountsBySubscription() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListDeletedAccountsBySubscription.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListDeletedAccountsBySubscription.json // this example is just showing the usage of "DeletedAccounts_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesPrivateEndpointConnectionCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesPrivateEndpointConnectionCollection.cs index 2d76ff2ab24c8..1d3a8af2a2cce 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesPrivateEndpointConnectionCollection.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesPrivateEndpointConnectionCollection.cs @@ -22,7 +22,7 @@ public partial class Sample_CognitiveServicesPrivateEndpointConnectionCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_GetPrivateEndpointConnection() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListPrivateEndpointConnections.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListPrivateEndpointConnections.json // this example is just showing the usage of "PrivateEndpointConnections_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -59,7 +59,7 @@ public async Task GetAll_GetPrivateEndpointConnection() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetPrivateEndpointConnection() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetPrivateEndpointConnection.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetPrivateEndpointConnection.json // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -94,7 +94,7 @@ public async Task Get_GetPrivateEndpointConnection() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetPrivateEndpointConnection() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetPrivateEndpointConnection.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetPrivateEndpointConnection.json // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -125,7 +125,7 @@ public async Task Exists_GetPrivateEndpointConnection() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetPrivateEndpointConnection() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetPrivateEndpointConnection.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetPrivateEndpointConnection.json // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesPrivateEndpointConnectionResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesPrivateEndpointConnectionResource.cs index 62b4fdf67a1ad..292acd52aed8d 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesPrivateEndpointConnectionResource.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CognitiveServicesPrivateEndpointConnectionResource.cs @@ -22,7 +22,7 @@ public partial class Sample_CognitiveServicesPrivateEndpointConnectionResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetPrivateEndpointConnection() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetPrivateEndpointConnection.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetPrivateEndpointConnection.json // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -54,7 +54,7 @@ public async Task Get_GetPrivateEndpointConnection() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_DeletePrivateEndpointConnection() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/DeletePrivateEndpointConnection.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/DeletePrivateEndpointConnection.json // this example is just showing the usage of "PrivateEndpointConnections_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CommitmentPlanAccountAssociationCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CommitmentPlanAccountAssociationCollection.cs index 704a0fd33b562..b50f3a8ad1e92 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CommitmentPlanAccountAssociationCollection.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CommitmentPlanAccountAssociationCollection.cs @@ -22,7 +22,7 @@ public partial class Sample_CommitmentPlanAccountAssociationCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListCommitmentPlans() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListSharedCommitmentPlanAssociations.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListSharedCommitmentPlanAssociations.json // this example is just showing the usage of "CommitmentPlans_ListAssociations" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -59,7 +59,7 @@ public async Task GetAll_ListCommitmentPlans() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetCommitmentPlan() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetSharedCommitmentPlanAssociation.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetSharedCommitmentPlanAssociation.json // this example is just showing the usage of "CommitmentPlans_GetAssociation" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -94,7 +94,7 @@ public async Task Get_GetCommitmentPlan() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetCommitmentPlan() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetSharedCommitmentPlanAssociation.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetSharedCommitmentPlanAssociation.json // this example is just showing the usage of "CommitmentPlans_GetAssociation" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -125,7 +125,7 @@ public async Task Exists_GetCommitmentPlan() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetCommitmentPlan() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetSharedCommitmentPlanAssociation.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetSharedCommitmentPlanAssociation.json // this example is just showing the usage of "CommitmentPlans_GetAssociation" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -168,7 +168,7 @@ public async Task GetIfExists_GetCommitmentPlan() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_PutCommitmentPlan() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/CreateSharedCommitmentPlanAssociation.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/CreateSharedCommitmentPlanAssociation.json // this example is just showing the usage of "CommitmentPlans_CreateOrUpdateAssociation" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CommitmentPlanAccountAssociationResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CommitmentPlanAccountAssociationResource.cs index ae1a67fd630e8..454da7a798485 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CommitmentPlanAccountAssociationResource.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CommitmentPlanAccountAssociationResource.cs @@ -22,7 +22,7 @@ public partial class Sample_CommitmentPlanAccountAssociationResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetCommitmentPlan() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetSharedCommitmentPlanAssociation.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetSharedCommitmentPlanAssociation.json // this example is just showing the usage of "CommitmentPlans_GetAssociation" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -54,7 +54,7 @@ public async Task Get_GetCommitmentPlan() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_PutCommitmentPlan() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/CreateSharedCommitmentPlanAssociation.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/CreateSharedCommitmentPlanAssociation.json // this example is just showing the usage of "CommitmentPlans_CreateOrUpdateAssociation" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -91,7 +91,7 @@ public async Task Update_PutCommitmentPlan() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_DeleteCommitmentPlan() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/DeleteSharedCommitmentPlanAssociation.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/DeleteSharedCommitmentPlanAssociation.json // this example is just showing the usage of "CommitmentPlans_DeleteAssociation" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CommitmentPlanCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CommitmentPlanCollection.cs index 700444d5315ef..d5a792e86b998 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CommitmentPlanCollection.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CommitmentPlanCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_CommitmentPlanCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListCommitmentPlans() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListCommitmentPlans.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListCommitmentPlans.json // this example is just showing the usage of "CommitmentPlans_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -60,7 +60,7 @@ public async Task GetAll_ListCommitmentPlans() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetCommitmentPlan() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetCommitmentPlan.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetCommitmentPlan.json // this example is just showing the usage of "CommitmentPlans_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -95,7 +95,7 @@ public async Task Get_GetCommitmentPlan() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetCommitmentPlan() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetCommitmentPlan.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetCommitmentPlan.json // this example is just showing the usage of "CommitmentPlans_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -126,7 +126,7 @@ public async Task Exists_GetCommitmentPlan() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetCommitmentPlan() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetCommitmentPlan.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetCommitmentPlan.json // this example is just showing the usage of "CommitmentPlans_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -169,7 +169,7 @@ public async Task GetIfExists_GetCommitmentPlan() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_PutCommitmentPlan() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/PutCommitmentPlan.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/PutCommitmentPlan.json // this example is just showing the usage of "CommitmentPlans_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CommitmentPlanResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CommitmentPlanResource.cs index f9137bca5da15..beff98f333ba3 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CommitmentPlanResource.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_CommitmentPlanResource.cs @@ -23,7 +23,7 @@ public partial class Sample_CommitmentPlanResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetCommitmentPlan() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetCommitmentPlan.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetCommitmentPlan.json // this example is just showing the usage of "CommitmentPlans_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -55,7 +55,7 @@ public async Task Get_GetCommitmentPlan() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_PutCommitmentPlan() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/PutCommitmentPlan.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/PutCommitmentPlan.json // this example is just showing the usage of "CommitmentPlans_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -101,7 +101,7 @@ public async Task Update_PutCommitmentPlan() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_DeleteCommitmentPlan() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/DeleteCommitmentPlan.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/DeleteCommitmentPlan.json // this example is just showing the usage of "CommitmentPlans_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_EncryptionScopeCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_EncryptionScopeCollection.cs new file mode 100644 index 0000000000000..5edde5cdcc643 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_EncryptionScopeCollection.cs @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CognitiveServices; +using Azure.ResourceManager.CognitiveServices.Models; + +namespace Azure.ResourceManager.CognitiveServices.Samples +{ + public partial class Sample_EncryptionScopeCollection + { + // ListEncryptionScopes + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListEncryptionScopes() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListEncryptionScopes.json + // this example is just showing the usage of "EncryptionScopes_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CognitiveServicesAccountResource created on azure + // for more information of creating CognitiveServicesAccountResource, please refer to the document of CognitiveServicesAccountResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resourceGroupName"; + string accountName = "accountName"; + ResourceIdentifier cognitiveServicesAccountResourceId = CognitiveServicesAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CognitiveServicesAccountResource cognitiveServicesAccount = client.GetCognitiveServicesAccountResource(cognitiveServicesAccountResourceId); + + // get the collection of this EncryptionScopeResource + EncryptionScopeCollection collection = cognitiveServicesAccount.GetEncryptionScopes(); + + // invoke the operation and iterate over the result + await foreach (EncryptionScopeResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + EncryptionScopeData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // GetEncryptionScope + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetEncryptionScope() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetEncryptionScope.json + // this example is just showing the usage of "EncryptionScopes_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CognitiveServicesAccountResource created on azure + // for more information of creating CognitiveServicesAccountResource, please refer to the document of CognitiveServicesAccountResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resourceGroupName"; + string accountName = "accountName"; + ResourceIdentifier cognitiveServicesAccountResourceId = CognitiveServicesAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CognitiveServicesAccountResource cognitiveServicesAccount = client.GetCognitiveServicesAccountResource(cognitiveServicesAccountResourceId); + + // get the collection of this EncryptionScopeResource + EncryptionScopeCollection collection = cognitiveServicesAccount.GetEncryptionScopes(); + + // invoke the operation + string encryptionScopeName = "encryptionScopeName"; + EncryptionScopeResource result = await collection.GetAsync(encryptionScopeName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + EncryptionScopeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GetEncryptionScope + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetEncryptionScope() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetEncryptionScope.json + // this example is just showing the usage of "EncryptionScopes_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CognitiveServicesAccountResource created on azure + // for more information of creating CognitiveServicesAccountResource, please refer to the document of CognitiveServicesAccountResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resourceGroupName"; + string accountName = "accountName"; + ResourceIdentifier cognitiveServicesAccountResourceId = CognitiveServicesAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CognitiveServicesAccountResource cognitiveServicesAccount = client.GetCognitiveServicesAccountResource(cognitiveServicesAccountResourceId); + + // get the collection of this EncryptionScopeResource + EncryptionScopeCollection collection = cognitiveServicesAccount.GetEncryptionScopes(); + + // invoke the operation + string encryptionScopeName = "encryptionScopeName"; + bool result = await collection.ExistsAsync(encryptionScopeName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // GetEncryptionScope + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetEncryptionScope() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetEncryptionScope.json + // this example is just showing the usage of "EncryptionScopes_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CognitiveServicesAccountResource created on azure + // for more information of creating CognitiveServicesAccountResource, please refer to the document of CognitiveServicesAccountResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resourceGroupName"; + string accountName = "accountName"; + ResourceIdentifier cognitiveServicesAccountResourceId = CognitiveServicesAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CognitiveServicesAccountResource cognitiveServicesAccount = client.GetCognitiveServicesAccountResource(cognitiveServicesAccountResourceId); + + // get the collection of this EncryptionScopeResource + EncryptionScopeCollection collection = cognitiveServicesAccount.GetEncryptionScopes(); + + // invoke the operation + string encryptionScopeName = "encryptionScopeName"; + NullableResponse response = await collection.GetIfExistsAsync(encryptionScopeName); + EncryptionScopeResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + EncryptionScopeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // PutEncryptionScope + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_PutEncryptionScope() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/PutEncryptionScope.json + // this example is just showing the usage of "EncryptionScopes_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CognitiveServicesAccountResource created on azure + // for more information of creating CognitiveServicesAccountResource, please refer to the document of CognitiveServicesAccountResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resourceGroupName"; + string accountName = "accountName"; + ResourceIdentifier cognitiveServicesAccountResourceId = CognitiveServicesAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CognitiveServicesAccountResource cognitiveServicesAccount = client.GetCognitiveServicesAccountResource(cognitiveServicesAccountResourceId); + + // get the collection of this EncryptionScopeResource + EncryptionScopeCollection collection = cognitiveServicesAccount.GetEncryptionScopes(); + + // invoke the operation + string encryptionScopeName = "encryptionScopeName"; + EncryptionScopeData data = new EncryptionScopeData() + { + Properties = new EncryptionScopeProperties() + { + State = EncryptionScopeState.Enabled, + KeyVaultProperties = new CognitiveServicesKeyVaultProperties() + { + KeyName = "DevKeyWestUS2", + KeyVersion = "9f85549d7bf14ff4bf178c10d3bdca95", + KeyVaultUri = new Uri("https://devkvwestus2.vault.azure.net/"), + IdentityClientId = Guid.Parse("00000000-0000-0000-0000-000000000000"), + }, + KeySource = ServiceAccountEncryptionKeySource.MicrosoftKeyVault, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, encryptionScopeName, data); + EncryptionScopeResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + EncryptionScopeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_EncryptionScopeResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_EncryptionScopeResource.cs new file mode 100644 index 0000000000000..cfe83b9abfab2 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_EncryptionScopeResource.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CognitiveServices; +using Azure.ResourceManager.CognitiveServices.Models; + +namespace Azure.ResourceManager.CognitiveServices.Samples +{ + public partial class Sample_EncryptionScopeResource + { + // GetEncryptionScope + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetEncryptionScope() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetEncryptionScope.json + // this example is just showing the usage of "EncryptionScopes_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this EncryptionScopeResource created on azure + // for more information of creating EncryptionScopeResource, please refer to the document of EncryptionScopeResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resourceGroupName"; + string accountName = "accountName"; + string encryptionScopeName = "encryptionScopeName"; + ResourceIdentifier encryptionScopeResourceId = EncryptionScopeResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, encryptionScopeName); + EncryptionScopeResource encryptionScope = client.GetEncryptionScopeResource(encryptionScopeResourceId); + + // invoke the operation + EncryptionScopeResource result = await encryptionScope.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + EncryptionScopeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // PutEncryptionScope + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_PutEncryptionScope() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/PutEncryptionScope.json + // this example is just showing the usage of "EncryptionScopes_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this EncryptionScopeResource created on azure + // for more information of creating EncryptionScopeResource, please refer to the document of EncryptionScopeResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resourceGroupName"; + string accountName = "accountName"; + string encryptionScopeName = "encryptionScopeName"; + ResourceIdentifier encryptionScopeResourceId = EncryptionScopeResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, encryptionScopeName); + EncryptionScopeResource encryptionScope = client.GetEncryptionScopeResource(encryptionScopeResourceId); + + // invoke the operation + EncryptionScopeData data = new EncryptionScopeData() + { + Properties = new EncryptionScopeProperties() + { + State = EncryptionScopeState.Enabled, + KeyVaultProperties = new CognitiveServicesKeyVaultProperties() + { + KeyName = "DevKeyWestUS2", + KeyVersion = "9f85549d7bf14ff4bf178c10d3bdca95", + KeyVaultUri = new Uri("https://devkvwestus2.vault.azure.net/"), + IdentityClientId = Guid.Parse("00000000-0000-0000-0000-000000000000"), + }, + KeySource = ServiceAccountEncryptionKeySource.MicrosoftKeyVault, + }, + }; + ArmOperation lro = await encryptionScope.UpdateAsync(WaitUntil.Completed, data); + EncryptionScopeResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + EncryptionScopeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // DeleteEncryptionScope + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteEncryptionScope() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/DeleteEncryptionScope.json + // this example is just showing the usage of "EncryptionScopes_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this EncryptionScopeResource created on azure + // for more information of creating EncryptionScopeResource, please refer to the document of EncryptionScopeResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resourceGroupName"; + string accountName = "accountName"; + string encryptionScopeName = "encryptionScopeName"; + ResourceIdentifier encryptionScopeResourceId = EncryptionScopeResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, encryptionScopeName); + EncryptionScopeResource encryptionScope = client.GetEncryptionScopeResource(encryptionScopeResourceId); + + // invoke the operation + await encryptionScope.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_RaiBlocklistCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_RaiBlocklistCollection.cs new file mode 100644 index 0000000000000..86bc040f86214 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_RaiBlocklistCollection.cs @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CognitiveServices; + +namespace Azure.ResourceManager.CognitiveServices.Samples +{ + public partial class Sample_RaiBlocklistCollection + { + // ListBlocklists + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListBlocklists() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListBlocklists.json + // this example is just showing the usage of "RaiBlocklists_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CognitiveServicesAccountResource created on azure + // for more information of creating CognitiveServicesAccountResource, please refer to the document of CognitiveServicesAccountResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resourceGroupName"; + string accountName = "accountName"; + ResourceIdentifier cognitiveServicesAccountResourceId = CognitiveServicesAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CognitiveServicesAccountResource cognitiveServicesAccount = client.GetCognitiveServicesAccountResource(cognitiveServicesAccountResourceId); + + // get the collection of this RaiBlocklistResource + RaiBlocklistCollection collection = cognitiveServicesAccount.GetRaiBlocklists(); + + // invoke the operation and iterate over the result + await foreach (RaiBlocklistResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RaiBlocklistData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // GetRaiBlocklist + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetRaiBlocklist() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetRaiBlocklist.json + // this example is just showing the usage of "RaiBlocklists_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CognitiveServicesAccountResource created on azure + // for more information of creating CognitiveServicesAccountResource, please refer to the document of CognitiveServicesAccountResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resourceGroupName"; + string accountName = "accountName"; + ResourceIdentifier cognitiveServicesAccountResourceId = CognitiveServicesAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CognitiveServicesAccountResource cognitiveServicesAccount = client.GetCognitiveServicesAccountResource(cognitiveServicesAccountResourceId); + + // get the collection of this RaiBlocklistResource + RaiBlocklistCollection collection = cognitiveServicesAccount.GetRaiBlocklists(); + + // invoke the operation + string raiBlocklistName = "raiBlocklistName"; + RaiBlocklistResource result = await collection.GetAsync(raiBlocklistName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RaiBlocklistData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GetRaiBlocklist + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetRaiBlocklist() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetRaiBlocklist.json + // this example is just showing the usage of "RaiBlocklists_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CognitiveServicesAccountResource created on azure + // for more information of creating CognitiveServicesAccountResource, please refer to the document of CognitiveServicesAccountResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resourceGroupName"; + string accountName = "accountName"; + ResourceIdentifier cognitiveServicesAccountResourceId = CognitiveServicesAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CognitiveServicesAccountResource cognitiveServicesAccount = client.GetCognitiveServicesAccountResource(cognitiveServicesAccountResourceId); + + // get the collection of this RaiBlocklistResource + RaiBlocklistCollection collection = cognitiveServicesAccount.GetRaiBlocklists(); + + // invoke the operation + string raiBlocklistName = "raiBlocklistName"; + bool result = await collection.ExistsAsync(raiBlocklistName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // GetRaiBlocklist + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetRaiBlocklist() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetRaiBlocklist.json + // this example is just showing the usage of "RaiBlocklists_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CognitiveServicesAccountResource created on azure + // for more information of creating CognitiveServicesAccountResource, please refer to the document of CognitiveServicesAccountResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resourceGroupName"; + string accountName = "accountName"; + ResourceIdentifier cognitiveServicesAccountResourceId = CognitiveServicesAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CognitiveServicesAccountResource cognitiveServicesAccount = client.GetCognitiveServicesAccountResource(cognitiveServicesAccountResourceId); + + // get the collection of this RaiBlocklistResource + RaiBlocklistCollection collection = cognitiveServicesAccount.GetRaiBlocklists(); + + // invoke the operation + string raiBlocklistName = "raiBlocklistName"; + NullableResponse response = await collection.GetIfExistsAsync(raiBlocklistName); + RaiBlocklistResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RaiBlocklistData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // PutRaiBlocklist + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_PutRaiBlocklist() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/PutRaiBlocklist.json + // this example is just showing the usage of "RaiBlocklists_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CognitiveServicesAccountResource created on azure + // for more information of creating CognitiveServicesAccountResource, please refer to the document of CognitiveServicesAccountResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resourceGroupName"; + string accountName = "accountName"; + ResourceIdentifier cognitiveServicesAccountResourceId = CognitiveServicesAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CognitiveServicesAccountResource cognitiveServicesAccount = client.GetCognitiveServicesAccountResource(cognitiveServicesAccountResourceId); + + // get the collection of this RaiBlocklistResource + RaiBlocklistCollection collection = cognitiveServicesAccount.GetRaiBlocklists(); + + // invoke the operation + string raiBlocklistName = "raiBlocklistName"; + RaiBlocklistData data = new RaiBlocklistData() + { + RaiBlocklistDescription = "Basic blocklist description", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, raiBlocklistName, data); + RaiBlocklistResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RaiBlocklistData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_RaiBlocklistItemCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_RaiBlocklistItemCollection.cs new file mode 100644 index 0000000000000..000158d5cf58c --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_RaiBlocklistItemCollection.cs @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CognitiveServices; +using Azure.ResourceManager.CognitiveServices.Models; + +namespace Azure.ResourceManager.CognitiveServices.Samples +{ + public partial class Sample_RaiBlocklistItemCollection + { + // ListBlocklistItems + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListBlocklistItems() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListBlocklistItems.json + // this example is just showing the usage of "RaiBlocklistItems_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RaiBlocklistResource created on azure + // for more information of creating RaiBlocklistResource, please refer to the document of RaiBlocklistResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resourceGroupName"; + string accountName = "accountName"; + string raiBlocklistName = "raiBlocklistName"; + ResourceIdentifier raiBlocklistResourceId = RaiBlocklistResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, raiBlocklistName); + RaiBlocklistResource raiBlocklist = client.GetRaiBlocklistResource(raiBlocklistResourceId); + + // get the collection of this RaiBlocklistItemResource + RaiBlocklistItemCollection collection = raiBlocklist.GetRaiBlocklistItems(); + + // invoke the operation and iterate over the result + await foreach (RaiBlocklistItemResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RaiBlocklistItemData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // GetRaiBlocklistItem + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetRaiBlocklistItem() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetRaiBlocklistItem.json + // this example is just showing the usage of "RaiBlocklistItems_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RaiBlocklistResource created on azure + // for more information of creating RaiBlocklistResource, please refer to the document of RaiBlocklistResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resourceGroupName"; + string accountName = "accountName"; + string raiBlocklistName = "raiBlocklistName"; + ResourceIdentifier raiBlocklistResourceId = RaiBlocklistResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, raiBlocklistName); + RaiBlocklistResource raiBlocklist = client.GetRaiBlocklistResource(raiBlocklistResourceId); + + // get the collection of this RaiBlocklistItemResource + RaiBlocklistItemCollection collection = raiBlocklist.GetRaiBlocklistItems(); + + // invoke the operation + string raiBlocklistItemName = "raiBlocklistItemName"; + RaiBlocklistItemResource result = await collection.GetAsync(raiBlocklistItemName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RaiBlocklistItemData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GetRaiBlocklistItem + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetRaiBlocklistItem() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetRaiBlocklistItem.json + // this example is just showing the usage of "RaiBlocklistItems_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RaiBlocklistResource created on azure + // for more information of creating RaiBlocklistResource, please refer to the document of RaiBlocklistResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resourceGroupName"; + string accountName = "accountName"; + string raiBlocklistName = "raiBlocklistName"; + ResourceIdentifier raiBlocklistResourceId = RaiBlocklistResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, raiBlocklistName); + RaiBlocklistResource raiBlocklist = client.GetRaiBlocklistResource(raiBlocklistResourceId); + + // get the collection of this RaiBlocklistItemResource + RaiBlocklistItemCollection collection = raiBlocklist.GetRaiBlocklistItems(); + + // invoke the operation + string raiBlocklistItemName = "raiBlocklistItemName"; + bool result = await collection.ExistsAsync(raiBlocklistItemName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // GetRaiBlocklistItem + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetRaiBlocklistItem() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetRaiBlocklistItem.json + // this example is just showing the usage of "RaiBlocklistItems_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RaiBlocklistResource created on azure + // for more information of creating RaiBlocklistResource, please refer to the document of RaiBlocklistResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resourceGroupName"; + string accountName = "accountName"; + string raiBlocklistName = "raiBlocklistName"; + ResourceIdentifier raiBlocklistResourceId = RaiBlocklistResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, raiBlocklistName); + RaiBlocklistResource raiBlocklist = client.GetRaiBlocklistResource(raiBlocklistResourceId); + + // get the collection of this RaiBlocklistItemResource + RaiBlocklistItemCollection collection = raiBlocklist.GetRaiBlocklistItems(); + + // invoke the operation + string raiBlocklistItemName = "raiBlocklistItemName"; + NullableResponse response = await collection.GetIfExistsAsync(raiBlocklistItemName); + RaiBlocklistItemResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RaiBlocklistItemData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // PutRaiBlocklistItem + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_PutRaiBlocklistItem() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/PutRaiBlocklistItem.json + // this example is just showing the usage of "RaiBlocklistItems_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RaiBlocklistResource created on azure + // for more information of creating RaiBlocklistResource, please refer to the document of RaiBlocklistResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resourceGroupName"; + string accountName = "accountName"; + string raiBlocklistName = "raiBlocklistName"; + ResourceIdentifier raiBlocklistResourceId = RaiBlocklistResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, raiBlocklistName); + RaiBlocklistResource raiBlocklist = client.GetRaiBlocklistResource(raiBlocklistResourceId); + + // get the collection of this RaiBlocklistItemResource + RaiBlocklistItemCollection collection = raiBlocklist.GetRaiBlocklistItems(); + + // invoke the operation + string raiBlocklistItemName = "raiBlocklistItemName"; + RaiBlocklistItemData data = new RaiBlocklistItemData() + { + Properties = new RaiBlocklistItemProperties() + { + Pattern = "Pattern To Block", + IsRegex = false, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, raiBlocklistItemName, data); + RaiBlocklistItemResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RaiBlocklistItemData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_RaiBlocklistItemResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_RaiBlocklistItemResource.cs new file mode 100644 index 0000000000000..ea4107c66590c --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_RaiBlocklistItemResource.cs @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CognitiveServices; +using Azure.ResourceManager.CognitiveServices.Models; + +namespace Azure.ResourceManager.CognitiveServices.Samples +{ + public partial class Sample_RaiBlocklistItemResource + { + // GetRaiBlocklistItem + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetRaiBlocklistItem() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetRaiBlocklistItem.json + // this example is just showing the usage of "RaiBlocklistItems_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RaiBlocklistItemResource created on azure + // for more information of creating RaiBlocklistItemResource, please refer to the document of RaiBlocklistItemResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resourceGroupName"; + string accountName = "accountName"; + string raiBlocklistName = "raiBlocklistName"; + string raiBlocklistItemName = "raiBlocklistItemName"; + ResourceIdentifier raiBlocklistItemResourceId = RaiBlocklistItemResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, raiBlocklistName, raiBlocklistItemName); + RaiBlocklistItemResource raiBlocklistItem = client.GetRaiBlocklistItemResource(raiBlocklistItemResourceId); + + // invoke the operation + RaiBlocklistItemResource result = await raiBlocklistItem.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RaiBlocklistItemData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // PutRaiBlocklistItem + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_PutRaiBlocklistItem() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/PutRaiBlocklistItem.json + // this example is just showing the usage of "RaiBlocklistItems_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RaiBlocklistItemResource created on azure + // for more information of creating RaiBlocklistItemResource, please refer to the document of RaiBlocklistItemResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resourceGroupName"; + string accountName = "accountName"; + string raiBlocklistName = "raiBlocklistName"; + string raiBlocklistItemName = "raiBlocklistItemName"; + ResourceIdentifier raiBlocklistItemResourceId = RaiBlocklistItemResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, raiBlocklistName, raiBlocklistItemName); + RaiBlocklistItemResource raiBlocklistItem = client.GetRaiBlocklistItemResource(raiBlocklistItemResourceId); + + // invoke the operation + RaiBlocklistItemData data = new RaiBlocklistItemData() + { + Properties = new RaiBlocklistItemProperties() + { + Pattern = "Pattern To Block", + IsRegex = false, + }, + }; + ArmOperation lro = await raiBlocklistItem.UpdateAsync(WaitUntil.Completed, data); + RaiBlocklistItemResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RaiBlocklistItemData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // DeleteRaiBlocklistItem + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteRaiBlocklistItem() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/DeleteRaiBlocklistItem.json + // this example is just showing the usage of "RaiBlocklistItems_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RaiBlocklistItemResource created on azure + // for more information of creating RaiBlocklistItemResource, please refer to the document of RaiBlocklistItemResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resourceGroupName"; + string accountName = "accountName"; + string raiBlocklistName = "raiBlocklistName"; + string raiBlocklistItemName = "raiBlocklistItemName"; + ResourceIdentifier raiBlocklistItemResourceId = RaiBlocklistItemResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, raiBlocklistName, raiBlocklistItemName); + RaiBlocklistItemResource raiBlocklistItem = client.GetRaiBlocklistItemResource(raiBlocklistItemResourceId); + + // invoke the operation + await raiBlocklistItem.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_RaiBlocklistResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_RaiBlocklistResource.cs new file mode 100644 index 0000000000000..e5cc809a605e5 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_RaiBlocklistResource.cs @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CognitiveServices; + +namespace Azure.ResourceManager.CognitiveServices.Samples +{ + public partial class Sample_RaiBlocklistResource + { + // GetRaiBlocklist + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetRaiBlocklist() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetRaiBlocklist.json + // this example is just showing the usage of "RaiBlocklists_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RaiBlocklistResource created on azure + // for more information of creating RaiBlocklistResource, please refer to the document of RaiBlocklistResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resourceGroupName"; + string accountName = "accountName"; + string raiBlocklistName = "raiBlocklistName"; + ResourceIdentifier raiBlocklistResourceId = RaiBlocklistResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, raiBlocklistName); + RaiBlocklistResource raiBlocklist = client.GetRaiBlocklistResource(raiBlocklistResourceId); + + // invoke the operation + RaiBlocklistResource result = await raiBlocklist.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RaiBlocklistData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // PutRaiBlocklist + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_PutRaiBlocklist() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/PutRaiBlocklist.json + // this example is just showing the usage of "RaiBlocklists_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RaiBlocklistResource created on azure + // for more information of creating RaiBlocklistResource, please refer to the document of RaiBlocklistResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resourceGroupName"; + string accountName = "accountName"; + string raiBlocklistName = "raiBlocklistName"; + ResourceIdentifier raiBlocklistResourceId = RaiBlocklistResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, raiBlocklistName); + RaiBlocklistResource raiBlocklist = client.GetRaiBlocklistResource(raiBlocklistResourceId); + + // invoke the operation + RaiBlocklistData data = new RaiBlocklistData() + { + RaiBlocklistDescription = "Basic blocklist description", + }; + ArmOperation lro = await raiBlocklist.UpdateAsync(WaitUntil.Completed, data); + RaiBlocklistResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RaiBlocklistData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // DeleteRaiBlocklist + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteRaiBlocklist() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/DeleteRaiBlocklist.json + // this example is just showing the usage of "RaiBlocklists_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RaiBlocklistResource created on azure + // for more information of creating RaiBlocklistResource, please refer to the document of RaiBlocklistResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resourceGroupName"; + string accountName = "accountName"; + string raiBlocklistName = "raiBlocklistName"; + ResourceIdentifier raiBlocklistResourceId = RaiBlocklistResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, raiBlocklistName); + RaiBlocklistResource raiBlocklist = client.GetRaiBlocklistResource(raiBlocklistResourceId); + + // invoke the operation + await raiBlocklist.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_RaiPolicyCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_RaiPolicyCollection.cs new file mode 100644 index 0000000000000..c92bf67c9d669 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_RaiPolicyCollection.cs @@ -0,0 +1,231 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CognitiveServices; +using Azure.ResourceManager.CognitiveServices.Models; + +namespace Azure.ResourceManager.CognitiveServices.Samples +{ + public partial class Sample_RaiPolicyCollection + { + // ListRaiPolicies + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListRaiPolicies() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListRaiPolicies.json + // this example is just showing the usage of "RaiPolicies_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CognitiveServicesAccountResource created on azure + // for more information of creating CognitiveServicesAccountResource, please refer to the document of CognitiveServicesAccountResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resourceGroupName"; + string accountName = "accountName"; + ResourceIdentifier cognitiveServicesAccountResourceId = CognitiveServicesAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CognitiveServicesAccountResource cognitiveServicesAccount = client.GetCognitiveServicesAccountResource(cognitiveServicesAccountResourceId); + + // get the collection of this RaiPolicyResource + RaiPolicyCollection collection = cognitiveServicesAccount.GetRaiPolicies(); + + // invoke the operation and iterate over the result + await foreach (RaiPolicyResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RaiPolicyData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // GetRaiPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetRaiPolicy() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetRaiPolicy.json + // this example is just showing the usage of "RaiPolicies_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CognitiveServicesAccountResource created on azure + // for more information of creating CognitiveServicesAccountResource, please refer to the document of CognitiveServicesAccountResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resourceGroupName"; + string accountName = "accountName"; + ResourceIdentifier cognitiveServicesAccountResourceId = CognitiveServicesAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CognitiveServicesAccountResource cognitiveServicesAccount = client.GetCognitiveServicesAccountResource(cognitiveServicesAccountResourceId); + + // get the collection of this RaiPolicyResource + RaiPolicyCollection collection = cognitiveServicesAccount.GetRaiPolicies(); + + // invoke the operation + string raiPolicyName = "raiPolicyName"; + RaiPolicyResource result = await collection.GetAsync(raiPolicyName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RaiPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GetRaiPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetRaiPolicy() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetRaiPolicy.json + // this example is just showing the usage of "RaiPolicies_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CognitiveServicesAccountResource created on azure + // for more information of creating CognitiveServicesAccountResource, please refer to the document of CognitiveServicesAccountResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resourceGroupName"; + string accountName = "accountName"; + ResourceIdentifier cognitiveServicesAccountResourceId = CognitiveServicesAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CognitiveServicesAccountResource cognitiveServicesAccount = client.GetCognitiveServicesAccountResource(cognitiveServicesAccountResourceId); + + // get the collection of this RaiPolicyResource + RaiPolicyCollection collection = cognitiveServicesAccount.GetRaiPolicies(); + + // invoke the operation + string raiPolicyName = "raiPolicyName"; + bool result = await collection.ExistsAsync(raiPolicyName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // GetRaiPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetRaiPolicy() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetRaiPolicy.json + // this example is just showing the usage of "RaiPolicies_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CognitiveServicesAccountResource created on azure + // for more information of creating CognitiveServicesAccountResource, please refer to the document of CognitiveServicesAccountResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resourceGroupName"; + string accountName = "accountName"; + ResourceIdentifier cognitiveServicesAccountResourceId = CognitiveServicesAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CognitiveServicesAccountResource cognitiveServicesAccount = client.GetCognitiveServicesAccountResource(cognitiveServicesAccountResourceId); + + // get the collection of this RaiPolicyResource + RaiPolicyCollection collection = cognitiveServicesAccount.GetRaiPolicies(); + + // invoke the operation + string raiPolicyName = "raiPolicyName"; + NullableResponse response = await collection.GetIfExistsAsync(raiPolicyName); + RaiPolicyResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RaiPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // PutRaiPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_PutRaiPolicy() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/PutRaiPolicy.json + // this example is just showing the usage of "RaiPolicies_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CognitiveServicesAccountResource created on azure + // for more information of creating CognitiveServicesAccountResource, please refer to the document of CognitiveServicesAccountResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resourceGroupName"; + string accountName = "accountName"; + ResourceIdentifier cognitiveServicesAccountResourceId = CognitiveServicesAccountResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName); + CognitiveServicesAccountResource cognitiveServicesAccount = client.GetCognitiveServicesAccountResource(cognitiveServicesAccountResourceId); + + // get the collection of this RaiPolicyResource + RaiPolicyCollection collection = cognitiveServicesAccount.GetRaiPolicies(); + + // invoke the operation + string raiPolicyName = "raiPolicyName"; + RaiPolicyData data = new RaiPolicyData() + { + Properties = new RaiPolicyProperties() + { + BasePolicyName = "112", + ContentFilters = +{ +new RaiPolicyContentFilter() +{ +Name = "hate", +AllowedContentLevel = AllowedContentLevel.Low, +Blocking = true, +},new RaiPolicyContentFilter() +{ +Name = "sexual", +AllowedContentLevel = AllowedContentLevel.Low, +},new RaiPolicyContentFilter() +{ +Name = "violence", +Enabled = false, +},new RaiPolicyContentFilter() +{ +Name = "DefaultHateSpeechBlockList", +Enabled = false, +} +}, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, raiPolicyName, data); + RaiPolicyResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RaiPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_RaiPolicyResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_RaiPolicyResource.cs new file mode 100644 index 0000000000000..285eb19020eee --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_RaiPolicyResource.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.CognitiveServices; +using Azure.ResourceManager.CognitiveServices.Models; + +namespace Azure.ResourceManager.CognitiveServices.Samples +{ + public partial class Sample_RaiPolicyResource + { + // GetRaiPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetRaiPolicy() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetRaiPolicy.json + // this example is just showing the usage of "RaiPolicies_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RaiPolicyResource created on azure + // for more information of creating RaiPolicyResource, please refer to the document of RaiPolicyResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resourceGroupName"; + string accountName = "accountName"; + string raiPolicyName = "raiPolicyName"; + ResourceIdentifier raiPolicyResourceId = RaiPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, raiPolicyName); + RaiPolicyResource raiPolicy = client.GetRaiPolicyResource(raiPolicyResourceId); + + // invoke the operation + RaiPolicyResource result = await raiPolicy.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RaiPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // PutRaiPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_PutRaiPolicy() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/PutRaiPolicy.json + // this example is just showing the usage of "RaiPolicies_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RaiPolicyResource created on azure + // for more information of creating RaiPolicyResource, please refer to the document of RaiPolicyResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resourceGroupName"; + string accountName = "accountName"; + string raiPolicyName = "raiPolicyName"; + ResourceIdentifier raiPolicyResourceId = RaiPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, raiPolicyName); + RaiPolicyResource raiPolicy = client.GetRaiPolicyResource(raiPolicyResourceId); + + // invoke the operation + RaiPolicyData data = new RaiPolicyData() + { + Properties = new RaiPolicyProperties() + { + BasePolicyName = "112", + ContentFilters = +{ +new RaiPolicyContentFilter() +{ +Name = "hate", +AllowedContentLevel = AllowedContentLevel.Low, +Blocking = true, +},new RaiPolicyContentFilter() +{ +Name = "sexual", +AllowedContentLevel = AllowedContentLevel.Low, +},new RaiPolicyContentFilter() +{ +Name = "violence", +Enabled = false, +},new RaiPolicyContentFilter() +{ +Name = "DefaultHateSpeechBlockList", +Enabled = false, +} +}, + }, + }; + ArmOperation lro = await raiPolicy.UpdateAsync(WaitUntil.Completed, data); + RaiPolicyResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RaiPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // DeleteRaiPolicy + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteRaiPolicy() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/DeleteRaiPolicy.json + // this example is just showing the usage of "RaiPolicies_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RaiPolicyResource created on azure + // for more information of creating RaiPolicyResource, please refer to the document of RaiPolicyResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resourceGroupName"; + string accountName = "accountName"; + string raiPolicyName = "raiPolicyName"; + ResourceIdentifier raiPolicyResourceId = RaiPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, raiPolicyName); + RaiPolicyResource raiPolicy = client.GetRaiPolicyResource(raiPolicyResourceId); + + // invoke the operation + await raiPolicy.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs index 0da8c630ae811..2039827c708a6 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs @@ -23,7 +23,7 @@ public partial class Sample_SubscriptionResourceExtensions [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetResourceSkus_RegenerateKeys() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/GetSkus.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/GetSkus.json // this example is just showing the usage of "ResourceSkus_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -51,7 +51,7 @@ public async Task GetResourceSkus_RegenerateKeys() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetUsages_GetUsages() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListUsages.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListUsages.json // this example is just showing the usage of "Usages_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -80,7 +80,7 @@ public async Task GetUsages_GetUsages() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CheckSkuAvailability_CheckSKUAvailability() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/CheckSkuAvailability.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/CheckSkuAvailability.json // this example is just showing the usage of "CheckSkuAvailability" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -113,7 +113,7 @@ public async Task CheckSkuAvailability_CheckSKUAvailability() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CheckDomainAvailability_CheckSKUAvailability() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/CheckDomainAvailability.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/CheckDomainAvailability.json // this example is just showing the usage of "CheckDomainAvailability" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -139,7 +139,7 @@ public async Task CheckDomainAvailability_CheckSKUAvailability() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetCommitmentTiers_ListCommitmentTiers() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListCommitmentTiers.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListCommitmentTiers.json // this example is just showing the usage of "CommitmentTiers_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -168,7 +168,7 @@ public async Task GetCommitmentTiers_ListCommitmentTiers() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetModels_ListModels() { - // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2023-05-01/examples/ListModels.json + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListModels.json // this example is just showing the usage of "Models_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -191,5 +191,34 @@ public async Task GetModels_ListModels() Console.WriteLine($"Succeeded"); } + + // ListRaiContentFilters + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetRaiContentFilters_ListRaiContentFilters() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/preview/2023-10-01-preview/examples/ListRaiContentFilters.json + // this example is just showing the usage of "RaiContentFilters_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + AzureLocation location = new AzureLocation("WestUS"); + await foreach (RaiContentFilter item in subscriptionResource.GetRaiContentFiltersAsync(location)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/ArmCognitiveServicesModelFactory.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/ArmCognitiveServicesModelFactory.cs index 6e4c308bc99a0..1dd4dbe301e51 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/ArmCognitiveServicesModelFactory.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/ArmCognitiveServicesModelFactory.cs @@ -49,6 +49,7 @@ public static CognitiveServicesAccountData CognitiveServicesAccountData(Resource /// A collection of rules governing the accessibility from specific network locations. /// The encryption properties for this resource. /// The storage accounts for this resource. + /// The user owned AML workspace properties. /// The private endpoint connection associated with the Cognitive Services account. /// Whether or not public endpoint access is allowed for this account. /// The api properties for special APIs. @@ -67,7 +68,7 @@ public static CognitiveServicesAccountData CognitiveServicesAccountData(Resource /// The commitment plan associations of Cognitive Services account. /// The abuse penalty. /// A new instance for mocking. - public static CognitiveServicesAccountProperties CognitiveServicesAccountProperties(ServiceAccountProvisioningState? provisioningState = null, string endpoint = null, IEnumerable capabilities = null, bool? isMigrated = null, string migrationToken = null, CognitiveServicesSkuChangeInfo skuChangeInfo = null, string customSubDomainName = null, CognitiveServicesNetworkRuleSet networkAcls = null, ServiceAccountEncryptionProperties encryption = null, IEnumerable userOwnedStorage = null, IEnumerable privateEndpointConnections = null, ServiceAccountPublicNetworkAccess? publicNetworkAccess = null, ServiceAccountApiProperties apiProperties = null, DateTimeOffset? createdOn = null, ServiceAccountCallRateLimit callRateLimit = null, bool? enableDynamicThrottling = null, ServiceAccountQuotaLimit quotaLimit = null, bool? restrictOutboundNetworkAccess = null, IEnumerable allowedFqdnList = null, bool? disableLocalAuth = null, IReadOnlyDictionary endpoints = null, bool? restore = null, DateTimeOffset? deletedOn = null, string scheduledPurgeDate = null, CognitiveServicesMultiRegionSettings locations = null, IEnumerable commitmentPlanAssociations = null, AbusePenalty abusePenalty = null) + public static CognitiveServicesAccountProperties CognitiveServicesAccountProperties(ServiceAccountProvisioningState? provisioningState = null, string endpoint = null, IEnumerable capabilities = null, bool? isMigrated = null, string migrationToken = null, CognitiveServicesSkuChangeInfo skuChangeInfo = null, string customSubDomainName = null, CognitiveServicesNetworkRuleSet networkAcls = null, ServiceAccountEncryptionProperties encryption = null, IEnumerable userOwnedStorage = null, UserOwnedAmlWorkspace amlWorkspace = null, IEnumerable privateEndpointConnections = null, ServiceAccountPublicNetworkAccess? publicNetworkAccess = null, ServiceAccountApiProperties apiProperties = null, DateTimeOffset? createdOn = null, ServiceAccountCallRateLimit callRateLimit = null, bool? enableDynamicThrottling = null, ServiceAccountQuotaLimit quotaLimit = null, bool? restrictOutboundNetworkAccess = null, IEnumerable allowedFqdnList = null, bool? disableLocalAuth = null, IReadOnlyDictionary endpoints = null, bool? restore = null, DateTimeOffset? deletedOn = null, string scheduledPurgeDate = null, CognitiveServicesMultiRegionSettings locations = null, IEnumerable commitmentPlanAssociations = null, AbusePenalty abusePenalty = null) { capabilities ??= new List(); userOwnedStorage ??= new List(); @@ -76,7 +77,7 @@ public static CognitiveServicesAccountProperties CognitiveServicesAccountPropert endpoints ??= new Dictionary(); commitmentPlanAssociations ??= new List(); - return new CognitiveServicesAccountProperties(provisioningState, endpoint, capabilities?.ToList(), isMigrated, migrationToken, skuChangeInfo, customSubDomainName, networkAcls, encryption, userOwnedStorage?.ToList(), privateEndpointConnections?.ToList(), publicNetworkAccess, apiProperties, createdOn, callRateLimit, enableDynamicThrottling, quotaLimit, restrictOutboundNetworkAccess, allowedFqdnList?.ToList(), disableLocalAuth, endpoints, restore, deletedOn, scheduledPurgeDate, locations, commitmentPlanAssociations?.ToList(), abusePenalty); + return new CognitiveServicesAccountProperties(provisioningState, endpoint, capabilities?.ToList(), isMigrated, migrationToken, skuChangeInfo, customSubDomainName, networkAcls, encryption, userOwnedStorage?.ToList(), amlWorkspace, privateEndpointConnections?.ToList(), publicNetworkAccess, apiProperties, createdOn, callRateLimit, enableDynamicThrottling, quotaLimit, restrictOutboundNetworkAccess, allowedFqdnList?.ToList(), disableLocalAuth, endpoints, restore, deletedOn, scheduledPurgeDate, locations, commitmentPlanAssociations?.ToList(), abusePenalty); } /// Initializes a new instance of . @@ -418,29 +419,35 @@ public static CognitiveServicesPrivateLinkResourceProperties CognitiveServicesPr /// The systemData. /// The resource model definition representing SKU. /// Resource Etag. + /// Resource tags. /// Properties of Cognitive Services account deployment. /// A new instance for mocking. - public static CognitiveServicesAccountDeploymentData CognitiveServicesAccountDeploymentData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, CognitiveServicesSku sku = null, ETag? etag = null, CognitiveServicesAccountDeploymentProperties properties = null) + public static CognitiveServicesAccountDeploymentData CognitiveServicesAccountDeploymentData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, CognitiveServicesSku sku = null, ETag? etag = null, IDictionary tags = null, CognitiveServicesAccountDeploymentProperties properties = null) { - return new CognitiveServicesAccountDeploymentData(id, name, resourceType, systemData, sku, etag, properties); + tags ??= new Dictionary(); + + return new CognitiveServicesAccountDeploymentData(id, name, resourceType, systemData, sku, etag, tags, properties); } /// Initializes a new instance of . /// Gets the status of the resource at the time the operation was called. /// Properties of Cognitive Services account deployment model. - /// Properties of Cognitive Services account deployment model. + /// Properties of Cognitive Services account deployment model. (Deprecated, please use Deployment.sku instead.). /// The capabilities. /// The name of RAI policy. /// The call rate limit Cognitive Services account. /// /// Deployment model version upgrade option. + /// If the dynamic throttling is enabled. + /// The current capacity. + /// Internal use only. /// A new instance for mocking. - public static CognitiveServicesAccountDeploymentProperties CognitiveServicesAccountDeploymentProperties(CognitiveServicesAccountDeploymentProvisioningState? provisioningState = null, CognitiveServicesAccountDeploymentModel model = null, CognitiveServicesAccountDeploymentScaleSettings scaleSettings = null, IReadOnlyDictionary capabilities = null, string raiPolicyName = null, ServiceAccountCallRateLimit callRateLimit = null, IEnumerable rateLimits = null, DeploymentModelVersionUpgradeOption? versionUpgradeOption = null) + public static CognitiveServicesAccountDeploymentProperties CognitiveServicesAccountDeploymentProperties(CognitiveServicesAccountDeploymentProvisioningState? provisioningState = null, CognitiveServicesAccountDeploymentModel model = null, CognitiveServicesAccountDeploymentScaleSettings scaleSettings = null, IReadOnlyDictionary capabilities = null, string raiPolicyName = null, ServiceAccountCallRateLimit callRateLimit = null, IEnumerable rateLimits = null, DeploymentModelVersionUpgradeOption? versionUpgradeOption = null, bool? dynamicThrottlingEnabled = null, int? currentCapacity = null, DeploymentCapacitySettings capacitySettings = null) { capabilities ??= new Dictionary(); rateLimits ??= new List(); - return new CognitiveServicesAccountDeploymentProperties(provisioningState, model, scaleSettings, capabilities, raiPolicyName, callRateLimit, rateLimits?.ToList(), versionUpgradeOption); + return new CognitiveServicesAccountDeploymentProperties(provisioningState, model, scaleSettings, capabilities, raiPolicyName, callRateLimit, rateLimits?.ToList(), versionUpgradeOption, dynamicThrottlingEnabled, currentCapacity, capacitySettings); } /// Initializes a new instance of . @@ -453,6 +460,16 @@ public static CognitiveServicesAccountDeploymentScaleSettings CognitiveServicesA return new CognitiveServicesAccountDeploymentScaleSettings(scaleType, capacity, activeCapacity); } + /// Initializes a new instance of . + /// The resource type name. + /// The resource model definition representing SKU. + /// The capacity configuration. + /// A new instance for mocking. + public static SkuResource SkuResource(string resourceType = null, CognitiveServicesSku sku = null, CognitiveServicesCapacityConfig capacity = null) + { + return new SkuResource(resourceType, sku, capacity); + } + /// Initializes a new instance of . /// The id. /// The name. @@ -502,17 +519,122 @@ public static CommitmentPeriod CommitmentPeriod(string tier = null, int? count = return new CommitmentPeriod(tier, count, quota, startOn, endOn); } + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Resource Etag. + /// Resource tags. + /// Properties of Cognitive Services EncryptionScope. + /// A new instance for mocking. + public static EncryptionScopeData EncryptionScopeData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ETag? etag = null, IDictionary tags = null, EncryptionScopeProperties properties = null) + { + tags ??= new Dictionary(); + + return new EncryptionScopeData(id, name, resourceType, systemData, etag, tags, properties); + } + + /// Initializes a new instance of . + /// Properties of KeyVault. + /// Enumerates the possible value of keySource for Encryption. + /// Gets the status of the resource at the time the operation was called. + /// The encryptionScope state. + /// A new instance for mocking. + public static EncryptionScopeProperties EncryptionScopeProperties(CognitiveServicesKeyVaultProperties keyVaultProperties = null, ServiceAccountEncryptionKeySource? keySource = null, EncryptionScopeProvisioningState? provisioningState = null, EncryptionScopeState? state = null) + { + return new EncryptionScopeProperties(keyVaultProperties, keySource, provisioningState, state); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Resource Etag. + /// Resource tags. + /// Properties of Cognitive Services RaiPolicy. + /// A new instance for mocking. + public static RaiPolicyData RaiPolicyData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ETag? etag = null, IDictionary tags = null, RaiPolicyProperties properties = null) + { + tags ??= new Dictionary(); + + return new RaiPolicyData(id, name, resourceType, systemData, etag, tags, properties); + } + + /// Initializes a new instance of . + /// Content Filters policy type. + /// Content Filters mode. + /// Name of the base Content Filters. + /// The list of blocklists for prompt. + /// The list of blocklists for completion. + /// The list of Content Filters. + /// A new instance for mocking. + public static RaiPolicyProperties RaiPolicyProperties(RaiPolicyType? policyType = null, RaiPolicyMode? mode = null, string basePolicyName = null, IEnumerable promptBlocklists = null, IEnumerable completionBlocklists = null, IEnumerable contentFilters = null) + { + promptBlocklists ??= new List(); + completionBlocklists ??= new List(); + contentFilters ??= new List(); + + return new RaiPolicyProperties(policyType, mode, basePolicyName, promptBlocklists?.ToList(), completionBlocklists?.ToList(), contentFilters?.ToList()); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Resource Etag. + /// Resource tags. + /// Properties of Cognitive Services RaiBlocklist. + /// A new instance for mocking. + public static RaiBlocklistData RaiBlocklistData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ETag? etag = null, IDictionary tags = null, string raiBlocklistDescription = null) + { + tags ??= new Dictionary(); + + return new RaiBlocklistData(id, name, resourceType, systemData, etag, tags, raiBlocklistDescription != null ? new RaiBlocklistProperties(raiBlocklistDescription) : null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Resource Etag. + /// Resource tags. + /// Properties of Cognitive Services RaiBlocklist Item. + /// A new instance for mocking. + public static RaiBlocklistItemData RaiBlocklistItemData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ETag? etag = null, IDictionary tags = null, RaiBlocklistItemProperties properties = null) + { + tags ??= new Dictionary(); + + return new RaiBlocklistItemData(id, name, resourceType, systemData, etag, tags, properties); + } + + /// Initializes a new instance of . + /// Name of Content Filter. + /// Description of Content Filter. + /// Content Filter type. + /// A new instance for mocking. + public static RaiContentFilter RaiContentFilter(string policyName = null, string description = null, RaiContentFilterType? filterType = null) + { + return new RaiContentFilter(policyName, description, filterType); + } + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Resource Etag. + /// Resource tags. /// The Azure resource id of the account. /// A new instance for mocking. - public static CommitmentPlanAccountAssociationData CommitmentPlanAccountAssociationData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ETag? etag = null, string accountId = null) + public static CommitmentPlanAccountAssociationData CommitmentPlanAccountAssociationData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ETag? etag = null, IDictionary tags = null, string accountId = null) { - return new CommitmentPlanAccountAssociationData(id, name, resourceType, systemData, etag, accountId); + tags ??= new Dictionary(); + + return new CommitmentPlanAccountAssociationData(id, name, resourceType, systemData, etag, tags, accountId); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountDeploymentData.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountDeploymentData.cs index 8cc8abff81bd9..79c128183736c 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountDeploymentData.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountDeploymentData.cs @@ -5,6 +5,7 @@ #nullable disable +using System.Collections.Generic; using Azure; using Azure.Core; using Azure.ResourceManager.CognitiveServices.Models; @@ -21,6 +22,7 @@ public partial class CognitiveServicesAccountDeploymentData : ResourceData /// Initializes a new instance of . public CognitiveServicesAccountDeploymentData() { + Tags = new ChangeTrackingDictionary(); } /// Initializes a new instance of . @@ -30,11 +32,13 @@ public CognitiveServicesAccountDeploymentData() /// The systemData. /// The resource model definition representing SKU. /// Resource Etag. + /// Resource tags. /// Properties of Cognitive Services account deployment. - internal CognitiveServicesAccountDeploymentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, CognitiveServicesSku sku, ETag? etag, CognitiveServicesAccountDeploymentProperties properties) : base(id, name, resourceType, systemData) + internal CognitiveServicesAccountDeploymentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, CognitiveServicesSku sku, ETag? etag, IDictionary tags, CognitiveServicesAccountDeploymentProperties properties) : base(id, name, resourceType, systemData) { Sku = sku; ETag = etag; + Tags = tags; Properties = properties; } @@ -42,6 +46,8 @@ internal CognitiveServicesAccountDeploymentData(ResourceIdentifier id, string na public CognitiveServicesSku Sku { get; set; } /// Resource Etag. public ETag? ETag { get; } + /// Resource tags. + public IDictionary Tags { get; } /// Properties of Cognitive Services account deployment. public CognitiveServicesAccountDeploymentProperties Properties { get; set; } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountDeploymentResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountDeploymentResource.cs index 73bbb73468820..612572a0c0bff 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountDeploymentResource.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountDeploymentResource.cs @@ -6,13 +6,16 @@ #nullable disable using System; +using System.Collections.Generic; using System.Globalization; using System.Threading; using System.Threading.Tasks; +using Autorest.CSharp.Core; using Azure; using Azure.Core; using Azure.Core.Pipeline; using Azure.ResourceManager; +using Azure.ResourceManager.CognitiveServices.Models; namespace Azure.ResourceManager.CognitiveServices { @@ -223,7 +226,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } /// - /// Update the state of specified deployments associated with the Cognitive Services account. + /// Update specified deployments associated with the Cognitive Services account. /// /// /// Request Path @@ -231,24 +234,24 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Operation Id - /// Deployments_CreateOrUpdate + /// Deployments_Update /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The deployment properties. + /// The deployment properties. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, CognitiveServicesAccountDeploymentData data, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, PatchResourceTagsAndSku deployment, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(data, nameof(data)); + Argument.AssertNotNull(deployment, nameof(deployment)); using var scope = _cognitiveServicesAccountDeploymentDeploymentsClientDiagnostics.CreateScope("CognitiveServicesAccountDeploymentResource.Update"); scope.Start(); try { - var response = await _cognitiveServicesAccountDeploymentDeploymentsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); - var operation = new CognitiveServicesArmOperation(new CognitiveServicesAccountDeploymentOperationSource(Client), _cognitiveServicesAccountDeploymentDeploymentsClientDiagnostics, Pipeline, _cognitiveServicesAccountDeploymentDeploymentsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = await _cognitiveServicesAccountDeploymentDeploymentsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, deployment, cancellationToken).ConfigureAwait(false); + var operation = new CognitiveServicesArmOperation(new CognitiveServicesAccountDeploymentOperationSource(Client), _cognitiveServicesAccountDeploymentDeploymentsClientDiagnostics, Pipeline, _cognitiveServicesAccountDeploymentDeploymentsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, deployment).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -261,7 +264,7 @@ public virtual async Task - /// Update the state of specified deployments associated with the Cognitive Services account. + /// Update specified deployments associated with the Cognitive Services account. /// /// /// Request Path @@ -269,24 +272,24 @@ public virtual async Task /// /// Operation Id - /// Deployments_CreateOrUpdate + /// Deployments_Update /// /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The deployment properties. + /// The deployment properties. /// The cancellation token to use. - /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, CognitiveServicesAccountDeploymentData data, CancellationToken cancellationToken = default) + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, PatchResourceTagsAndSku deployment, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(data, nameof(data)); + Argument.AssertNotNull(deployment, nameof(deployment)); using var scope = _cognitiveServicesAccountDeploymentDeploymentsClientDiagnostics.CreateScope("CognitiveServicesAccountDeploymentResource.Update"); scope.Start(); try { - var response = _cognitiveServicesAccountDeploymentDeploymentsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); - var operation = new CognitiveServicesArmOperation(new CognitiveServicesAccountDeploymentOperationSource(Client), _cognitiveServicesAccountDeploymentDeploymentsClientDiagnostics, Pipeline, _cognitiveServicesAccountDeploymentDeploymentsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = _cognitiveServicesAccountDeploymentDeploymentsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, deployment, cancellationToken); + var operation = new CognitiveServicesArmOperation(new CognitiveServicesAccountDeploymentOperationSource(Client), _cognitiveServicesAccountDeploymentDeploymentsClientDiagnostics, Pipeline, _cognitiveServicesAccountDeploymentDeploymentsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, deployment).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -297,5 +300,359 @@ public virtual ArmOperation Update(W throw; } } + + /// + /// Lists the specified deployments skus associated with the Cognitive Services account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments/{deploymentName}/skus + /// + /// + /// Operation Id + /// Deployments_ListSkus + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSkusAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _cognitiveServicesAccountDeploymentDeploymentsRestClient.CreateListSkusRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _cognitiveServicesAccountDeploymentDeploymentsRestClient.CreateListSkusNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, SkuResource.DeserializeSkuResource, _cognitiveServicesAccountDeploymentDeploymentsClientDiagnostics, Pipeline, "CognitiveServicesAccountDeploymentResource.GetSkus", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the specified deployments skus associated with the Cognitive Services account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments/{deploymentName}/skus + /// + /// + /// Operation Id + /// Deployments_ListSkus + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSkus(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _cognitiveServicesAccountDeploymentDeploymentsRestClient.CreateListSkusRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _cognitiveServicesAccountDeploymentDeploymentsRestClient.CreateListSkusNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, SkuResource.DeserializeSkuResource, _cognitiveServicesAccountDeploymentDeploymentsClientDiagnostics, Pipeline, "CognitiveServicesAccountDeploymentResource.GetSkus", "value", "nextLink", cancellationToken); + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_Get + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _cognitiveServicesAccountDeploymentDeploymentsClientDiagnostics.CreateScope("CognitiveServicesAccountDeploymentResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _cognitiveServicesAccountDeploymentDeploymentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new CognitiveServicesAccountDeploymentResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new PatchResourceTagsAndSku(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_Get + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _cognitiveServicesAccountDeploymentDeploymentsClientDiagnostics.CreateScope("CognitiveServicesAccountDeploymentResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _cognitiveServicesAccountDeploymentDeploymentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new CognitiveServicesAccountDeploymentResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new PatchResourceTagsAndSku(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_Get + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _cognitiveServicesAccountDeploymentDeploymentsClientDiagnostics.CreateScope("CognitiveServicesAccountDeploymentResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _cognitiveServicesAccountDeploymentDeploymentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new CognitiveServicesAccountDeploymentResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new PatchResourceTagsAndSku(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_Get + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _cognitiveServicesAccountDeploymentDeploymentsClientDiagnostics.CreateScope("CognitiveServicesAccountDeploymentResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _cognitiveServicesAccountDeploymentDeploymentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new CognitiveServicesAccountDeploymentResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new PatchResourceTagsAndSku(); + patch.Tags.ReplaceWith(tags); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_Get + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _cognitiveServicesAccountDeploymentDeploymentsClientDiagnostics.CreateScope("CognitiveServicesAccountDeploymentResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _cognitiveServicesAccountDeploymentDeploymentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new CognitiveServicesAccountDeploymentResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new PatchResourceTagsAndSku(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_Get + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _cognitiveServicesAccountDeploymentDeploymentsClientDiagnostics.CreateScope("CognitiveServicesAccountDeploymentResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _cognitiveServicesAccountDeploymentDeploymentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new CognitiveServicesAccountDeploymentResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new PatchResourceTagsAndSku(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountResource.cs index a9538cbf24f8b..8c862d4a8b057 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountResource.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountResource.cs @@ -256,6 +256,165 @@ public virtual Response GetCommitmentPlan(string commitm return GetCommitmentPlans().Get(commitmentPlanName, cancellationToken); } + /// Gets a collection of EncryptionScopeResources in the CognitiveServicesAccount. + /// An object representing collection of EncryptionScopeResources and their operations over a EncryptionScopeResource. + public virtual EncryptionScopeCollection GetEncryptionScopes() + { + return GetCachedClient(client => new EncryptionScopeCollection(client, Id)); + } + + /// + /// Gets the specified EncryptionScope associated with the Cognitive Services account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName} + /// + /// + /// Operation Id + /// EncryptionScopes_Get + /// + /// + /// + /// The name of the encryptionScope associated with the Cognitive Services Account. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetEncryptionScopeAsync(string encryptionScopeName, CancellationToken cancellationToken = default) + { + return await GetEncryptionScopes().GetAsync(encryptionScopeName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified EncryptionScope associated with the Cognitive Services account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName} + /// + /// + /// Operation Id + /// EncryptionScopes_Get + /// + /// + /// + /// The name of the encryptionScope associated with the Cognitive Services Account. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetEncryptionScope(string encryptionScopeName, CancellationToken cancellationToken = default) + { + return GetEncryptionScopes().Get(encryptionScopeName, cancellationToken); + } + + /// Gets a collection of RaiPolicyResources in the CognitiveServicesAccount. + /// An object representing collection of RaiPolicyResources and their operations over a RaiPolicyResource. + public virtual RaiPolicyCollection GetRaiPolicies() + { + return GetCachedClient(client => new RaiPolicyCollection(client, Id)); + } + + /// + /// Gets the specified Content Filters associated with the Azure OpenAI account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName} + /// + /// + /// Operation Id + /// RaiPolicies_Get + /// + /// + /// + /// The name of the RaiPolicy associated with the Cognitive Services Account. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetRaiPolicyAsync(string raiPolicyName, CancellationToken cancellationToken = default) + { + return await GetRaiPolicies().GetAsync(raiPolicyName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified Content Filters associated with the Azure OpenAI account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName} + /// + /// + /// Operation Id + /// RaiPolicies_Get + /// + /// + /// + /// The name of the RaiPolicy associated with the Cognitive Services Account. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetRaiPolicy(string raiPolicyName, CancellationToken cancellationToken = default) + { + return GetRaiPolicies().Get(raiPolicyName, cancellationToken); + } + + /// Gets a collection of RaiBlocklistResources in the CognitiveServicesAccount. + /// An object representing collection of RaiBlocklistResources and their operations over a RaiBlocklistResource. + public virtual RaiBlocklistCollection GetRaiBlocklists() + { + return GetCachedClient(client => new RaiBlocklistCollection(client, Id)); + } + + /// + /// Gets the specified custom blocklist associated with the Azure OpenAI account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName} + /// + /// + /// Operation Id + /// RaiBlocklists_Get + /// + /// + /// + /// The name of the RaiBlocklist associated with the Cognitive Services Account. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetRaiBlocklistAsync(string raiBlocklistName, CancellationToken cancellationToken = default) + { + return await GetRaiBlocklists().GetAsync(raiBlocklistName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified custom blocklist associated with the Azure OpenAI account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName} + /// + /// + /// Operation Id + /// RaiBlocklists_Get + /// + /// + /// + /// The name of the RaiBlocklist associated with the Cognitive Services Account. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetRaiBlocklist(string raiBlocklistName, CancellationToken cancellationToken = default) + { + return GetRaiBlocklists().Get(raiBlocklistName, cancellationToken); + } + /// /// Returns a Cognitive Services account specified by the parameters. /// diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesCommitmentPlanResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesCommitmentPlanResource.cs index edc0d330345cf..e1d8a28184715 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesCommitmentPlanResource.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesCommitmentPlanResource.cs @@ -291,19 +291,19 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The parameters to provide for the created commitment plan. + /// The parameters to provide for the created commitment plan. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, CognitiveServicesCommitmentPlanPatch patch, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, PatchResourceTagsAndSku commitmentPlan, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(commitmentPlan, nameof(commitmentPlan)); using var scope = _cognitiveServicesCommitmentPlanCommitmentPlansClientDiagnostics.CreateScope("CognitiveServicesCommitmentPlanResource.Update"); scope.Start(); try { - var response = await _cognitiveServicesCommitmentPlanCommitmentPlansRestClient.UpdatePlanAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); - var operation = new CognitiveServicesArmOperation(new CognitiveServicesCommitmentPlanOperationSource(Client), _cognitiveServicesCommitmentPlanCommitmentPlansClientDiagnostics, Pipeline, _cognitiveServicesCommitmentPlanCommitmentPlansRestClient.CreateUpdatePlanRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + var response = await _cognitiveServicesCommitmentPlanCommitmentPlansRestClient.UpdatePlanAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, commitmentPlan, cancellationToken).ConfigureAwait(false); + var operation = new CognitiveServicesArmOperation(new CognitiveServicesCommitmentPlanOperationSource(Client), _cognitiveServicesCommitmentPlanCommitmentPlansClientDiagnostics, Pipeline, _cognitiveServicesCommitmentPlanCommitmentPlansRestClient.CreateUpdatePlanRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, commitmentPlan).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -329,19 +329,19 @@ public virtual async Task> /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The parameters to provide for the created commitment plan. + /// The parameters to provide for the created commitment plan. /// The cancellation token to use. - /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, CognitiveServicesCommitmentPlanPatch patch, CancellationToken cancellationToken = default) + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, PatchResourceTagsAndSku commitmentPlan, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(commitmentPlan, nameof(commitmentPlan)); using var scope = _cognitiveServicesCommitmentPlanCommitmentPlansClientDiagnostics.CreateScope("CognitiveServicesCommitmentPlanResource.Update"); scope.Start(); try { - var response = _cognitiveServicesCommitmentPlanCommitmentPlansRestClient.UpdatePlan(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); - var operation = new CognitiveServicesArmOperation(new CognitiveServicesCommitmentPlanOperationSource(Client), _cognitiveServicesCommitmentPlanCommitmentPlansClientDiagnostics, Pipeline, _cognitiveServicesCommitmentPlanCommitmentPlansRestClient.CreateUpdatePlanRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + var response = _cognitiveServicesCommitmentPlanCommitmentPlansRestClient.UpdatePlan(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, commitmentPlan, cancellationToken); + var operation = new CognitiveServicesArmOperation(new CognitiveServicesCommitmentPlanOperationSource(Client), _cognitiveServicesCommitmentPlanCommitmentPlansClientDiagnostics, Pipeline, _cognitiveServicesCommitmentPlanCommitmentPlansRestClient.CreateUpdatePlanRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, commitmentPlan).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -390,7 +390,7 @@ public virtual async Task> Add else { var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new CognitiveServicesCommitmentPlanPatch(); + var patch = new PatchResourceTagsAndSku(); foreach (var tag in current.Tags) { patch.Tags.Add(tag); @@ -444,7 +444,7 @@ public virtual Response AddTag(string k else { var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new CognitiveServicesCommitmentPlanPatch(); + var patch = new PatchResourceTagsAndSku(); foreach (var tag in current.Tags) { patch.Tags.Add(tag); @@ -497,7 +497,7 @@ public virtual async Task> Set else { var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new CognitiveServicesCommitmentPlanPatch(); + var patch = new PatchResourceTagsAndSku(); patch.Tags.ReplaceWith(tags); var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(result.Value, result.GetRawResponse()); @@ -546,7 +546,7 @@ public virtual Response SetTags(IDictio else { var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new CognitiveServicesCommitmentPlanPatch(); + var patch = new PatchResourceTagsAndSku(); patch.Tags.ReplaceWith(tags); var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); return Response.FromValue(result.Value, result.GetRawResponse()); @@ -594,7 +594,7 @@ public virtual async Task> Rem else { var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new CognitiveServicesCommitmentPlanPatch(); + var patch = new PatchResourceTagsAndSku(); foreach (var tag in current.Tags) { patch.Tags.Add(tag); @@ -646,7 +646,7 @@ public virtual Response RemoveTag(strin else { var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new CognitiveServicesCommitmentPlanPatch(); + var patch = new PatchResourceTagsAndSku(); foreach (var tag in current.Tags) { patch.Tags.Add(tag); diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanAccountAssociationData.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanAccountAssociationData.cs index e95c92270776b..ae659ffdbc7e7 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanAccountAssociationData.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanAccountAssociationData.cs @@ -5,6 +5,7 @@ #nullable disable +using System.Collections.Generic; using Azure; using Azure.Core; using Azure.ResourceManager.Models; @@ -20,6 +21,7 @@ public partial class CommitmentPlanAccountAssociationData : ResourceData /// Initializes a new instance of . public CommitmentPlanAccountAssociationData() { + Tags = new ChangeTrackingDictionary(); } /// Initializes a new instance of . @@ -28,15 +30,19 @@ public CommitmentPlanAccountAssociationData() /// The resourceType. /// The systemData. /// Resource Etag. + /// Resource tags. /// The Azure resource id of the account. - internal CommitmentPlanAccountAssociationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ETag? etag, string accountId) : base(id, name, resourceType, systemData) + internal CommitmentPlanAccountAssociationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ETag? etag, IDictionary tags, string accountId) : base(id, name, resourceType, systemData) { ETag = etag; + Tags = tags; AccountId = accountId; } /// Resource Etag. public ETag? ETag { get; } + /// Resource tags. + public IDictionary Tags { get; } /// The Azure resource id of the account. public string AccountId { get; set; } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanAccountAssociationResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanAccountAssociationResource.cs index 71ac0f54fb638..4bdb24e52a102 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanAccountAssociationResource.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanAccountAssociationResource.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Globalization; using System.Threading; using System.Threading.Tasks; @@ -297,5 +298,293 @@ public virtual ArmOperation Update(Wai throw; } } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/commitmentPlans/{commitmentPlanName}/accountAssociations/{commitmentPlanAssociationName} + /// + /// + /// Operation Id + /// CommitmentPlans_GetAssociation + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _commitmentPlanAccountAssociationCommitmentPlansClientDiagnostics.CreateScope("CommitmentPlanAccountAssociationResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _commitmentPlanAccountAssociationCommitmentPlansRestClient.GetAssociationAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new CommitmentPlanAccountAssociationResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + current.Tags[key] = value; + var result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/commitmentPlans/{commitmentPlanName}/accountAssociations/{commitmentPlanAssociationName} + /// + /// + /// Operation Id + /// CommitmentPlans_GetAssociation + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _commitmentPlanAccountAssociationCommitmentPlansClientDiagnostics.CreateScope("CommitmentPlanAccountAssociationResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _commitmentPlanAccountAssociationCommitmentPlansRestClient.GetAssociation(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new CommitmentPlanAccountAssociationResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + current.Tags[key] = value; + var result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/commitmentPlans/{commitmentPlanName}/accountAssociations/{commitmentPlanAssociationName} + /// + /// + /// Operation Id + /// CommitmentPlans_GetAssociation + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _commitmentPlanAccountAssociationCommitmentPlansClientDiagnostics.CreateScope("CommitmentPlanAccountAssociationResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _commitmentPlanAccountAssociationCommitmentPlansRestClient.GetAssociationAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new CommitmentPlanAccountAssociationResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + current.Tags.ReplaceWith(tags); + var result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/commitmentPlans/{commitmentPlanName}/accountAssociations/{commitmentPlanAssociationName} + /// + /// + /// Operation Id + /// CommitmentPlans_GetAssociation + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _commitmentPlanAccountAssociationCommitmentPlansClientDiagnostics.CreateScope("CommitmentPlanAccountAssociationResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _commitmentPlanAccountAssociationCommitmentPlansRestClient.GetAssociation(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new CommitmentPlanAccountAssociationResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + current.Tags.ReplaceWith(tags); + var result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/commitmentPlans/{commitmentPlanName}/accountAssociations/{commitmentPlanAssociationName} + /// + /// + /// Operation Id + /// CommitmentPlans_GetAssociation + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _commitmentPlanAccountAssociationCommitmentPlansClientDiagnostics.CreateScope("CommitmentPlanAccountAssociationResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _commitmentPlanAccountAssociationCommitmentPlansRestClient.GetAssociationAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new CommitmentPlanAccountAssociationResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + current.Tags.Remove(key); + var result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/commitmentPlans/{commitmentPlanName}/accountAssociations/{commitmentPlanAssociationName} + /// + /// + /// Operation Id + /// CommitmentPlans_GetAssociation + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _commitmentPlanAccountAssociationCommitmentPlansClientDiagnostics.CreateScope("CommitmentPlanAccountAssociationResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _commitmentPlanAccountAssociationCommitmentPlansRestClient.GetAssociation(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new CommitmentPlanAccountAssociationResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + current.Tags.Remove(key); + var result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/EncryptionScopeCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/EncryptionScopeCollection.cs new file mode 100644 index 0000000000000..0f3d28072009d --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/EncryptionScopeCollection.cs @@ -0,0 +1,415 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.CognitiveServices +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetEncryptionScopes method from an instance of . + /// + public partial class EncryptionScopeCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _encryptionScopeClientDiagnostics; + private readonly EncryptionScopesRestOperations _encryptionScopeRestClient; + + /// Initializes a new instance of the class for mocking. + protected EncryptionScopeCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal EncryptionScopeCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _encryptionScopeClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.CognitiveServices", EncryptionScopeResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(EncryptionScopeResource.ResourceType, out string encryptionScopeApiVersion); + _encryptionScopeRestClient = new EncryptionScopesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, encryptionScopeApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != CognitiveServicesAccountResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, CognitiveServicesAccountResource.ResourceType), nameof(id)); + } + + /// + /// Update the state of specified encryptionScope associated with the Cognitive Services account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName} + /// + /// + /// Operation Id + /// EncryptionScopes_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the encryptionScope associated with the Cognitive Services Account. + /// The encryptionScope properties. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string encryptionScopeName, EncryptionScopeData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(encryptionScopeName, nameof(encryptionScopeName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _encryptionScopeClientDiagnostics.CreateScope("EncryptionScopeCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _encryptionScopeRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, encryptionScopeName, data, cancellationToken).ConfigureAwait(false); + var operation = new CognitiveServicesArmOperation(Response.FromValue(new EncryptionScopeResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update the state of specified encryptionScope associated with the Cognitive Services account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName} + /// + /// + /// Operation Id + /// EncryptionScopes_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the encryptionScope associated with the Cognitive Services Account. + /// The encryptionScope properties. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string encryptionScopeName, EncryptionScopeData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(encryptionScopeName, nameof(encryptionScopeName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _encryptionScopeClientDiagnostics.CreateScope("EncryptionScopeCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _encryptionScopeRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, encryptionScopeName, data, cancellationToken); + var operation = new CognitiveServicesArmOperation(Response.FromValue(new EncryptionScopeResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the specified EncryptionScope associated with the Cognitive Services account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName} + /// + /// + /// Operation Id + /// EncryptionScopes_Get + /// + /// + /// + /// The name of the encryptionScope associated with the Cognitive Services Account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string encryptionScopeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(encryptionScopeName, nameof(encryptionScopeName)); + + using var scope = _encryptionScopeClientDiagnostics.CreateScope("EncryptionScopeCollection.Get"); + scope.Start(); + try + { + var response = await _encryptionScopeRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, encryptionScopeName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new EncryptionScopeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the specified EncryptionScope associated with the Cognitive Services account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName} + /// + /// + /// Operation Id + /// EncryptionScopes_Get + /// + /// + /// + /// The name of the encryptionScope associated with the Cognitive Services Account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string encryptionScopeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(encryptionScopeName, nameof(encryptionScopeName)); + + using var scope = _encryptionScopeClientDiagnostics.CreateScope("EncryptionScopeCollection.Get"); + scope.Start(); + try + { + var response = _encryptionScopeRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, encryptionScopeName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new EncryptionScopeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the content filters associated with the Azure OpenAI account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes + /// + /// + /// Operation Id + /// EncryptionScopes_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _encryptionScopeRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _encryptionScopeRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EncryptionScopeResource(Client, EncryptionScopeData.DeserializeEncryptionScopeData(e)), _encryptionScopeClientDiagnostics, Pipeline, "EncryptionScopeCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the content filters associated with the Azure OpenAI account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes + /// + /// + /// Operation Id + /// EncryptionScopes_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _encryptionScopeRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _encryptionScopeRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EncryptionScopeResource(Client, EncryptionScopeData.DeserializeEncryptionScopeData(e)), _encryptionScopeClientDiagnostics, Pipeline, "EncryptionScopeCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName} + /// + /// + /// Operation Id + /// EncryptionScopes_Get + /// + /// + /// + /// The name of the encryptionScope associated with the Cognitive Services Account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string encryptionScopeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(encryptionScopeName, nameof(encryptionScopeName)); + + using var scope = _encryptionScopeClientDiagnostics.CreateScope("EncryptionScopeCollection.Exists"); + scope.Start(); + try + { + var response = await _encryptionScopeRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, encryptionScopeName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName} + /// + /// + /// Operation Id + /// EncryptionScopes_Get + /// + /// + /// + /// The name of the encryptionScope associated with the Cognitive Services Account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string encryptionScopeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(encryptionScopeName, nameof(encryptionScopeName)); + + using var scope = _encryptionScopeClientDiagnostics.CreateScope("EncryptionScopeCollection.Exists"); + scope.Start(); + try + { + var response = _encryptionScopeRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, encryptionScopeName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName} + /// + /// + /// Operation Id + /// EncryptionScopes_Get + /// + /// + /// + /// The name of the encryptionScope associated with the Cognitive Services Account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string encryptionScopeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(encryptionScopeName, nameof(encryptionScopeName)); + + using var scope = _encryptionScopeClientDiagnostics.CreateScope("EncryptionScopeCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _encryptionScopeRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, encryptionScopeName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EncryptionScopeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName} + /// + /// + /// Operation Id + /// EncryptionScopes_Get + /// + /// + /// + /// The name of the encryptionScope associated with the Cognitive Services Account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string encryptionScopeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(encryptionScopeName, nameof(encryptionScopeName)); + + using var scope = _encryptionScopeClientDiagnostics.CreateScope("EncryptionScopeCollection.GetIfExists"); + scope.Start(); + try + { + var response = _encryptionScopeRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, encryptionScopeName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EncryptionScopeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/EncryptionScopeData.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/EncryptionScopeData.cs new file mode 100644 index 0000000000000..f130bcff76e1c --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/EncryptionScopeData.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.ResourceManager.CognitiveServices.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.CognitiveServices +{ + /// + /// A class representing the EncryptionScope data model. + /// Cognitive Services EncryptionScope + /// + public partial class EncryptionScopeData : ResourceData + { + /// Initializes a new instance of . + public EncryptionScopeData() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Resource Etag. + /// Resource tags. + /// Properties of Cognitive Services EncryptionScope. + internal EncryptionScopeData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ETag? etag, IDictionary tags, EncryptionScopeProperties properties) : base(id, name, resourceType, systemData) + { + ETag = etag; + Tags = tags; + Properties = properties; + } + + /// Resource Etag. + public ETag? ETag { get; } + /// Resource tags. + public IDictionary Tags { get; } + /// Properties of Cognitive Services EncryptionScope. + public EncryptionScopeProperties Properties { get; set; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/EncryptionScopeResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/EncryptionScopeResource.cs new file mode 100644 index 0000000000000..fbab178404582 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/EncryptionScopeResource.cs @@ -0,0 +1,590 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.CognitiveServices +{ + /// + /// A Class representing an EncryptionScope along with the instance operations that can be performed on it. + /// If you have a you can construct an + /// from an instance of using the GetEncryptionScopeResource method. + /// Otherwise you can get one from its parent resource using the GetEncryptionScope method. + /// + public partial class EncryptionScopeResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The encryptionScopeName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string encryptionScopeName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _encryptionScopeClientDiagnostics; + private readonly EncryptionScopesRestOperations _encryptionScopeRestClient; + private readonly EncryptionScopeData _data; + + /// Initializes a new instance of the class for mocking. + protected EncryptionScopeResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal EncryptionScopeResource(ArmClient client, EncryptionScopeData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal EncryptionScopeResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _encryptionScopeClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.CognitiveServices", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string encryptionScopeApiVersion); + _encryptionScopeRestClient = new EncryptionScopesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, encryptionScopeApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.CognitiveServices/accounts/encryptionScopes"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual EncryptionScopeData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the specified EncryptionScope associated with the Cognitive Services account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName} + /// + /// + /// Operation Id + /// EncryptionScopes_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _encryptionScopeClientDiagnostics.CreateScope("EncryptionScopeResource.Get"); + scope.Start(); + try + { + var response = await _encryptionScopeRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new EncryptionScopeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the specified EncryptionScope associated with the Cognitive Services account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName} + /// + /// + /// Operation Id + /// EncryptionScopes_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _encryptionScopeClientDiagnostics.CreateScope("EncryptionScopeResource.Get"); + scope.Start(); + try + { + var response = _encryptionScopeRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new EncryptionScopeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified encryptionScope associated with the Cognitive Services account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName} + /// + /// + /// Operation Id + /// EncryptionScopes_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _encryptionScopeClientDiagnostics.CreateScope("EncryptionScopeResource.Delete"); + scope.Start(); + try + { + var response = await _encryptionScopeRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new CognitiveServicesArmOperation(_encryptionScopeClientDiagnostics, Pipeline, _encryptionScopeRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified encryptionScope associated with the Cognitive Services account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName} + /// + /// + /// Operation Id + /// EncryptionScopes_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _encryptionScopeClientDiagnostics.CreateScope("EncryptionScopeResource.Delete"); + scope.Start(); + try + { + var response = _encryptionScopeRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new CognitiveServicesArmOperation(_encryptionScopeClientDiagnostics, Pipeline, _encryptionScopeRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update the state of specified encryptionScope associated with the Cognitive Services account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName} + /// + /// + /// Operation Id + /// EncryptionScopes_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The encryptionScope properties. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, EncryptionScopeData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _encryptionScopeClientDiagnostics.CreateScope("EncryptionScopeResource.Update"); + scope.Start(); + try + { + var response = await _encryptionScopeRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new CognitiveServicesArmOperation(Response.FromValue(new EncryptionScopeResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update the state of specified encryptionScope associated with the Cognitive Services account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName} + /// + /// + /// Operation Id + /// EncryptionScopes_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The encryptionScope properties. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, EncryptionScopeData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _encryptionScopeClientDiagnostics.CreateScope("EncryptionScopeResource.Update"); + scope.Start(); + try + { + var response = _encryptionScopeRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new CognitiveServicesArmOperation(Response.FromValue(new EncryptionScopeResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName} + /// + /// + /// Operation Id + /// EncryptionScopes_Get + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _encryptionScopeClientDiagnostics.CreateScope("EncryptionScopeResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _encryptionScopeRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new EncryptionScopeResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + current.Tags[key] = value; + var result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName} + /// + /// + /// Operation Id + /// EncryptionScopes_Get + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _encryptionScopeClientDiagnostics.CreateScope("EncryptionScopeResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _encryptionScopeRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new EncryptionScopeResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + current.Tags[key] = value; + var result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName} + /// + /// + /// Operation Id + /// EncryptionScopes_Get + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _encryptionScopeClientDiagnostics.CreateScope("EncryptionScopeResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _encryptionScopeRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new EncryptionScopeResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + current.Tags.ReplaceWith(tags); + var result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName} + /// + /// + /// Operation Id + /// EncryptionScopes_Get + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _encryptionScopeClientDiagnostics.CreateScope("EncryptionScopeResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _encryptionScopeRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new EncryptionScopeResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + current.Tags.ReplaceWith(tags); + var result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName} + /// + /// + /// Operation Id + /// EncryptionScopes_Get + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _encryptionScopeClientDiagnostics.CreateScope("EncryptionScopeResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _encryptionScopeRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new EncryptionScopeResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + current.Tags.Remove(key); + var result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName} + /// + /// + /// Operation Id + /// EncryptionScopes_Get + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _encryptionScopeClientDiagnostics.CreateScope("EncryptionScopeResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _encryptionScopeRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new EncryptionScopeResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + current.Tags.Remove(key); + var result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/CognitiveServicesExtensions.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/CognitiveServicesExtensions.cs index bbe4957107b02..ef504f9ad95a8 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/CognitiveServicesExtensions.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/CognitiveServicesExtensions.cs @@ -168,6 +168,82 @@ public static CommitmentPlanAccountAssociationResource GetCommitmentPlanAccountA return GetMockableCognitiveServicesArmClient(client).GetCommitmentPlanAccountAssociationResource(id); } + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static EncryptionScopeResource GetEncryptionScopeResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableCognitiveServicesArmClient(client).GetEncryptionScopeResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static RaiPolicyResource GetRaiPolicyResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableCognitiveServicesArmClient(client).GetRaiPolicyResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static RaiBlocklistResource GetRaiBlocklistResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableCognitiveServicesArmClient(client).GetRaiBlocklistResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static RaiBlocklistItemResource GetRaiBlocklistItemResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableCognitiveServicesArmClient(client).GetRaiBlocklistItemResource(id); + } + /// /// Gets a collection of CognitiveServicesAccountResources in the ResourceGroupResource. /// @@ -918,5 +994,63 @@ public static Pageable GetCognitiveServ return GetMockableCognitiveServicesSubscriptionResource(subscriptionResource).GetCognitiveServicesCommitmentPlans(cancellationToken); } + + /// + /// List Content Filters types. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/raiContentFilters + /// + /// + /// Operation Id + /// RaiContentFilters_List + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Resource location. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetRaiContentFiltersAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableCognitiveServicesSubscriptionResource(subscriptionResource).GetRaiContentFiltersAsync(location, cancellationToken); + } + + /// + /// List Content Filters types. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/raiContentFilters + /// + /// + /// Operation Id + /// RaiContentFilters_List + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Resource location. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetRaiContentFilters(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableCognitiveServicesSubscriptionResource(subscriptionResource).GetRaiContentFilters(location, cancellationToken); + } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/MockableCognitiveServicesArmClient.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/MockableCognitiveServicesArmClient.cs index 731ef8dc2e300..dac6d73c47214 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/MockableCognitiveServicesArmClient.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/MockableCognitiveServicesArmClient.cs @@ -119,5 +119,53 @@ public virtual CommitmentPlanAccountAssociationResource GetCommitmentPlanAccount CommitmentPlanAccountAssociationResource.ValidateResourceId(id); return new CommitmentPlanAccountAssociationResource(Client, id); } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual EncryptionScopeResource GetEncryptionScopeResource(ResourceIdentifier id) + { + EncryptionScopeResource.ValidateResourceId(id); + return new EncryptionScopeResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RaiPolicyResource GetRaiPolicyResource(ResourceIdentifier id) + { + RaiPolicyResource.ValidateResourceId(id); + return new RaiPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RaiBlocklistResource GetRaiBlocklistResource(ResourceIdentifier id) + { + RaiBlocklistResource.ValidateResourceId(id); + return new RaiBlocklistResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RaiBlocklistItemResource GetRaiBlocklistItemResource(ResourceIdentifier id) + { + RaiBlocklistItemResource.ValidateResourceId(id); + return new RaiBlocklistItemResource(Client, id); + } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/MockableCognitiveServicesSubscriptionResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/MockableCognitiveServicesSubscriptionResource.cs index 341ad2aa9221d..0b779ece3a4ec 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/MockableCognitiveServicesSubscriptionResource.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/MockableCognitiveServicesSubscriptionResource.cs @@ -37,6 +37,8 @@ public partial class MockableCognitiveServicesSubscriptionResource : ArmResource private ModelsRestOperations _modelsRestClient; private ClientDiagnostics _cognitiveServicesCommitmentPlanCommitmentPlansClientDiagnostics; private CommitmentPlansRestOperations _cognitiveServicesCommitmentPlanCommitmentPlansRestClient; + private ClientDiagnostics _raiContentFiltersClientDiagnostics; + private RaiContentFiltersRestOperations _raiContentFiltersRestClient; /// Initializes a new instance of the class for mocking. protected MockableCognitiveServicesSubscriptionResource() @@ -66,6 +68,8 @@ internal MockableCognitiveServicesSubscriptionResource(ArmClient client, Resourc private ModelsRestOperations ModelsRestClient => _modelsRestClient ??= new ModelsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); private ClientDiagnostics CognitiveServicesCommitmentPlanCommitmentPlansClientDiagnostics => _cognitiveServicesCommitmentPlanCommitmentPlansClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CognitiveServices", CognitiveServicesCommitmentPlanResource.ResourceType.Namespace, Diagnostics); private CommitmentPlansRestOperations CognitiveServicesCommitmentPlanCommitmentPlansRestClient => _cognitiveServicesCommitmentPlanCommitmentPlansRestClient ??= new CommitmentPlansRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(CognitiveServicesCommitmentPlanResource.ResourceType)); + private ClientDiagnostics RaiContentFiltersClientDiagnostics => _raiContentFiltersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CognitiveServices", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private RaiContentFiltersRestOperations RaiContentFiltersRestClient => _raiContentFiltersRestClient ??= new RaiContentFiltersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); private string GetApiVersionOrNull(ResourceType resourceType) { @@ -565,5 +569,49 @@ public virtual Pageable GetCognitiveSer HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CognitiveServicesCommitmentPlanCommitmentPlansRestClient.CreateListPlansBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new CognitiveServicesCommitmentPlanResource(Client, CommitmentPlanData.DeserializeCommitmentPlanData(e)), CognitiveServicesCommitmentPlanCommitmentPlansClientDiagnostics, Pipeline, "MockableCognitiveServicesSubscriptionResource.GetCognitiveServicesCommitmentPlans", "value", "nextLink", cancellationToken); } + + /// + /// List Content Filters types. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/raiContentFilters + /// + /// + /// Operation Id + /// RaiContentFilters_List + /// + /// + /// + /// Resource location. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetRaiContentFiltersAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => RaiContentFiltersRestClient.CreateListRequest(Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, RaiContentFilter.DeserializeRaiContentFilter, RaiContentFiltersClientDiagnostics, Pipeline, "MockableCognitiveServicesSubscriptionResource.GetRaiContentFilters", "value", null, cancellationToken); + } + + /// + /// List Content Filters types. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/raiContentFilters + /// + /// + /// Operation Id + /// RaiContentFilters_List + /// + /// + /// + /// Resource location. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetRaiContentFilters(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => RaiContentFiltersRestClient.CreateListRequest(Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, RaiContentFilter.DeserializeRaiContentFilter, RaiContentFiltersClientDiagnostics, Pipeline, "MockableCognitiveServicesSubscriptionResource.GetRaiContentFilters", "value", null, cancellationToken); + } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/AllowedContentLevel.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/AllowedContentLevel.cs new file mode 100644 index 0000000000000..c4d9fff72e8b8 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/AllowedContentLevel.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// Level at which content is filtered. + public readonly partial struct AllowedContentLevel : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AllowedContentLevel(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string LowValue = "Low"; + private const string MediumValue = "Medium"; + private const string HighValue = "High"; + + /// Low. + public static AllowedContentLevel Low { get; } = new AllowedContentLevel(LowValue); + /// Medium. + public static AllowedContentLevel Medium { get; } = new AllowedContentLevel(MediumValue); + /// High. + public static AllowedContentLevel High { get; } = new AllowedContentLevel(HighValue); + /// Determines if two values are the same. + public static bool operator ==(AllowedContentLevel left, AllowedContentLevel right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AllowedContentLevel left, AllowedContentLevel right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AllowedContentLevel(string value) => new AllowedContentLevel(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AllowedContentLevel other && Equals(other); + /// + public bool Equals(AllowedContentLevel other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ByPassSelection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ByPassSelection.cs new file mode 100644 index 0000000000000..1e73399ca1d8c --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ByPassSelection.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// Setting for trusted services. + public readonly partial struct ByPassSelection : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ByPassSelection(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NoneValue = "None"; + private const string AzureServicesValue = "AzureServices"; + + /// None. + public static ByPassSelection None { get; } = new ByPassSelection(NoneValue); + /// AzureServices. + public static ByPassSelection AzureServices { get; } = new ByPassSelection(AzureServicesValue); + /// Determines if two values are the same. + public static bool operator ==(ByPassSelection left, ByPassSelection right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ByPassSelection left, ByPassSelection right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ByPassSelection(string value) => new ByPassSelection(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ByPassSelection other && Equals(other); + /// + public bool Equals(ByPassSelection other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentData.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentData.Serialization.cs index 23bfb1dc6c592..32002697e9990 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentData.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentData.Serialization.cs @@ -5,6 +5,7 @@ #nullable disable +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; @@ -23,6 +24,17 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("sku"u8); writer.WriteObjectValue(Sku); } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } if (Optional.IsDefined(Properties)) { writer.WritePropertyName("properties"u8); @@ -39,6 +51,7 @@ internal static CognitiveServicesAccountDeploymentData DeserializeCognitiveServi } Optional sku = default; Optional etag = default; + Optional> tags = default; Optional properties = default; ResourceIdentifier id = default; string name = default; @@ -64,6 +77,20 @@ internal static CognitiveServicesAccountDeploymentData DeserializeCognitiveServi etag = new ETag(property.Value.GetString()); continue; } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } if (property.NameEquals("properties"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -98,7 +125,7 @@ internal static CognitiveServicesAccountDeploymentData DeserializeCognitiveServi continue; } } - return new CognitiveServicesAccountDeploymentData(id, name, type, systemData.Value, sku.Value, Optional.ToNullable(etag), properties.Value); + return new CognitiveServicesAccountDeploymentData(id, name, type, systemData.Value, sku.Value, Optional.ToNullable(etag), Optional.ToDictionary(tags), properties.Value); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentProperties.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentProperties.Serialization.cs index 98f35dc63466c..fa9adac4ca71b 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentProperties.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentProperties.Serialization.cs @@ -36,6 +36,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("versionUpgradeOption"u8); writer.WriteStringValue(VersionUpgradeOption.Value.ToString()); } + if (Optional.IsDefined(CurrentCapacity)) + { + writer.WritePropertyName("currentCapacity"u8); + writer.WriteNumberValue(CurrentCapacity.Value); + } + if (Optional.IsDefined(CapacitySettings)) + { + writer.WritePropertyName("capacitySettings"u8); + writer.WriteObjectValue(CapacitySettings); + } writer.WriteEndObject(); } @@ -53,6 +63,9 @@ internal static CognitiveServicesAccountDeploymentProperties DeserializeCognitiv Optional callRateLimit = default; Optional> rateLimits = default; Optional versionUpgradeOption = default; + Optional dynamicThrottlingEnabled = default; + Optional currentCapacity = default; + Optional capacitySettings = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("provisioningState"u8)) @@ -133,8 +146,35 @@ internal static CognitiveServicesAccountDeploymentProperties DeserializeCognitiv versionUpgradeOption = new DeploymentModelVersionUpgradeOption(property.Value.GetString()); continue; } + if (property.NameEquals("dynamicThrottlingEnabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dynamicThrottlingEnabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("currentCapacity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + currentCapacity = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("capacitySettings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + capacitySettings = DeploymentCapacitySettings.DeserializeDeploymentCapacitySettings(property.Value); + continue; + } } - return new CognitiveServicesAccountDeploymentProperties(Optional.ToNullable(provisioningState), model.Value, scaleSettings.Value, Optional.ToDictionary(capabilities), raiPolicyName.Value, callRateLimit.Value, Optional.ToList(rateLimits), Optional.ToNullable(versionUpgradeOption)); + return new CognitiveServicesAccountDeploymentProperties(Optional.ToNullable(provisioningState), model.Value, scaleSettings.Value, Optional.ToDictionary(capabilities), raiPolicyName.Value, callRateLimit.Value, Optional.ToList(rateLimits), Optional.ToNullable(versionUpgradeOption), Optional.ToNullable(dynamicThrottlingEnabled), Optional.ToNullable(currentCapacity), capacitySettings.Value); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentProperties.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentProperties.cs index 182a2fbe2a983..ef0bb07d01c80 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentProperties.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentProperties.cs @@ -23,13 +23,16 @@ public CognitiveServicesAccountDeploymentProperties() /// Initializes a new instance of . /// Gets the status of the resource at the time the operation was called. /// Properties of Cognitive Services account deployment model. - /// Properties of Cognitive Services account deployment model. + /// Properties of Cognitive Services account deployment model. (Deprecated, please use Deployment.sku instead.). /// The capabilities. /// The name of RAI policy. /// The call rate limit Cognitive Services account. /// /// Deployment model version upgrade option. - internal CognitiveServicesAccountDeploymentProperties(CognitiveServicesAccountDeploymentProvisioningState? provisioningState, CognitiveServicesAccountDeploymentModel model, CognitiveServicesAccountDeploymentScaleSettings scaleSettings, IReadOnlyDictionary capabilities, string raiPolicyName, ServiceAccountCallRateLimit callRateLimit, IReadOnlyList rateLimits, DeploymentModelVersionUpgradeOption? versionUpgradeOption) + /// If the dynamic throttling is enabled. + /// The current capacity. + /// Internal use only. + internal CognitiveServicesAccountDeploymentProperties(CognitiveServicesAccountDeploymentProvisioningState? provisioningState, CognitiveServicesAccountDeploymentModel model, CognitiveServicesAccountDeploymentScaleSettings scaleSettings, IReadOnlyDictionary capabilities, string raiPolicyName, ServiceAccountCallRateLimit callRateLimit, IReadOnlyList rateLimits, DeploymentModelVersionUpgradeOption? versionUpgradeOption, bool? dynamicThrottlingEnabled, int? currentCapacity, DeploymentCapacitySettings capacitySettings) { ProvisioningState = provisioningState; Model = model; @@ -39,13 +42,16 @@ internal CognitiveServicesAccountDeploymentProperties(CognitiveServicesAccountDe CallRateLimit = callRateLimit; RateLimits = rateLimits; VersionUpgradeOption = versionUpgradeOption; + DynamicThrottlingEnabled = dynamicThrottlingEnabled; + CurrentCapacity = currentCapacity; + CapacitySettings = capacitySettings; } /// Gets the status of the resource at the time the operation was called. public CognitiveServicesAccountDeploymentProvisioningState? ProvisioningState { get; } /// Properties of Cognitive Services account deployment model. public CognitiveServicesAccountDeploymentModel Model { get; set; } - /// Properties of Cognitive Services account deployment model. + /// Properties of Cognitive Services account deployment model. (Deprecated, please use Deployment.sku instead.). public CognitiveServicesAccountDeploymentScaleSettings ScaleSettings { get; set; } /// The capabilities. public IReadOnlyDictionary Capabilities { get; } @@ -57,5 +63,11 @@ internal CognitiveServicesAccountDeploymentProperties(CognitiveServicesAccountDe public IReadOnlyList RateLimits { get; } /// Deployment model version upgrade option. public DeploymentModelVersionUpgradeOption? VersionUpgradeOption { get; set; } + /// If the dynamic throttling is enabled. + public bool? DynamicThrottlingEnabled { get; } + /// The current capacity. + public int? CurrentCapacity { get; set; } + /// Internal use only. + public DeploymentCapacitySettings CapacitySettings { get; set; } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentScaleSettings.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentScaleSettings.cs index cdcd70a60c7dc..f2af8778551a4 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentScaleSettings.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentScaleSettings.cs @@ -7,7 +7,7 @@ namespace Azure.ResourceManager.CognitiveServices.Models { - /// Properties of Cognitive Services account deployment model. + /// Properties of Cognitive Services account deployment model. (Deprecated, please use Deployment.sku instead.). public partial class CognitiveServicesAccountDeploymentScaleSettings { /// Initializes a new instance of . diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountProperties.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountProperties.Serialization.cs index ef9d72c14c646..bd514811c6a41 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountProperties.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountProperties.Serialization.cs @@ -48,6 +48,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (Optional.IsDefined(AmlWorkspace)) + { + writer.WritePropertyName("amlWorkspace"u8); + writer.WriteObjectValue(AmlWorkspace); + } if (Optional.IsDefined(PublicNetworkAccess)) { writer.WritePropertyName("publicNetworkAccess"u8); @@ -112,6 +117,7 @@ internal static CognitiveServicesAccountProperties DeserializeCognitiveServicesA Optional networkAcls = default; Optional encryption = default; Optional> userOwnedStorage = default; + Optional amlWorkspace = default; Optional> privateEndpointConnections = default; Optional publicNetworkAccess = default; Optional apiProperties = default; @@ -219,6 +225,15 @@ internal static CognitiveServicesAccountProperties DeserializeCognitiveServicesA userOwnedStorage = array; continue; } + if (property.NameEquals("amlWorkspace"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + amlWorkspace = UserOwnedAmlWorkspace.DeserializeUserOwnedAmlWorkspace(property.Value); + continue; + } if (property.NameEquals("privateEndpointConnections"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -389,7 +404,7 @@ internal static CognitiveServicesAccountProperties DeserializeCognitiveServicesA continue; } } - return new CognitiveServicesAccountProperties(Optional.ToNullable(provisioningState), endpoint.Value, Optional.ToList(capabilities), Optional.ToNullable(isMigrated), migrationToken.Value, skuChangeInfo.Value, customSubDomainName.Value, networkAcls.Value, encryption.Value, Optional.ToList(userOwnedStorage), Optional.ToList(privateEndpointConnections), Optional.ToNullable(publicNetworkAccess), apiProperties.Value, Optional.ToNullable(dateCreated), callRateLimit.Value, Optional.ToNullable(dynamicThrottlingEnabled), quotaLimit.Value, Optional.ToNullable(restrictOutboundNetworkAccess), Optional.ToList(allowedFqdnList), Optional.ToNullable(disableLocalAuth), Optional.ToDictionary(endpoints), Optional.ToNullable(restore), Optional.ToNullable(deletionDate), scheduledPurgeDate.Value, locations.Value, Optional.ToList(commitmentPlanAssociations), abusePenalty.Value); + return new CognitiveServicesAccountProperties(Optional.ToNullable(provisioningState), endpoint.Value, Optional.ToList(capabilities), Optional.ToNullable(isMigrated), migrationToken.Value, skuChangeInfo.Value, customSubDomainName.Value, networkAcls.Value, encryption.Value, Optional.ToList(userOwnedStorage), amlWorkspace.Value, Optional.ToList(privateEndpointConnections), Optional.ToNullable(publicNetworkAccess), apiProperties.Value, Optional.ToNullable(dateCreated), callRateLimit.Value, Optional.ToNullable(dynamicThrottlingEnabled), quotaLimit.Value, Optional.ToNullable(restrictOutboundNetworkAccess), Optional.ToList(allowedFqdnList), Optional.ToNullable(disableLocalAuth), Optional.ToDictionary(endpoints), Optional.ToNullable(restore), Optional.ToNullable(deletionDate), scheduledPurgeDate.Value, locations.Value, Optional.ToList(commitmentPlanAssociations), abusePenalty.Value); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountProperties.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountProperties.cs index 414df96a6f43e..c8797194ac35e 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountProperties.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountProperties.cs @@ -37,6 +37,7 @@ public CognitiveServicesAccountProperties() /// A collection of rules governing the accessibility from specific network locations. /// The encryption properties for this resource. /// The storage accounts for this resource. + /// The user owned AML workspace properties. /// The private endpoint connection associated with the Cognitive Services account. /// Whether or not public endpoint access is allowed for this account. /// The api properties for special APIs. @@ -54,7 +55,7 @@ public CognitiveServicesAccountProperties() /// The multiregion settings of Cognitive Services account. /// The commitment plan associations of Cognitive Services account. /// The abuse penalty. - internal CognitiveServicesAccountProperties(ServiceAccountProvisioningState? provisioningState, string endpoint, IReadOnlyList capabilities, bool? isMigrated, string migrationToken, CognitiveServicesSkuChangeInfo skuChangeInfo, string customSubDomainName, CognitiveServicesNetworkRuleSet networkAcls, ServiceAccountEncryptionProperties encryption, IList userOwnedStorage, IReadOnlyList privateEndpointConnections, ServiceAccountPublicNetworkAccess? publicNetworkAccess, ServiceAccountApiProperties apiProperties, DateTimeOffset? createdOn, ServiceAccountCallRateLimit callRateLimit, bool? enableDynamicThrottling, ServiceAccountQuotaLimit quotaLimit, bool? restrictOutboundNetworkAccess, IList allowedFqdnList, bool? disableLocalAuth, IReadOnlyDictionary endpoints, bool? restore, DateTimeOffset? deletedOn, string scheduledPurgeDate, CognitiveServicesMultiRegionSettings locations, IReadOnlyList commitmentPlanAssociations, AbusePenalty abusePenalty) + internal CognitiveServicesAccountProperties(ServiceAccountProvisioningState? provisioningState, string endpoint, IReadOnlyList capabilities, bool? isMigrated, string migrationToken, CognitiveServicesSkuChangeInfo skuChangeInfo, string customSubDomainName, CognitiveServicesNetworkRuleSet networkAcls, ServiceAccountEncryptionProperties encryption, IList userOwnedStorage, UserOwnedAmlWorkspace amlWorkspace, IReadOnlyList privateEndpointConnections, ServiceAccountPublicNetworkAccess? publicNetworkAccess, ServiceAccountApiProperties apiProperties, DateTimeOffset? createdOn, ServiceAccountCallRateLimit callRateLimit, bool? enableDynamicThrottling, ServiceAccountQuotaLimit quotaLimit, bool? restrictOutboundNetworkAccess, IList allowedFqdnList, bool? disableLocalAuth, IReadOnlyDictionary endpoints, bool? restore, DateTimeOffset? deletedOn, string scheduledPurgeDate, CognitiveServicesMultiRegionSettings locations, IReadOnlyList commitmentPlanAssociations, AbusePenalty abusePenalty) { ProvisioningState = provisioningState; Endpoint = endpoint; @@ -66,6 +67,7 @@ internal CognitiveServicesAccountProperties(ServiceAccountProvisioningState? pro NetworkAcls = networkAcls; Encryption = encryption; UserOwnedStorage = userOwnedStorage; + AmlWorkspace = amlWorkspace; PrivateEndpointConnections = privateEndpointConnections; PublicNetworkAccess = publicNetworkAccess; ApiProperties = apiProperties; @@ -105,6 +107,8 @@ internal CognitiveServicesAccountProperties(ServiceAccountProvisioningState? pro public ServiceAccountEncryptionProperties Encryption { get; set; } /// The storage accounts for this resource. public IList UserOwnedStorage { get; } + /// The user owned AML workspace properties. + public UserOwnedAmlWorkspace AmlWorkspace { get; set; } /// The private endpoint connection associated with the Cognitive Services account. public IReadOnlyList PrivateEndpointConnections { get; } /// Whether or not public endpoint access is allowed for this account. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesCapacityConfig.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesCapacityConfig.Serialization.cs index 511978dedd2f5..9604b6fcc9190 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesCapacityConfig.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesCapacityConfig.Serialization.cs @@ -5,6 +5,7 @@ #nullable disable +using System.Collections.Generic; using System.Text.Json; using Azure.Core; @@ -35,6 +36,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("default"u8); writer.WriteNumberValue(Default.Value); } + if (Optional.IsCollectionDefined(AllowedValues)) + { + writer.WritePropertyName("allowedValues"u8); + writer.WriteStartArray(); + foreach (var item in AllowedValues) + { + writer.WriteNumberValue(item); + } + writer.WriteEndArray(); + } writer.WriteEndObject(); } @@ -48,6 +59,7 @@ internal static CognitiveServicesCapacityConfig DeserializeCognitiveServicesCapa Optional maximum = default; Optional step = default; Optional @default = default; + Optional> allowedValues = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("minimum"u8)) @@ -86,8 +98,22 @@ internal static CognitiveServicesCapacityConfig DeserializeCognitiveServicesCapa @default = property.Value.GetInt32(); continue; } + if (property.NameEquals("allowedValues"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetInt32()); + } + allowedValues = array; + continue; + } } - return new CognitiveServicesCapacityConfig(Optional.ToNullable(minimum), Optional.ToNullable(maximum), Optional.ToNullable(step), Optional.ToNullable(@default)); + return new CognitiveServicesCapacityConfig(Optional.ToNullable(minimum), Optional.ToNullable(maximum), Optional.ToNullable(step), Optional.ToNullable(@default), Optional.ToList(allowedValues)); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesCapacityConfig.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesCapacityConfig.cs index 6dbd97bb51ed0..1e152c53031d4 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesCapacityConfig.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesCapacityConfig.cs @@ -5,6 +5,9 @@ #nullable disable +using System.Collections.Generic; +using Azure.Core; + namespace Azure.ResourceManager.CognitiveServices.Models { /// The capacity configuration. @@ -13,6 +16,7 @@ public partial class CognitiveServicesCapacityConfig /// Initializes a new instance of . public CognitiveServicesCapacityConfig() { + AllowedValues = new ChangeTrackingList(); } /// Initializes a new instance of . @@ -20,12 +24,14 @@ public CognitiveServicesCapacityConfig() /// The maximum capacity. /// The minimal incremental between allowed values for capacity. /// The default capacity. - internal CognitiveServicesCapacityConfig(int? minimum, int? maximum, int? step, int? @default) + /// The array of allowed values for capacity. + internal CognitiveServicesCapacityConfig(int? minimum, int? maximum, int? step, int? @default, IList allowedValues) { Minimum = minimum; Maximum = maximum; Step = step; Default = @default; + AllowedValues = allowedValues; } /// The minimum capacity. @@ -36,5 +42,7 @@ internal CognitiveServicesCapacityConfig(int? minimum, int? maximum, int? step, public int? Step { get; set; } /// The default capacity. public int? Default { get; set; } + /// The array of allowed values for capacity. + public IList AllowedValues { get; } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesNetworkRuleSet.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesNetworkRuleSet.Serialization.cs index 86a09963391d8..e283dac08e903 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesNetworkRuleSet.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesNetworkRuleSet.Serialization.cs @@ -21,6 +21,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("defaultAction"u8); writer.WriteStringValue(DefaultAction.Value.ToString()); } + if (Optional.IsDefined(Bypass)) + { + writer.WritePropertyName("bypass"u8); + writer.WriteStringValue(Bypass.Value.ToString()); + } if (Optional.IsCollectionDefined(IPRules)) { writer.WritePropertyName("ipRules"u8); @@ -51,6 +56,7 @@ internal static CognitiveServicesNetworkRuleSet DeserializeCognitiveServicesNetw return null; } Optional defaultAction = default; + Optional bypass = default; Optional> ipRules = default; Optional> virtualNetworkRules = default; foreach (var property in element.EnumerateObject()) @@ -64,6 +70,15 @@ internal static CognitiveServicesNetworkRuleSet DeserializeCognitiveServicesNetw defaultAction = new CognitiveServicesNetworkRuleAction(property.Value.GetString()); continue; } + if (property.NameEquals("bypass"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + bypass = new ByPassSelection(property.Value.GetString()); + continue; + } if (property.NameEquals("ipRules"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -93,7 +108,7 @@ internal static CognitiveServicesNetworkRuleSet DeserializeCognitiveServicesNetw continue; } } - return new CognitiveServicesNetworkRuleSet(Optional.ToNullable(defaultAction), Optional.ToList(ipRules), Optional.ToList(virtualNetworkRules)); + return new CognitiveServicesNetworkRuleSet(Optional.ToNullable(defaultAction), Optional.ToNullable(bypass), Optional.ToList(ipRules), Optional.ToList(virtualNetworkRules)); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesNetworkRuleSet.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesNetworkRuleSet.cs index f1510b2707459..ba5108a8d21ef 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesNetworkRuleSet.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesNetworkRuleSet.cs @@ -22,17 +22,21 @@ public CognitiveServicesNetworkRuleSet() /// Initializes a new instance of . /// The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. + /// Setting for trusted services. /// The list of IP address rules. /// The list of virtual network rules. - internal CognitiveServicesNetworkRuleSet(CognitiveServicesNetworkRuleAction? defaultAction, IList ipRules, IList virtualNetworkRules) + internal CognitiveServicesNetworkRuleSet(CognitiveServicesNetworkRuleAction? defaultAction, ByPassSelection? bypass, IList ipRules, IList virtualNetworkRules) { DefaultAction = defaultAction; + Bypass = bypass; IPRules = ipRules; VirtualNetworkRules = virtualNetworkRules; } /// The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. public CognitiveServicesNetworkRuleAction? DefaultAction { get; set; } + /// Setting for trusted services. + public ByPassSelection? Bypass { get; set; } /// The list of IP address rules. public IList IPRules { get; } /// The list of virtual network rules. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanAccountAssociationData.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanAccountAssociationData.Serialization.cs index 2e1f200c1229f..fc53355390454 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanAccountAssociationData.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CommitmentPlanAccountAssociationData.Serialization.cs @@ -5,6 +5,7 @@ #nullable disable +using System.Collections.Generic; using System.Text.Json; using Azure; using Azure.Core; @@ -17,6 +18,17 @@ public partial class CommitmentPlanAccountAssociationData : IUtf8JsonSerializabl void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(AccountId)) @@ -35,6 +47,7 @@ internal static CommitmentPlanAccountAssociationData DeserializeCommitmentPlanAc return null; } Optional etag = default; + Optional> tags = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; @@ -51,6 +64,20 @@ internal static CommitmentPlanAccountAssociationData DeserializeCommitmentPlanAc etag = new ETag(property.Value.GetString()); continue; } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } if (property.NameEquals("id"u8)) { id = new ResourceIdentifier(property.Value.GetString()); @@ -93,7 +120,7 @@ internal static CommitmentPlanAccountAssociationData DeserializeCommitmentPlanAc continue; } } - return new CommitmentPlanAccountAssociationData(id, name, type, systemData.Value, Optional.ToNullable(etag), accountId.Value); + return new CommitmentPlanAccountAssociationData(id, name, type, systemData.Value, Optional.ToNullable(etag), Optional.ToDictionary(tags), accountId.Value); } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/DeploymentCapacitySettings.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/DeploymentCapacitySettings.Serialization.cs new file mode 100644 index 0000000000000..82a30885b3e7c --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/DeploymentCapacitySettings.Serialization.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + public partial class DeploymentCapacitySettings : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(DesignatedCapacity)) + { + writer.WritePropertyName("designatedCapacity"u8); + writer.WriteNumberValue(DesignatedCapacity.Value); + } + if (Optional.IsDefined(Priority)) + { + writer.WritePropertyName("priority"u8); + writer.WriteNumberValue(Priority.Value); + } + writer.WriteEndObject(); + } + + internal static DeploymentCapacitySettings DeserializeDeploymentCapacitySettings(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional designatedCapacity = default; + Optional priority = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("designatedCapacity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + designatedCapacity = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("priority"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + priority = property.Value.GetInt32(); + continue; + } + } + return new DeploymentCapacitySettings(Optional.ToNullable(designatedCapacity), Optional.ToNullable(priority)); + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/DeploymentCapacitySettings.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/DeploymentCapacitySettings.cs new file mode 100644 index 0000000000000..e01cac91a0d0b --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/DeploymentCapacitySettings.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// Internal use only. + public partial class DeploymentCapacitySettings + { + /// Initializes a new instance of . + public DeploymentCapacitySettings() + { + } + + /// Initializes a new instance of . + /// The designated capacity. + /// The priority of this capacity setting. + internal DeploymentCapacitySettings(int? designatedCapacity, int? priority) + { + DesignatedCapacity = designatedCapacity; + Priority = priority; + } + + /// The designated capacity. + public int? DesignatedCapacity { get; set; } + /// The priority of this capacity setting. + public int? Priority { get; set; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/DeploymentSkuListResult.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/DeploymentSkuListResult.Serialization.cs new file mode 100644 index 0000000000000..2bb18f756f7ba --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/DeploymentSkuListResult.Serialization.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + internal partial class DeploymentSkuListResult + { + internal static DeploymentSkuListResult DeserializeDeploymentSkuListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional nextLink = default; + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SkuResource.DeserializeSkuResource(item)); + } + value = array; + continue; + } + } + return new DeploymentSkuListResult(nextLink.Value, Optional.ToList(value)); + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/DeploymentSkuListResult.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/DeploymentSkuListResult.cs new file mode 100644 index 0000000000000..d4d9d415f5705 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/DeploymentSkuListResult.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// The list of cognitive services accounts operation response. + internal partial class DeploymentSkuListResult + { + /// Initializes a new instance of . + internal DeploymentSkuListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The link used to get the next page of deployment skus. + /// Gets the list of Cognitive Services accounts deployment skus. + internal DeploymentSkuListResult(string nextLink, IReadOnlyList value) + { + NextLink = nextLink; + Value = value; + } + + /// The link used to get the next page of deployment skus. + public string NextLink { get; } + /// Gets the list of Cognitive Services accounts deployment skus. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/EncryptionScopeData.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/EncryptionScopeData.Serialization.cs new file mode 100644 index 0000000000000..9477982dd2426 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/EncryptionScopeData.Serialization.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.ResourceManager.CognitiveServices.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.CognitiveServices +{ + public partial class EncryptionScopeData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + writer.WriteEndObject(); + } + + internal static EncryptionScopeData DeserializeEncryptionScopeData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional etag = default; + Optional> tags = default; + Optional properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("etag"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + etag = new ETag(property.Value.GetString()); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = EncryptionScopeProperties.DeserializeEncryptionScopeProperties(property.Value); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + } + return new EncryptionScopeData(id, name, type, systemData.Value, Optional.ToNullable(etag), Optional.ToDictionary(tags), properties.Value); + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/EncryptionScopeListResult.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/EncryptionScopeListResult.Serialization.cs new file mode 100644 index 0000000000000..1704efec05dec --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/EncryptionScopeListResult.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.CognitiveServices; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + internal partial class EncryptionScopeListResult + { + internal static EncryptionScopeListResult DeserializeEncryptionScopeListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional nextLink = default; + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(EncryptionScopeData.DeserializeEncryptionScopeData(item)); + } + value = array; + continue; + } + } + return new EncryptionScopeListResult(nextLink.Value, Optional.ToList(value)); + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/EncryptionScopeListResult.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/EncryptionScopeListResult.cs new file mode 100644 index 0000000000000..35804e850fda3 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/EncryptionScopeListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.CognitiveServices; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// The list of cognitive services EncryptionScopes. + internal partial class EncryptionScopeListResult + { + /// Initializes a new instance of . + internal EncryptionScopeListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The link used to get the next page of EncryptionScope. + /// The list of EncryptionScope. + internal EncryptionScopeListResult(string nextLink, IReadOnlyList value) + { + NextLink = nextLink; + Value = value; + } + + /// The link used to get the next page of EncryptionScope. + public string NextLink { get; } + /// The list of EncryptionScope. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/EncryptionScopeProperties.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/EncryptionScopeProperties.Serialization.cs new file mode 100644 index 0000000000000..3598fdeaaf676 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/EncryptionScopeProperties.Serialization.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + public partial class EncryptionScopeProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(State)) + { + writer.WritePropertyName("state"u8); + writer.WriteStringValue(State.Value.ToString()); + } + if (Optional.IsDefined(KeyVaultProperties)) + { + writer.WritePropertyName("keyVaultProperties"u8); + writer.WriteObjectValue(KeyVaultProperties); + } + if (Optional.IsDefined(KeySource)) + { + writer.WritePropertyName("keySource"u8); + writer.WriteStringValue(KeySource.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static EncryptionScopeProperties DeserializeEncryptionScopeProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional provisioningState = default; + Optional state = default; + Optional keyVaultProperties = default; + Optional keySource = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new EncryptionScopeProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("state"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + state = new EncryptionScopeState(property.Value.GetString()); + continue; + } + if (property.NameEquals("keyVaultProperties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keyVaultProperties = CognitiveServicesKeyVaultProperties.DeserializeCognitiveServicesKeyVaultProperties(property.Value); + continue; + } + if (property.NameEquals("keySource"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keySource = new ServiceAccountEncryptionKeySource(property.Value.GetString()); + continue; + } + } + return new EncryptionScopeProperties(keyVaultProperties.Value, Optional.ToNullable(keySource), Optional.ToNullable(provisioningState), Optional.ToNullable(state)); + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/EncryptionScopeProperties.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/EncryptionScopeProperties.cs new file mode 100644 index 0000000000000..5ba8a56852f5b --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/EncryptionScopeProperties.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// Properties to EncryptionScope. + public partial class EncryptionScopeProperties : ServiceAccountEncryptionProperties + { + /// Initializes a new instance of . + public EncryptionScopeProperties() + { + } + + /// Initializes a new instance of . + /// Properties of KeyVault. + /// Enumerates the possible value of keySource for Encryption. + /// Gets the status of the resource at the time the operation was called. + /// The encryptionScope state. + internal EncryptionScopeProperties(CognitiveServicesKeyVaultProperties keyVaultProperties, ServiceAccountEncryptionKeySource? keySource, EncryptionScopeProvisioningState? provisioningState, EncryptionScopeState? state) : base(keyVaultProperties, keySource) + { + ProvisioningState = provisioningState; + State = state; + } + + /// Gets the status of the resource at the time the operation was called. + public EncryptionScopeProvisioningState? ProvisioningState { get; } + /// The encryptionScope state. + public EncryptionScopeState? State { get; set; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/EncryptionScopeProvisioningState.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/EncryptionScopeProvisioningState.cs new file mode 100644 index 0000000000000..e0b79096c10af --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/EncryptionScopeProvisioningState.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// Gets the status of the resource at the time the operation was called. + public readonly partial struct EncryptionScopeProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public EncryptionScopeProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AcceptedValue = "Accepted"; + private const string CreatingValue = "Creating"; + private const string DeletingValue = "Deleting"; + private const string MovingValue = "Moving"; + private const string FailedValue = "Failed"; + private const string SucceededValue = "Succeeded"; + private const string CanceledValue = "Canceled"; + + /// Accepted. + public static EncryptionScopeProvisioningState Accepted { get; } = new EncryptionScopeProvisioningState(AcceptedValue); + /// Creating. + public static EncryptionScopeProvisioningState Creating { get; } = new EncryptionScopeProvisioningState(CreatingValue); + /// Deleting. + public static EncryptionScopeProvisioningState Deleting { get; } = new EncryptionScopeProvisioningState(DeletingValue); + /// Moving. + public static EncryptionScopeProvisioningState Moving { get; } = new EncryptionScopeProvisioningState(MovingValue); + /// Failed. + public static EncryptionScopeProvisioningState Failed { get; } = new EncryptionScopeProvisioningState(FailedValue); + /// Succeeded. + public static EncryptionScopeProvisioningState Succeeded { get; } = new EncryptionScopeProvisioningState(SucceededValue); + /// Canceled. + public static EncryptionScopeProvisioningState Canceled { get; } = new EncryptionScopeProvisioningState(CanceledValue); + /// Determines if two values are the same. + public static bool operator ==(EncryptionScopeProvisioningState left, EncryptionScopeProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(EncryptionScopeProvisioningState left, EncryptionScopeProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator EncryptionScopeProvisioningState(string value) => new EncryptionScopeProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is EncryptionScopeProvisioningState other && Equals(other); + /// + public bool Equals(EncryptionScopeProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/EncryptionScopeState.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/EncryptionScopeState.cs new file mode 100644 index 0000000000000..b05881888b410 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/EncryptionScopeState.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// The encryptionScope state. + public readonly partial struct EncryptionScopeState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public EncryptionScopeState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DisabledValue = "Disabled"; + private const string EnabledValue = "Enabled"; + + /// Disabled. + public static EncryptionScopeState Disabled { get; } = new EncryptionScopeState(DisabledValue); + /// Enabled. + public static EncryptionScopeState Enabled { get; } = new EncryptionScopeState(EnabledValue); + /// Determines if two values are the same. + public static bool operator ==(EncryptionScopeState left, EncryptionScopeState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(EncryptionScopeState left, EncryptionScopeState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator EncryptionScopeState(string value) => new EncryptionScopeState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is EncryptionScopeState other && Equals(other); + /// + public bool Equals(EncryptionScopeState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesCommitmentPlanPatch.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/PatchResourceTagsAndSku.Serialization.cs similarity index 91% rename from sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesCommitmentPlanPatch.Serialization.cs rename to sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/PatchResourceTagsAndSku.Serialization.cs index 2e54f2bcdd69c..8554914355284 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesCommitmentPlanPatch.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/PatchResourceTagsAndSku.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class CognitiveServicesCommitmentPlanPatch : IUtf8JsonSerializable + public partial class PatchResourceTagsAndSku : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesCommitmentPlanPatch.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/PatchResourceTagsAndSku.cs similarity index 64% rename from sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesCommitmentPlanPatch.cs rename to sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/PatchResourceTagsAndSku.cs index f0bf536a1f81c..34cf5a5974b10 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesCommitmentPlanPatch.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/PatchResourceTagsAndSku.cs @@ -8,10 +8,10 @@ namespace Azure.ResourceManager.CognitiveServices.Models { /// The object being used to update tags and sku of a resource, in general used for PATCH operations. - public partial class CognitiveServicesCommitmentPlanPatch : CognitiveServicesPatchResourceTags + public partial class PatchResourceTagsAndSku : CognitiveServicesPatchResourceTags { - /// Initializes a new instance of . - public CognitiveServicesCommitmentPlanPatch() + /// Initializes a new instance of . + public PatchResourceTagsAndSku() { } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlockListItemsResult.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlockListItemsResult.Serialization.cs new file mode 100644 index 0000000000000..c9ab1ce1629c4 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlockListItemsResult.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.CognitiveServices; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + internal partial class RaiBlockListItemsResult + { + internal static RaiBlockListItemsResult DeserializeRaiBlockListItemsResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional nextLink = default; + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(RaiBlocklistItemData.DeserializeRaiBlocklistItemData(item)); + } + value = array; + continue; + } + } + return new RaiBlockListItemsResult(nextLink.Value, Optional.ToList(value)); + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlockListItemsResult.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlockListItemsResult.cs new file mode 100644 index 0000000000000..c7824276c8338 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlockListItemsResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.CognitiveServices; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// The list of cognitive services RAI Blocklist Items. + internal partial class RaiBlockListItemsResult + { + /// Initializes a new instance of . + internal RaiBlockListItemsResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The link used to get the next page of RaiBlocklistItems. + /// The list of RaiBlocklistItems. + internal RaiBlockListItemsResult(string nextLink, IReadOnlyList value) + { + NextLink = nextLink; + Value = value; + } + + /// The link used to get the next page of RaiBlocklistItems. + public string NextLink { get; } + /// The list of RaiBlocklistItems. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlockListResult.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlockListResult.Serialization.cs new file mode 100644 index 0000000000000..893e0d2063270 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlockListResult.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.CognitiveServices; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + internal partial class RaiBlockListResult + { + internal static RaiBlockListResult DeserializeRaiBlockListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional nextLink = default; + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(RaiBlocklistData.DeserializeRaiBlocklistData(item)); + } + value = array; + continue; + } + } + return new RaiBlockListResult(nextLink.Value, Optional.ToList(value)); + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlockListResult.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlockListResult.cs new file mode 100644 index 0000000000000..f22b0991df6ba --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlockListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.CognitiveServices; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// The list of cognitive services RAI Blocklists. + internal partial class RaiBlockListResult + { + /// Initializes a new instance of . + internal RaiBlockListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The link used to get the next page of RaiBlocklists. + /// The list of RaiBlocklist. + internal RaiBlockListResult(string nextLink, IReadOnlyList value) + { + NextLink = nextLink; + Value = value; + } + + /// The link used to get the next page of RaiBlocklists. + public string NextLink { get; } + /// The list of RaiBlocklist. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlocklistConfig.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlocklistConfig.Serialization.cs new file mode 100644 index 0000000000000..87a3c360282b6 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlocklistConfig.Serialization.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + public partial class RaiBlocklistConfig : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(BlocklistName)) + { + writer.WritePropertyName("blocklistName"u8); + writer.WriteStringValue(BlocklistName); + } + if (Optional.IsDefined(Blocking)) + { + writer.WritePropertyName("blocking"u8); + writer.WriteBooleanValue(Blocking.Value); + } + writer.WriteEndObject(); + } + + internal static RaiBlocklistConfig DeserializeRaiBlocklistConfig(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional blocklistName = default; + Optional blocking = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("blocklistName"u8)) + { + blocklistName = property.Value.GetString(); + continue; + } + if (property.NameEquals("blocking"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + blocking = property.Value.GetBoolean(); + continue; + } + } + return new RaiBlocklistConfig(blocklistName.Value, Optional.ToNullable(blocking)); + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlocklistConfig.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlocklistConfig.cs new file mode 100644 index 0000000000000..30070061bbae9 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlocklistConfig.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// Azure OpenAI blocklist config. + public partial class RaiBlocklistConfig + { + /// Initializes a new instance of . + public RaiBlocklistConfig() + { + } + + /// Initializes a new instance of . + /// Name of ContentFilter. + /// If blocking would occur. + internal RaiBlocklistConfig(string blocklistName, bool? blocking) + { + BlocklistName = blocklistName; + Blocking = blocking; + } + + /// Name of ContentFilter. + public string BlocklistName { get; set; } + /// If blocking would occur. + public bool? Blocking { get; set; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlocklistData.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlocklistData.Serialization.cs new file mode 100644 index 0000000000000..4331f3bbab2db --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlocklistData.Serialization.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.ResourceManager.CognitiveServices.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.CognitiveServices +{ + public partial class RaiBlocklistData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + writer.WriteEndObject(); + } + + internal static RaiBlocklistData DeserializeRaiBlocklistData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional etag = default; + Optional> tags = default; + Optional properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("etag"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + etag = new ETag(property.Value.GetString()); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = RaiBlocklistProperties.DeserializeRaiBlocklistProperties(property.Value); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + } + return new RaiBlocklistData(id, name, type, systemData.Value, Optional.ToNullable(etag), Optional.ToDictionary(tags), properties.Value); + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlocklistItemData.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlocklistItemData.Serialization.cs new file mode 100644 index 0000000000000..f59fe2495b061 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlocklistItemData.Serialization.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.ResourceManager.CognitiveServices.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.CognitiveServices +{ + public partial class RaiBlocklistItemData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + writer.WriteEndObject(); + } + + internal static RaiBlocklistItemData DeserializeRaiBlocklistItemData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional etag = default; + Optional> tags = default; + Optional properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("etag"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + etag = new ETag(property.Value.GetString()); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = RaiBlocklistItemProperties.DeserializeRaiBlocklistItemProperties(property.Value); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + } + return new RaiBlocklistItemData(id, name, type, systemData.Value, Optional.ToNullable(etag), Optional.ToDictionary(tags), properties.Value); + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlocklistItemProperties.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlocklistItemProperties.Serialization.cs new file mode 100644 index 0000000000000..b4163740a0cf4 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlocklistItemProperties.Serialization.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + public partial class RaiBlocklistItemProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Pattern)) + { + writer.WritePropertyName("pattern"u8); + writer.WriteStringValue(Pattern); + } + if (Optional.IsDefined(IsRegex)) + { + writer.WritePropertyName("isRegex"u8); + writer.WriteBooleanValue(IsRegex.Value); + } + writer.WriteEndObject(); + } + + internal static RaiBlocklistItemProperties DeserializeRaiBlocklistItemProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional pattern = default; + Optional isRegex = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("pattern"u8)) + { + pattern = property.Value.GetString(); + continue; + } + if (property.NameEquals("isRegex"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isRegex = property.Value.GetBoolean(); + continue; + } + } + return new RaiBlocklistItemProperties(pattern.Value, Optional.ToNullable(isRegex)); + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlocklistItemProperties.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlocklistItemProperties.cs new file mode 100644 index 0000000000000..172301e6deffc --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlocklistItemProperties.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// RAI Custom Blocklist Item properties. + public partial class RaiBlocklistItemProperties + { + /// Initializes a new instance of . + public RaiBlocklistItemProperties() + { + } + + /// Initializes a new instance of . + /// Pattern to match against. + /// If the pattern is a regex pattern. + internal RaiBlocklistItemProperties(string pattern, bool? isRegex) + { + Pattern = pattern; + IsRegex = isRegex; + } + + /// Pattern to match against. + public string Pattern { get; set; } + /// If the pattern is a regex pattern. + public bool? IsRegex { get; set; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlocklistProperties.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlocklistProperties.Serialization.cs new file mode 100644 index 0000000000000..46af7812387bf --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlocklistProperties.Serialization.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + internal partial class RaiBlocklistProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + writer.WriteEndObject(); + } + + internal static RaiBlocklistProperties DeserializeRaiBlocklistProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional description = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + } + return new RaiBlocklistProperties(description.Value); + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlocklistProperties.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlocklistProperties.cs new file mode 100644 index 0000000000000..2c3f0ff360790 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlocklistProperties.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// RAI Custom Blocklist properties. + internal partial class RaiBlocklistProperties + { + /// Initializes a new instance of . + public RaiBlocklistProperties() + { + } + + /// Initializes a new instance of . + /// Description of the block list. + internal RaiBlocklistProperties(string description) + { + Description = description; + } + + /// Description of the block list. + public string Description { get; set; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiContentFilter.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiContentFilter.Serialization.cs new file mode 100644 index 0000000000000..e9bdc3292b033 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiContentFilter.Serialization.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + public partial class RaiContentFilter + { + internal static RaiContentFilter DeserializeRaiContentFilter(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional policyName = default; + Optional description = default; + Optional filterType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("policyName"u8)) + { + policyName = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("filterType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + filterType = new RaiContentFilterType(property.Value.GetString()); + continue; + } + } + return new RaiContentFilter(policyName.Value, description.Value, Optional.ToNullable(filterType)); + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiContentFilter.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiContentFilter.cs new file mode 100644 index 0000000000000..c02f11085837d --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiContentFilter.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// Azure OpenAI Content Filter. + public partial class RaiContentFilter + { + /// Initializes a new instance of . + internal RaiContentFilter() + { + } + + /// Initializes a new instance of . + /// Name of Content Filter. + /// Description of Content Filter. + /// Content Filter type. + internal RaiContentFilter(string policyName, string description, RaiContentFilterType? filterType) + { + PolicyName = policyName; + Description = description; + FilterType = filterType; + } + + /// Name of Content Filter. + public string PolicyName { get; } + /// Description of Content Filter. + public string Description { get; } + /// Content Filter type. + public RaiContentFilterType? FilterType { get; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiContentFilterListResult.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiContentFilterListResult.Serialization.cs new file mode 100644 index 0000000000000..8dd30b074219e --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiContentFilterListResult.Serialization.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + internal partial class RaiContentFilterListResult + { + internal static RaiContentFilterListResult DeserializeRaiContentFilterListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional nextLink = default; + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(RaiContentFilter.DeserializeRaiContentFilter(item)); + } + value = array; + continue; + } + } + return new RaiContentFilterListResult(nextLink.Value, Optional.ToList(value)); + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiContentFilterListResult.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiContentFilterListResult.cs new file mode 100644 index 0000000000000..8e0092bb66fa4 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiContentFilterListResult.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// The list of Content Filters. + internal partial class RaiContentFilterListResult + { + /// Initializes a new instance of . + internal RaiContentFilterListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The link used to get the next page of Content Filters. + /// The list of RaiContentFilter. + internal RaiContentFilterListResult(string nextLink, IReadOnlyList value) + { + NextLink = nextLink; + Value = value; + } + + /// The link used to get the next page of Content Filters. + public string NextLink { get; } + /// The list of RaiContentFilter. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiContentFilterType.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiContentFilterType.cs new file mode 100644 index 0000000000000..8a2fc1cfbb0c0 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiContentFilterType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// Content Filter type. + public readonly partial struct RaiContentFilterType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RaiContentFilterType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string MultiLevelValue = "MultiLevel"; + private const string SwitchValue = "Switch"; + + /// MultiLevel. + public static RaiContentFilterType MultiLevel { get; } = new RaiContentFilterType(MultiLevelValue); + /// Switch. + public static RaiContentFilterType Switch { get; } = new RaiContentFilterType(SwitchValue); + /// Determines if two values are the same. + public static bool operator ==(RaiContentFilterType left, RaiContentFilterType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RaiContentFilterType left, RaiContentFilterType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator RaiContentFilterType(string value) => new RaiContentFilterType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RaiContentFilterType other && Equals(other); + /// + public bool Equals(RaiContentFilterType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiPolicyContentFilter.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiPolicyContentFilter.Serialization.cs new file mode 100644 index 0000000000000..72504b50e1217 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiPolicyContentFilter.Serialization.cs @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + public partial class RaiPolicyContentFilter : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Enabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(Enabled.Value); + } + if (Optional.IsDefined(AllowedContentLevel)) + { + writer.WritePropertyName("allowedContentLevel"u8); + writer.WriteStringValue(AllowedContentLevel.Value.ToString()); + } + if (Optional.IsDefined(Blocking)) + { + writer.WritePropertyName("blocking"u8); + writer.WriteBooleanValue(Blocking.Value); + } + if (Optional.IsDefined(Source)) + { + writer.WritePropertyName("source"u8); + writer.WriteStringValue(Source.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static RaiPolicyContentFilter DeserializeRaiPolicyContentFilter(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional enabled = default; + Optional allowedContentLevel = default; + Optional blocking = default; + Optional source = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("enabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("allowedContentLevel"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + allowedContentLevel = new AllowedContentLevel(property.Value.GetString()); + continue; + } + if (property.NameEquals("blocking"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + blocking = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("source"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + source = new RaiPolicyContentSource(property.Value.GetString()); + continue; + } + } + return new RaiPolicyContentFilter(name.Value, Optional.ToNullable(enabled), Optional.ToNullable(allowedContentLevel), Optional.ToNullable(blocking), Optional.ToNullable(source)); + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiPolicyContentFilter.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiPolicyContentFilter.cs new file mode 100644 index 0000000000000..798efbd90134a --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiPolicyContentFilter.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// Azure OpenAI Content Filter. + public partial class RaiPolicyContentFilter + { + /// Initializes a new instance of . + public RaiPolicyContentFilter() + { + } + + /// Initializes a new instance of . + /// Name of ContentFilter. + /// If the ContentFilter is enabled. + /// Level at which content is filtered. + /// If blocking would occur. + /// Content source to apply the Content Filters. + internal RaiPolicyContentFilter(string name, bool? enabled, AllowedContentLevel? allowedContentLevel, bool? blocking, RaiPolicyContentSource? source) + { + Name = name; + Enabled = enabled; + AllowedContentLevel = allowedContentLevel; + Blocking = blocking; + Source = source; + } + + /// Name of ContentFilter. + public string Name { get; set; } + /// If the ContentFilter is enabled. + public bool? Enabled { get; set; } + /// Level at which content is filtered. + public AllowedContentLevel? AllowedContentLevel { get; set; } + /// If blocking would occur. + public bool? Blocking { get; set; } + /// Content source to apply the Content Filters. + public RaiPolicyContentSource? Source { get; set; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiPolicyContentSource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiPolicyContentSource.cs new file mode 100644 index 0000000000000..0a5a1bb344637 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiPolicyContentSource.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// Content source to apply the Content Filters. + public readonly partial struct RaiPolicyContentSource : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RaiPolicyContentSource(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PromptValue = "Prompt"; + private const string CompletionValue = "Completion"; + + /// Prompt. + public static RaiPolicyContentSource Prompt { get; } = new RaiPolicyContentSource(PromptValue); + /// Completion. + public static RaiPolicyContentSource Completion { get; } = new RaiPolicyContentSource(CompletionValue); + /// Determines if two values are the same. + public static bool operator ==(RaiPolicyContentSource left, RaiPolicyContentSource right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RaiPolicyContentSource left, RaiPolicyContentSource right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator RaiPolicyContentSource(string value) => new RaiPolicyContentSource(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RaiPolicyContentSource other && Equals(other); + /// + public bool Equals(RaiPolicyContentSource other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiPolicyData.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiPolicyData.Serialization.cs new file mode 100644 index 0000000000000..47ea8a4068706 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiPolicyData.Serialization.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.ResourceManager.CognitiveServices.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.CognitiveServices +{ + public partial class RaiPolicyData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + writer.WriteEndObject(); + } + + internal static RaiPolicyData DeserializeRaiPolicyData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional etag = default; + Optional> tags = default; + Optional properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("etag"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + etag = new ETag(property.Value.GetString()); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = RaiPolicyProperties.DeserializeRaiPolicyProperties(property.Value); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + } + return new RaiPolicyData(id, name, type, systemData.Value, Optional.ToNullable(etag), Optional.ToDictionary(tags), properties.Value); + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiPolicyListResult.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiPolicyListResult.Serialization.cs new file mode 100644 index 0000000000000..64d157f73fcc6 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiPolicyListResult.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.CognitiveServices; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + internal partial class RaiPolicyListResult + { + internal static RaiPolicyListResult DeserializeRaiPolicyListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional nextLink = default; + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(RaiPolicyData.DeserializeRaiPolicyData(item)); + } + value = array; + continue; + } + } + return new RaiPolicyListResult(nextLink.Value, Optional.ToList(value)); + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiPolicyListResult.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiPolicyListResult.cs new file mode 100644 index 0000000000000..cb836a830a245 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiPolicyListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.CognitiveServices; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// The list of cognitive services RaiPolicies. + internal partial class RaiPolicyListResult + { + /// Initializes a new instance of . + internal RaiPolicyListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The link used to get the next page of RaiPolicy. + /// The list of RaiPolicy. + internal RaiPolicyListResult(string nextLink, IReadOnlyList value) + { + NextLink = nextLink; + Value = value; + } + + /// The link used to get the next page of RaiPolicy. + public string NextLink { get; } + /// The list of RaiPolicy. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiPolicyMode.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiPolicyMode.cs new file mode 100644 index 0000000000000..60a76cb962447 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiPolicyMode.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// Content Filters mode. + public readonly partial struct RaiPolicyMode : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RaiPolicyMode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DefaultValue = "Default"; + private const string DeferredValue = "Deferred"; + private const string BlockingValue = "Blocking"; + + /// Default. + public static RaiPolicyMode Default { get; } = new RaiPolicyMode(DefaultValue); + /// Deferred. + public static RaiPolicyMode Deferred { get; } = new RaiPolicyMode(DeferredValue); + /// Blocking. + public static RaiPolicyMode Blocking { get; } = new RaiPolicyMode(BlockingValue); + /// Determines if two values are the same. + public static bool operator ==(RaiPolicyMode left, RaiPolicyMode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RaiPolicyMode left, RaiPolicyMode right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator RaiPolicyMode(string value) => new RaiPolicyMode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RaiPolicyMode other && Equals(other); + /// + public bool Equals(RaiPolicyMode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiPolicyProperties.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiPolicyProperties.Serialization.cs new file mode 100644 index 0000000000000..00930520aff4e --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiPolicyProperties.Serialization.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + public partial class RaiPolicyProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Mode)) + { + writer.WritePropertyName("mode"u8); + writer.WriteStringValue(Mode.Value.ToString()); + } + if (Optional.IsDefined(BasePolicyName)) + { + writer.WritePropertyName("basePolicyName"u8); + writer.WriteStringValue(BasePolicyName); + } + if (Optional.IsCollectionDefined(PromptBlocklists)) + { + writer.WritePropertyName("promptBlocklists"u8); + writer.WriteStartArray(); + foreach (var item in PromptBlocklists) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(CompletionBlocklists)) + { + writer.WritePropertyName("completionBlocklists"u8); + writer.WriteStartArray(); + foreach (var item in CompletionBlocklists) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ContentFilters)) + { + writer.WritePropertyName("contentFilters"u8); + writer.WriteStartArray(); + foreach (var item in ContentFilters) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static RaiPolicyProperties DeserializeRaiPolicyProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional policyType = default; + Optional mode = default; + Optional basePolicyName = default; + Optional> promptBlocklists = default; + Optional> completionBlocklists = default; + Optional> contentFilters = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("policyType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + policyType = new RaiPolicyType(property.Value.GetString()); + continue; + } + if (property.NameEquals("mode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + mode = new RaiPolicyMode(property.Value.GetString()); + continue; + } + if (property.NameEquals("basePolicyName"u8)) + { + basePolicyName = property.Value.GetString(); + continue; + } + if (property.NameEquals("promptBlocklists"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(RaiBlocklistConfig.DeserializeRaiBlocklistConfig(item)); + } + promptBlocklists = array; + continue; + } + if (property.NameEquals("completionBlocklists"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(RaiBlocklistConfig.DeserializeRaiBlocklistConfig(item)); + } + completionBlocklists = array; + continue; + } + if (property.NameEquals("contentFilters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(RaiPolicyContentFilter.DeserializeRaiPolicyContentFilter(item)); + } + contentFilters = array; + continue; + } + } + return new RaiPolicyProperties(Optional.ToNullable(policyType), Optional.ToNullable(mode), basePolicyName.Value, Optional.ToList(promptBlocklists), Optional.ToList(completionBlocklists), Optional.ToList(contentFilters)); + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiPolicyProperties.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiPolicyProperties.cs new file mode 100644 index 0000000000000..16074e62e56db --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiPolicyProperties.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// Azure OpenAI Content Filters properties. + public partial class RaiPolicyProperties + { + /// Initializes a new instance of . + public RaiPolicyProperties() + { + PromptBlocklists = new ChangeTrackingList(); + CompletionBlocklists = new ChangeTrackingList(); + ContentFilters = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Content Filters policy type. + /// Content Filters mode. + /// Name of the base Content Filters. + /// The list of blocklists for prompt. + /// The list of blocklists for completion. + /// The list of Content Filters. + internal RaiPolicyProperties(RaiPolicyType? policyType, RaiPolicyMode? mode, string basePolicyName, IList promptBlocklists, IList completionBlocklists, IList contentFilters) + { + PolicyType = policyType; + Mode = mode; + BasePolicyName = basePolicyName; + PromptBlocklists = promptBlocklists; + CompletionBlocklists = completionBlocklists; + ContentFilters = contentFilters; + } + + /// Content Filters policy type. + public RaiPolicyType? PolicyType { get; } + /// Content Filters mode. + public RaiPolicyMode? Mode { get; set; } + /// Name of the base Content Filters. + public string BasePolicyName { get; set; } + /// The list of blocklists for prompt. + public IList PromptBlocklists { get; } + /// The list of blocklists for completion. + public IList CompletionBlocklists { get; } + /// The list of Content Filters. + public IList ContentFilters { get; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiPolicyType.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiPolicyType.cs new file mode 100644 index 0000000000000..7982130c602ea --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiPolicyType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// Content Filters policy type. + public readonly partial struct RaiPolicyType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RaiPolicyType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UserManagedValue = "UserManaged"; + private const string SystemManagedValue = "SystemManaged"; + + /// UserManaged. + public static RaiPolicyType UserManaged { get; } = new RaiPolicyType(UserManagedValue); + /// SystemManaged. + public static RaiPolicyType SystemManaged { get; } = new RaiPolicyType(SystemManagedValue); + /// Determines if two values are the same. + public static bool operator ==(RaiPolicyType left, RaiPolicyType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RaiPolicyType left, RaiPolicyType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator RaiPolicyType(string value) => new RaiPolicyType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RaiPolicyType other && Equals(other); + /// + public bool Equals(RaiPolicyType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/SkuResource.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/SkuResource.Serialization.cs new file mode 100644 index 0000000000000..23af2c87aa631 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/SkuResource.Serialization.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + public partial class SkuResource + { + internal static SkuResource DeserializeSkuResource(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional resourceType = default; + Optional sku = default; + Optional capacity = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("resourceType"u8)) + { + resourceType = property.Value.GetString(); + continue; + } + if (property.NameEquals("sku"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = CognitiveServicesSku.DeserializeCognitiveServicesSku(property.Value); + continue; + } + if (property.NameEquals("capacity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + capacity = CognitiveServicesCapacityConfig.DeserializeCognitiveServicesCapacityConfig(property.Value); + continue; + } + } + return new SkuResource(resourceType.Value, sku.Value, capacity.Value); + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/SkuResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/SkuResource.cs new file mode 100644 index 0000000000000..75454d0d31f13 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/SkuResource.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// Properties of Cognitive Services account resource sku resource properties. + public partial class SkuResource + { + /// Initializes a new instance of . + internal SkuResource() + { + } + + /// Initializes a new instance of . + /// The resource type name. + /// The resource model definition representing SKU. + /// The capacity configuration. + internal SkuResource(string resourceType, CognitiveServicesSku sku, CognitiveServicesCapacityConfig capacity) + { + ResourceType = resourceType; + Sku = sku; + Capacity = capacity; + } + + /// The resource type name. + public string ResourceType { get; } + /// The resource model definition representing SKU. + public CognitiveServicesSku Sku { get; } + /// The capacity configuration. + public CognitiveServicesCapacityConfig Capacity { get; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/UserOwnedAmlWorkspace.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/UserOwnedAmlWorkspace.Serialization.cs new file mode 100644 index 0000000000000..a25083661ab9a --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/UserOwnedAmlWorkspace.Serialization.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + public partial class UserOwnedAmlWorkspace : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ResourceId)) + { + writer.WritePropertyName("resourceId"u8); + writer.WriteStringValue(ResourceId); + } + if (Optional.IsDefined(IdentityClientId)) + { + writer.WritePropertyName("identityClientId"u8); + writer.WriteStringValue(IdentityClientId.Value); + } + writer.WriteEndObject(); + } + + internal static UserOwnedAmlWorkspace DeserializeUserOwnedAmlWorkspace(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional resourceId = default; + Optional identityClientId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("resourceId"u8)) + { + resourceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("identityClientId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identityClientId = property.Value.GetGuid(); + continue; + } + } + return new UserOwnedAmlWorkspace(resourceId.Value, Optional.ToNullable(identityClientId)); + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/UserOwnedAmlWorkspace.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/UserOwnedAmlWorkspace.cs new file mode 100644 index 0000000000000..66a01f8db1c31 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/UserOwnedAmlWorkspace.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// The user owned AML workspace for Cognitive Services account. + public partial class UserOwnedAmlWorkspace + { + /// Initializes a new instance of . + public UserOwnedAmlWorkspace() + { + } + + /// Initializes a new instance of . + /// Full resource id of a AML workspace resource. + /// Identity Client id of a AML workspace resource. + internal UserOwnedAmlWorkspace(string resourceId, Guid? identityClientId) + { + ResourceId = resourceId; + IdentityClientId = identityClientId; + } + + /// Full resource id of a AML workspace resource. + public string ResourceId { get; set; } + /// Identity Client id of a AML workspace resource. + public Guid? IdentityClientId { get; set; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiBlocklistCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiBlocklistCollection.cs new file mode 100644 index 0000000000000..3b2f94553a22f --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiBlocklistCollection.cs @@ -0,0 +1,415 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.CognitiveServices +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetRaiBlocklists method from an instance of . + /// + public partial class RaiBlocklistCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _raiBlocklistClientDiagnostics; + private readonly RaiBlocklistsRestOperations _raiBlocklistRestClient; + + /// Initializes a new instance of the class for mocking. + protected RaiBlocklistCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal RaiBlocklistCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _raiBlocklistClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.CognitiveServices", RaiBlocklistResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(RaiBlocklistResource.ResourceType, out string raiBlocklistApiVersion); + _raiBlocklistRestClient = new RaiBlocklistsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, raiBlocklistApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != CognitiveServicesAccountResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, CognitiveServicesAccountResource.ResourceType), nameof(id)); + } + + /// + /// Update the state of specified blocklist associated with the Azure OpenAI account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName} + /// + /// + /// Operation Id + /// RaiBlocklists_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the RaiBlocklist associated with the Cognitive Services Account. + /// Properties describing the custom blocklist. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string raiBlocklistName, RaiBlocklistData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(raiBlocklistName, nameof(raiBlocklistName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _raiBlocklistClientDiagnostics.CreateScope("RaiBlocklistCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _raiBlocklistRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, raiBlocklistName, data, cancellationToken).ConfigureAwait(false); + var operation = new CognitiveServicesArmOperation(Response.FromValue(new RaiBlocklistResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update the state of specified blocklist associated with the Azure OpenAI account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName} + /// + /// + /// Operation Id + /// RaiBlocklists_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the RaiBlocklist associated with the Cognitive Services Account. + /// Properties describing the custom blocklist. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string raiBlocklistName, RaiBlocklistData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(raiBlocklistName, nameof(raiBlocklistName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _raiBlocklistClientDiagnostics.CreateScope("RaiBlocklistCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _raiBlocklistRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, raiBlocklistName, data, cancellationToken); + var operation = new CognitiveServicesArmOperation(Response.FromValue(new RaiBlocklistResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the specified custom blocklist associated with the Azure OpenAI account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName} + /// + /// + /// Operation Id + /// RaiBlocklists_Get + /// + /// + /// + /// The name of the RaiBlocklist associated with the Cognitive Services Account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string raiBlocklistName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(raiBlocklistName, nameof(raiBlocklistName)); + + using var scope = _raiBlocklistClientDiagnostics.CreateScope("RaiBlocklistCollection.Get"); + scope.Start(); + try + { + var response = await _raiBlocklistRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, raiBlocklistName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new RaiBlocklistResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the specified custom blocklist associated with the Azure OpenAI account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName} + /// + /// + /// Operation Id + /// RaiBlocklists_Get + /// + /// + /// + /// The name of the RaiBlocklist associated with the Cognitive Services Account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string raiBlocklistName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(raiBlocklistName, nameof(raiBlocklistName)); + + using var scope = _raiBlocklistClientDiagnostics.CreateScope("RaiBlocklistCollection.Get"); + scope.Start(); + try + { + var response = _raiBlocklistRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, raiBlocklistName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new RaiBlocklistResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the custom blocklists associated with the Azure OpenAI account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists + /// + /// + /// Operation Id + /// RaiBlocklists_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _raiBlocklistRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _raiBlocklistRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RaiBlocklistResource(Client, RaiBlocklistData.DeserializeRaiBlocklistData(e)), _raiBlocklistClientDiagnostics, Pipeline, "RaiBlocklistCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the custom blocklists associated with the Azure OpenAI account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists + /// + /// + /// Operation Id + /// RaiBlocklists_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _raiBlocklistRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _raiBlocklistRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RaiBlocklistResource(Client, RaiBlocklistData.DeserializeRaiBlocklistData(e)), _raiBlocklistClientDiagnostics, Pipeline, "RaiBlocklistCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName} + /// + /// + /// Operation Id + /// RaiBlocklists_Get + /// + /// + /// + /// The name of the RaiBlocklist associated with the Cognitive Services Account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string raiBlocklistName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(raiBlocklistName, nameof(raiBlocklistName)); + + using var scope = _raiBlocklistClientDiagnostics.CreateScope("RaiBlocklistCollection.Exists"); + scope.Start(); + try + { + var response = await _raiBlocklistRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, raiBlocklistName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName} + /// + /// + /// Operation Id + /// RaiBlocklists_Get + /// + /// + /// + /// The name of the RaiBlocklist associated with the Cognitive Services Account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string raiBlocklistName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(raiBlocklistName, nameof(raiBlocklistName)); + + using var scope = _raiBlocklistClientDiagnostics.CreateScope("RaiBlocklistCollection.Exists"); + scope.Start(); + try + { + var response = _raiBlocklistRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, raiBlocklistName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName} + /// + /// + /// Operation Id + /// RaiBlocklists_Get + /// + /// + /// + /// The name of the RaiBlocklist associated with the Cognitive Services Account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string raiBlocklistName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(raiBlocklistName, nameof(raiBlocklistName)); + + using var scope = _raiBlocklistClientDiagnostics.CreateScope("RaiBlocklistCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _raiBlocklistRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, raiBlocklistName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RaiBlocklistResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName} + /// + /// + /// Operation Id + /// RaiBlocklists_Get + /// + /// + /// + /// The name of the RaiBlocklist associated with the Cognitive Services Account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string raiBlocklistName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(raiBlocklistName, nameof(raiBlocklistName)); + + using var scope = _raiBlocklistClientDiagnostics.CreateScope("RaiBlocklistCollection.GetIfExists"); + scope.Start(); + try + { + var response = _raiBlocklistRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, raiBlocklistName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RaiBlocklistResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiBlocklistData.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiBlocklistData.cs new file mode 100644 index 0000000000000..8e49a2c9ee5f9 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiBlocklistData.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.ResourceManager.CognitiveServices.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.CognitiveServices +{ + /// + /// A class representing the RaiBlocklist data model. + /// Cognitive Services RaiBlocklist. + /// + public partial class RaiBlocklistData : ResourceData + { + /// Initializes a new instance of . + public RaiBlocklistData() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Resource Etag. + /// Resource tags. + /// Properties of Cognitive Services RaiBlocklist. + internal RaiBlocklistData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ETag? etag, IDictionary tags, RaiBlocklistProperties properties) : base(id, name, resourceType, systemData) + { + ETag = etag; + Tags = tags; + Properties = properties; + } + + /// Resource Etag. + public ETag? ETag { get; } + /// Resource tags. + public IDictionary Tags { get; } + /// Properties of Cognitive Services RaiBlocklist. + internal RaiBlocklistProperties Properties { get; set; } + /// Description of the block list. + public string RaiBlocklistDescription + { + get => Properties is null ? default : Properties.Description; + set + { + if (Properties is null) + Properties = new RaiBlocklistProperties(); + Properties.Description = value; + } + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiBlocklistItemCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiBlocklistItemCollection.cs new file mode 100644 index 0000000000000..d8854bab9d881 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiBlocklistItemCollection.cs @@ -0,0 +1,415 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.CognitiveServices +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetRaiBlocklistItems method from an instance of . + /// + public partial class RaiBlocklistItemCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _raiBlocklistItemClientDiagnostics; + private readonly RaiBlocklistItemsRestOperations _raiBlocklistItemRestClient; + + /// Initializes a new instance of the class for mocking. + protected RaiBlocklistItemCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal RaiBlocklistItemCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _raiBlocklistItemClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.CognitiveServices", RaiBlocklistItemResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(RaiBlocklistItemResource.ResourceType, out string raiBlocklistItemApiVersion); + _raiBlocklistItemRestClient = new RaiBlocklistItemsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, raiBlocklistItemApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != RaiBlocklistResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, RaiBlocklistResource.ResourceType), nameof(id)); + } + + /// + /// Update the state of specified blocklist item associated with the Azure OpenAI account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName} + /// + /// + /// Operation Id + /// RaiBlocklistItems_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the RaiBlocklist Item associated with the custom blocklist. + /// Properties describing the custom blocklist. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string raiBlocklistItemName, RaiBlocklistItemData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(raiBlocklistItemName, nameof(raiBlocklistItemName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _raiBlocklistItemClientDiagnostics.CreateScope("RaiBlocklistItemCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _raiBlocklistItemRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, raiBlocklistItemName, data, cancellationToken).ConfigureAwait(false); + var operation = new CognitiveServicesArmOperation(Response.FromValue(new RaiBlocklistItemResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update the state of specified blocklist item associated with the Azure OpenAI account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName} + /// + /// + /// Operation Id + /// RaiBlocklistItems_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the RaiBlocklist Item associated with the custom blocklist. + /// Properties describing the custom blocklist. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string raiBlocklistItemName, RaiBlocklistItemData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(raiBlocklistItemName, nameof(raiBlocklistItemName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _raiBlocklistItemClientDiagnostics.CreateScope("RaiBlocklistItemCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _raiBlocklistItemRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, raiBlocklistItemName, data, cancellationToken); + var operation = new CognitiveServicesArmOperation(Response.FromValue(new RaiBlocklistItemResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the specified custom blocklist Item associated with the custom blocklist. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName} + /// + /// + /// Operation Id + /// RaiBlocklistItems_Get + /// + /// + /// + /// The name of the RaiBlocklist Item associated with the custom blocklist. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string raiBlocklistItemName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(raiBlocklistItemName, nameof(raiBlocklistItemName)); + + using var scope = _raiBlocklistItemClientDiagnostics.CreateScope("RaiBlocklistItemCollection.Get"); + scope.Start(); + try + { + var response = await _raiBlocklistItemRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, raiBlocklistItemName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new RaiBlocklistItemResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the specified custom blocklist Item associated with the custom blocklist. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName} + /// + /// + /// Operation Id + /// RaiBlocklistItems_Get + /// + /// + /// + /// The name of the RaiBlocklist Item associated with the custom blocklist. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string raiBlocklistItemName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(raiBlocklistItemName, nameof(raiBlocklistItemName)); + + using var scope = _raiBlocklistItemClientDiagnostics.CreateScope("RaiBlocklistItemCollection.Get"); + scope.Start(); + try + { + var response = _raiBlocklistItemRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, raiBlocklistItemName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new RaiBlocklistItemResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the blocklist items associated with the custom blocklist. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems + /// + /// + /// Operation Id + /// RaiBlocklistItems_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _raiBlocklistItemRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _raiBlocklistItemRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RaiBlocklistItemResource(Client, RaiBlocklistItemData.DeserializeRaiBlocklistItemData(e)), _raiBlocklistItemClientDiagnostics, Pipeline, "RaiBlocklistItemCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the blocklist items associated with the custom blocklist. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems + /// + /// + /// Operation Id + /// RaiBlocklistItems_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _raiBlocklistItemRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _raiBlocklistItemRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RaiBlocklistItemResource(Client, RaiBlocklistItemData.DeserializeRaiBlocklistItemData(e)), _raiBlocklistItemClientDiagnostics, Pipeline, "RaiBlocklistItemCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName} + /// + /// + /// Operation Id + /// RaiBlocklistItems_Get + /// + /// + /// + /// The name of the RaiBlocklist Item associated with the custom blocklist. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string raiBlocklistItemName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(raiBlocklistItemName, nameof(raiBlocklistItemName)); + + using var scope = _raiBlocklistItemClientDiagnostics.CreateScope("RaiBlocklistItemCollection.Exists"); + scope.Start(); + try + { + var response = await _raiBlocklistItemRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, raiBlocklistItemName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName} + /// + /// + /// Operation Id + /// RaiBlocklistItems_Get + /// + /// + /// + /// The name of the RaiBlocklist Item associated with the custom blocklist. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string raiBlocklistItemName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(raiBlocklistItemName, nameof(raiBlocklistItemName)); + + using var scope = _raiBlocklistItemClientDiagnostics.CreateScope("RaiBlocklistItemCollection.Exists"); + scope.Start(); + try + { + var response = _raiBlocklistItemRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, raiBlocklistItemName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName} + /// + /// + /// Operation Id + /// RaiBlocklistItems_Get + /// + /// + /// + /// The name of the RaiBlocklist Item associated with the custom blocklist. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string raiBlocklistItemName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(raiBlocklistItemName, nameof(raiBlocklistItemName)); + + using var scope = _raiBlocklistItemClientDiagnostics.CreateScope("RaiBlocklistItemCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _raiBlocklistItemRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, raiBlocklistItemName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RaiBlocklistItemResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName} + /// + /// + /// Operation Id + /// RaiBlocklistItems_Get + /// + /// + /// + /// The name of the RaiBlocklist Item associated with the custom blocklist. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string raiBlocklistItemName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(raiBlocklistItemName, nameof(raiBlocklistItemName)); + + using var scope = _raiBlocklistItemClientDiagnostics.CreateScope("RaiBlocklistItemCollection.GetIfExists"); + scope.Start(); + try + { + var response = _raiBlocklistItemRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, raiBlocklistItemName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RaiBlocklistItemResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiBlocklistItemData.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiBlocklistItemData.cs new file mode 100644 index 0000000000000..dc2dd2d3544d8 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiBlocklistItemData.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.ResourceManager.CognitiveServices.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.CognitiveServices +{ + /// + /// A class representing the RaiBlocklistItem data model. + /// Cognitive Services RaiBlocklist Item. + /// + public partial class RaiBlocklistItemData : ResourceData + { + /// Initializes a new instance of . + public RaiBlocklistItemData() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Resource Etag. + /// Resource tags. + /// Properties of Cognitive Services RaiBlocklist Item. + internal RaiBlocklistItemData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ETag? etag, IDictionary tags, RaiBlocklistItemProperties properties) : base(id, name, resourceType, systemData) + { + ETag = etag; + Tags = tags; + Properties = properties; + } + + /// Resource Etag. + public ETag? ETag { get; } + /// Resource tags. + public IDictionary Tags { get; } + /// Properties of Cognitive Services RaiBlocklist Item. + public RaiBlocklistItemProperties Properties { get; set; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiBlocklistItemResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiBlocklistItemResource.cs new file mode 100644 index 0000000000000..09e81fe9113e5 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiBlocklistItemResource.cs @@ -0,0 +1,591 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.CognitiveServices +{ + /// + /// A Class representing a RaiBlocklistItem along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetRaiBlocklistItemResource method. + /// Otherwise you can get one from its parent resource using the GetRaiBlocklistItem method. + /// + public partial class RaiBlocklistItemResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The raiBlocklistName. + /// The raiBlocklistItemName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName, string raiBlocklistItemName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _raiBlocklistItemClientDiagnostics; + private readonly RaiBlocklistItemsRestOperations _raiBlocklistItemRestClient; + private readonly RaiBlocklistItemData _data; + + /// Initializes a new instance of the class for mocking. + protected RaiBlocklistItemResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal RaiBlocklistItemResource(ArmClient client, RaiBlocklistItemData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal RaiBlocklistItemResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _raiBlocklistItemClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.CognitiveServices", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string raiBlocklistItemApiVersion); + _raiBlocklistItemRestClient = new RaiBlocklistItemsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, raiBlocklistItemApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.CognitiveServices/accounts/raiBlocklists/raiBlocklistItems"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual RaiBlocklistItemData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the specified custom blocklist Item associated with the custom blocklist. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName} + /// + /// + /// Operation Id + /// RaiBlocklistItems_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _raiBlocklistItemClientDiagnostics.CreateScope("RaiBlocklistItemResource.Get"); + scope.Start(); + try + { + var response = await _raiBlocklistItemRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new RaiBlocklistItemResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the specified custom blocklist Item associated with the custom blocklist. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName} + /// + /// + /// Operation Id + /// RaiBlocklistItems_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _raiBlocklistItemClientDiagnostics.CreateScope("RaiBlocklistItemResource.Get"); + scope.Start(); + try + { + var response = _raiBlocklistItemRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new RaiBlocklistItemResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified blocklist Item associated with the custom blocklist. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName} + /// + /// + /// Operation Id + /// RaiBlocklistItems_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _raiBlocklistItemClientDiagnostics.CreateScope("RaiBlocklistItemResource.Delete"); + scope.Start(); + try + { + var response = await _raiBlocklistItemRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new CognitiveServicesArmOperation(_raiBlocklistItemClientDiagnostics, Pipeline, _raiBlocklistItemRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified blocklist Item associated with the custom blocklist. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName} + /// + /// + /// Operation Id + /// RaiBlocklistItems_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _raiBlocklistItemClientDiagnostics.CreateScope("RaiBlocklistItemResource.Delete"); + scope.Start(); + try + { + var response = _raiBlocklistItemRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new CognitiveServicesArmOperation(_raiBlocklistItemClientDiagnostics, Pipeline, _raiBlocklistItemRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update the state of specified blocklist item associated with the Azure OpenAI account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName} + /// + /// + /// Operation Id + /// RaiBlocklistItems_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Properties describing the custom blocklist. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, RaiBlocklistItemData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _raiBlocklistItemClientDiagnostics.CreateScope("RaiBlocklistItemResource.Update"); + scope.Start(); + try + { + var response = await _raiBlocklistItemRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new CognitiveServicesArmOperation(Response.FromValue(new RaiBlocklistItemResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update the state of specified blocklist item associated with the Azure OpenAI account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName} + /// + /// + /// Operation Id + /// RaiBlocklistItems_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Properties describing the custom blocklist. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, RaiBlocklistItemData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _raiBlocklistItemClientDiagnostics.CreateScope("RaiBlocklistItemResource.Update"); + scope.Start(); + try + { + var response = _raiBlocklistItemRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new CognitiveServicesArmOperation(Response.FromValue(new RaiBlocklistItemResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName} + /// + /// + /// Operation Id + /// RaiBlocklistItems_Get + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _raiBlocklistItemClientDiagnostics.CreateScope("RaiBlocklistItemResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _raiBlocklistItemRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new RaiBlocklistItemResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + current.Tags[key] = value; + var result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName} + /// + /// + /// Operation Id + /// RaiBlocklistItems_Get + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _raiBlocklistItemClientDiagnostics.CreateScope("RaiBlocklistItemResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _raiBlocklistItemRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new RaiBlocklistItemResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + current.Tags[key] = value; + var result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName} + /// + /// + /// Operation Id + /// RaiBlocklistItems_Get + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _raiBlocklistItemClientDiagnostics.CreateScope("RaiBlocklistItemResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _raiBlocklistItemRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new RaiBlocklistItemResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + current.Tags.ReplaceWith(tags); + var result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName} + /// + /// + /// Operation Id + /// RaiBlocklistItems_Get + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _raiBlocklistItemClientDiagnostics.CreateScope("RaiBlocklistItemResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _raiBlocklistItemRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new RaiBlocklistItemResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + current.Tags.ReplaceWith(tags); + var result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName} + /// + /// + /// Operation Id + /// RaiBlocklistItems_Get + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _raiBlocklistItemClientDiagnostics.CreateScope("RaiBlocklistItemResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _raiBlocklistItemRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new RaiBlocklistItemResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + current.Tags.Remove(key); + var result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName} + /// + /// + /// Operation Id + /// RaiBlocklistItems_Get + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _raiBlocklistItemClientDiagnostics.CreateScope("RaiBlocklistItemResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _raiBlocklistItemRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new RaiBlocklistItemResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + current.Tags.Remove(key); + var result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiBlocklistResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiBlocklistResource.cs new file mode 100644 index 0000000000000..c866325ecab2e --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiBlocklistResource.cs @@ -0,0 +1,643 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.CognitiveServices +{ + /// + /// A Class representing a RaiBlocklist along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetRaiBlocklistResource method. + /// Otherwise you can get one from its parent resource using the GetRaiBlocklist method. + /// + public partial class RaiBlocklistResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The raiBlocklistName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _raiBlocklistClientDiagnostics; + private readonly RaiBlocklistsRestOperations _raiBlocklistRestClient; + private readonly RaiBlocklistData _data; + + /// Initializes a new instance of the class for mocking. + protected RaiBlocklistResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal RaiBlocklistResource(ArmClient client, RaiBlocklistData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal RaiBlocklistResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _raiBlocklistClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.CognitiveServices", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string raiBlocklistApiVersion); + _raiBlocklistRestClient = new RaiBlocklistsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, raiBlocklistApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.CognitiveServices/accounts/raiBlocklists"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual RaiBlocklistData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Gets a collection of RaiBlocklistItemResources in the RaiBlocklist. + /// An object representing collection of RaiBlocklistItemResources and their operations over a RaiBlocklistItemResource. + public virtual RaiBlocklistItemCollection GetRaiBlocklistItems() + { + return GetCachedClient(client => new RaiBlocklistItemCollection(client, Id)); + } + + /// + /// Gets the specified custom blocklist Item associated with the custom blocklist. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName} + /// + /// + /// Operation Id + /// RaiBlocklistItems_Get + /// + /// + /// + /// The name of the RaiBlocklist Item associated with the custom blocklist. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetRaiBlocklistItemAsync(string raiBlocklistItemName, CancellationToken cancellationToken = default) + { + return await GetRaiBlocklistItems().GetAsync(raiBlocklistItemName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified custom blocklist Item associated with the custom blocklist. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName} + /// + /// + /// Operation Id + /// RaiBlocklistItems_Get + /// + /// + /// + /// The name of the RaiBlocklist Item associated with the custom blocklist. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetRaiBlocklistItem(string raiBlocklistItemName, CancellationToken cancellationToken = default) + { + return GetRaiBlocklistItems().Get(raiBlocklistItemName, cancellationToken); + } + + /// + /// Gets the specified custom blocklist associated with the Azure OpenAI account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName} + /// + /// + /// Operation Id + /// RaiBlocklists_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _raiBlocklistClientDiagnostics.CreateScope("RaiBlocklistResource.Get"); + scope.Start(); + try + { + var response = await _raiBlocklistRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new RaiBlocklistResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the specified custom blocklist associated with the Azure OpenAI account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName} + /// + /// + /// Operation Id + /// RaiBlocklists_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _raiBlocklistClientDiagnostics.CreateScope("RaiBlocklistResource.Get"); + scope.Start(); + try + { + var response = _raiBlocklistRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new RaiBlocklistResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified custom blocklist associated with the Azure OpenAI account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName} + /// + /// + /// Operation Id + /// RaiBlocklists_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _raiBlocklistClientDiagnostics.CreateScope("RaiBlocklistResource.Delete"); + scope.Start(); + try + { + var response = await _raiBlocklistRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new CognitiveServicesArmOperation(_raiBlocklistClientDiagnostics, Pipeline, _raiBlocklistRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified custom blocklist associated with the Azure OpenAI account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName} + /// + /// + /// Operation Id + /// RaiBlocklists_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _raiBlocklistClientDiagnostics.CreateScope("RaiBlocklistResource.Delete"); + scope.Start(); + try + { + var response = _raiBlocklistRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new CognitiveServicesArmOperation(_raiBlocklistClientDiagnostics, Pipeline, _raiBlocklistRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update the state of specified blocklist associated with the Azure OpenAI account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName} + /// + /// + /// Operation Id + /// RaiBlocklists_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Properties describing the custom blocklist. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, RaiBlocklistData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _raiBlocklistClientDiagnostics.CreateScope("RaiBlocklistResource.Update"); + scope.Start(); + try + { + var response = await _raiBlocklistRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new CognitiveServicesArmOperation(Response.FromValue(new RaiBlocklistResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update the state of specified blocklist associated with the Azure OpenAI account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName} + /// + /// + /// Operation Id + /// RaiBlocklists_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Properties describing the custom blocklist. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, RaiBlocklistData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _raiBlocklistClientDiagnostics.CreateScope("RaiBlocklistResource.Update"); + scope.Start(); + try + { + var response = _raiBlocklistRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new CognitiveServicesArmOperation(Response.FromValue(new RaiBlocklistResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName} + /// + /// + /// Operation Id + /// RaiBlocklists_Get + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _raiBlocklistClientDiagnostics.CreateScope("RaiBlocklistResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _raiBlocklistRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new RaiBlocklistResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + current.Tags[key] = value; + var result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName} + /// + /// + /// Operation Id + /// RaiBlocklists_Get + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _raiBlocklistClientDiagnostics.CreateScope("RaiBlocklistResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _raiBlocklistRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new RaiBlocklistResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + current.Tags[key] = value; + var result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName} + /// + /// + /// Operation Id + /// RaiBlocklists_Get + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _raiBlocklistClientDiagnostics.CreateScope("RaiBlocklistResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _raiBlocklistRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new RaiBlocklistResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + current.Tags.ReplaceWith(tags); + var result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName} + /// + /// + /// Operation Id + /// RaiBlocklists_Get + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _raiBlocklistClientDiagnostics.CreateScope("RaiBlocklistResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _raiBlocklistRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new RaiBlocklistResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + current.Tags.ReplaceWith(tags); + var result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName} + /// + /// + /// Operation Id + /// RaiBlocklists_Get + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _raiBlocklistClientDiagnostics.CreateScope("RaiBlocklistResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _raiBlocklistRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new RaiBlocklistResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + current.Tags.Remove(key); + var result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName} + /// + /// + /// Operation Id + /// RaiBlocklists_Get + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _raiBlocklistClientDiagnostics.CreateScope("RaiBlocklistResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _raiBlocklistRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new RaiBlocklistResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + current.Tags.Remove(key); + var result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiPolicyCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiPolicyCollection.cs new file mode 100644 index 0000000000000..ebbba92e525a9 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiPolicyCollection.cs @@ -0,0 +1,415 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.CognitiveServices +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetRaiPolicies method from an instance of . + /// + public partial class RaiPolicyCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _raiPolicyClientDiagnostics; + private readonly RaiPoliciesRestOperations _raiPolicyRestClient; + + /// Initializes a new instance of the class for mocking. + protected RaiPolicyCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal RaiPolicyCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _raiPolicyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.CognitiveServices", RaiPolicyResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(RaiPolicyResource.ResourceType, out string raiPolicyApiVersion); + _raiPolicyRestClient = new RaiPoliciesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, raiPolicyApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != CognitiveServicesAccountResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, CognitiveServicesAccountResource.ResourceType), nameof(id)); + } + + /// + /// Update the state of specified Content Filters associated with the Azure OpenAI account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName} + /// + /// + /// Operation Id + /// RaiPolicies_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the RaiPolicy associated with the Cognitive Services Account. + /// Properties describing the Content Filters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string raiPolicyName, RaiPolicyData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(raiPolicyName, nameof(raiPolicyName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _raiPolicyClientDiagnostics.CreateScope("RaiPolicyCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _raiPolicyRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, raiPolicyName, data, cancellationToken).ConfigureAwait(false); + var operation = new CognitiveServicesArmOperation(Response.FromValue(new RaiPolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update the state of specified Content Filters associated with the Azure OpenAI account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName} + /// + /// + /// Operation Id + /// RaiPolicies_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the RaiPolicy associated with the Cognitive Services Account. + /// Properties describing the Content Filters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string raiPolicyName, RaiPolicyData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(raiPolicyName, nameof(raiPolicyName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _raiPolicyClientDiagnostics.CreateScope("RaiPolicyCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _raiPolicyRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, raiPolicyName, data, cancellationToken); + var operation = new CognitiveServicesArmOperation(Response.FromValue(new RaiPolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the specified Content Filters associated with the Azure OpenAI account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName} + /// + /// + /// Operation Id + /// RaiPolicies_Get + /// + /// + /// + /// The name of the RaiPolicy associated with the Cognitive Services Account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string raiPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(raiPolicyName, nameof(raiPolicyName)); + + using var scope = _raiPolicyClientDiagnostics.CreateScope("RaiPolicyCollection.Get"); + scope.Start(); + try + { + var response = await _raiPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, raiPolicyName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new RaiPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the specified Content Filters associated with the Azure OpenAI account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName} + /// + /// + /// Operation Id + /// RaiPolicies_Get + /// + /// + /// + /// The name of the RaiPolicy associated with the Cognitive Services Account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string raiPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(raiPolicyName, nameof(raiPolicyName)); + + using var scope = _raiPolicyClientDiagnostics.CreateScope("RaiPolicyCollection.Get"); + scope.Start(); + try + { + var response = _raiPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, raiPolicyName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new RaiPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the content filters associated with the Azure OpenAI account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies + /// + /// + /// Operation Id + /// RaiPolicies_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _raiPolicyRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _raiPolicyRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RaiPolicyResource(Client, RaiPolicyData.DeserializeRaiPolicyData(e)), _raiPolicyClientDiagnostics, Pipeline, "RaiPolicyCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the content filters associated with the Azure OpenAI account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies + /// + /// + /// Operation Id + /// RaiPolicies_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _raiPolicyRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _raiPolicyRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RaiPolicyResource(Client, RaiPolicyData.DeserializeRaiPolicyData(e)), _raiPolicyClientDiagnostics, Pipeline, "RaiPolicyCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName} + /// + /// + /// Operation Id + /// RaiPolicies_Get + /// + /// + /// + /// The name of the RaiPolicy associated with the Cognitive Services Account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string raiPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(raiPolicyName, nameof(raiPolicyName)); + + using var scope = _raiPolicyClientDiagnostics.CreateScope("RaiPolicyCollection.Exists"); + scope.Start(); + try + { + var response = await _raiPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, raiPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName} + /// + /// + /// Operation Id + /// RaiPolicies_Get + /// + /// + /// + /// The name of the RaiPolicy associated with the Cognitive Services Account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string raiPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(raiPolicyName, nameof(raiPolicyName)); + + using var scope = _raiPolicyClientDiagnostics.CreateScope("RaiPolicyCollection.Exists"); + scope.Start(); + try + { + var response = _raiPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, raiPolicyName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName} + /// + /// + /// Operation Id + /// RaiPolicies_Get + /// + /// + /// + /// The name of the RaiPolicy associated with the Cognitive Services Account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string raiPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(raiPolicyName, nameof(raiPolicyName)); + + using var scope = _raiPolicyClientDiagnostics.CreateScope("RaiPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _raiPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, raiPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RaiPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName} + /// + /// + /// Operation Id + /// RaiPolicies_Get + /// + /// + /// + /// The name of the RaiPolicy associated with the Cognitive Services Account. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string raiPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(raiPolicyName, nameof(raiPolicyName)); + + using var scope = _raiPolicyClientDiagnostics.CreateScope("RaiPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _raiPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, raiPolicyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RaiPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiPolicyData.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiPolicyData.cs new file mode 100644 index 0000000000000..e8ab448af9373 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiPolicyData.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.ResourceManager.CognitiveServices.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.CognitiveServices +{ + /// + /// A class representing the RaiPolicy data model. + /// Cognitive Services RaiPolicy. + /// + public partial class RaiPolicyData : ResourceData + { + /// Initializes a new instance of . + public RaiPolicyData() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Resource Etag. + /// Resource tags. + /// Properties of Cognitive Services RaiPolicy. + internal RaiPolicyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ETag? etag, IDictionary tags, RaiPolicyProperties properties) : base(id, name, resourceType, systemData) + { + ETag = etag; + Tags = tags; + Properties = properties; + } + + /// Resource Etag. + public ETag? ETag { get; } + /// Resource tags. + public IDictionary Tags { get; } + /// Properties of Cognitive Services RaiPolicy. + public RaiPolicyProperties Properties { get; set; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiPolicyResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiPolicyResource.cs new file mode 100644 index 0000000000000..d34faaf2dafbb --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiPolicyResource.cs @@ -0,0 +1,590 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.CognitiveServices +{ + /// + /// A Class representing a RaiPolicy along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetRaiPolicyResource method. + /// Otherwise you can get one from its parent resource using the GetRaiPolicy method. + /// + public partial class RaiPolicyResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The raiPolicyName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string raiPolicyName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _raiPolicyClientDiagnostics; + private readonly RaiPoliciesRestOperations _raiPolicyRestClient; + private readonly RaiPolicyData _data; + + /// Initializes a new instance of the class for mocking. + protected RaiPolicyResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal RaiPolicyResource(ArmClient client, RaiPolicyData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal RaiPolicyResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _raiPolicyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.CognitiveServices", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string raiPolicyApiVersion); + _raiPolicyRestClient = new RaiPoliciesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, raiPolicyApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.CognitiveServices/accounts/raiPolicies"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual RaiPolicyData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the specified Content Filters associated with the Azure OpenAI account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName} + /// + /// + /// Operation Id + /// RaiPolicies_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _raiPolicyClientDiagnostics.CreateScope("RaiPolicyResource.Get"); + scope.Start(); + try + { + var response = await _raiPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new RaiPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the specified Content Filters associated with the Azure OpenAI account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName} + /// + /// + /// Operation Id + /// RaiPolicies_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _raiPolicyClientDiagnostics.CreateScope("RaiPolicyResource.Get"); + scope.Start(); + try + { + var response = _raiPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new RaiPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified Content Filters associated with the Azure OpenAI account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName} + /// + /// + /// Operation Id + /// RaiPolicies_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _raiPolicyClientDiagnostics.CreateScope("RaiPolicyResource.Delete"); + scope.Start(); + try + { + var response = await _raiPolicyRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new CognitiveServicesArmOperation(_raiPolicyClientDiagnostics, Pipeline, _raiPolicyRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the specified Content Filters associated with the Azure OpenAI account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName} + /// + /// + /// Operation Id + /// RaiPolicies_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _raiPolicyClientDiagnostics.CreateScope("RaiPolicyResource.Delete"); + scope.Start(); + try + { + var response = _raiPolicyRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new CognitiveServicesArmOperation(_raiPolicyClientDiagnostics, Pipeline, _raiPolicyRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update the state of specified Content Filters associated with the Azure OpenAI account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName} + /// + /// + /// Operation Id + /// RaiPolicies_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Properties describing the Content Filters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, RaiPolicyData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _raiPolicyClientDiagnostics.CreateScope("RaiPolicyResource.Update"); + scope.Start(); + try + { + var response = await _raiPolicyRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new CognitiveServicesArmOperation(Response.FromValue(new RaiPolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update the state of specified Content Filters associated with the Azure OpenAI account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName} + /// + /// + /// Operation Id + /// RaiPolicies_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Properties describing the Content Filters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, RaiPolicyData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _raiPolicyClientDiagnostics.CreateScope("RaiPolicyResource.Update"); + scope.Start(); + try + { + var response = _raiPolicyRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new CognitiveServicesArmOperation(Response.FromValue(new RaiPolicyResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName} + /// + /// + /// Operation Id + /// RaiPolicies_Get + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _raiPolicyClientDiagnostics.CreateScope("RaiPolicyResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _raiPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new RaiPolicyResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + current.Tags[key] = value; + var result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName} + /// + /// + /// Operation Id + /// RaiPolicies_Get + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _raiPolicyClientDiagnostics.CreateScope("RaiPolicyResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _raiPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new RaiPolicyResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + current.Tags[key] = value; + var result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName} + /// + /// + /// Operation Id + /// RaiPolicies_Get + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _raiPolicyClientDiagnostics.CreateScope("RaiPolicyResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _raiPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new RaiPolicyResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + current.Tags.ReplaceWith(tags); + var result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName} + /// + /// + /// Operation Id + /// RaiPolicies_Get + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _raiPolicyClientDiagnostics.CreateScope("RaiPolicyResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _raiPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new RaiPolicyResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + current.Tags.ReplaceWith(tags); + var result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName} + /// + /// + /// Operation Id + /// RaiPolicies_Get + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _raiPolicyClientDiagnostics.CreateScope("RaiPolicyResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _raiPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new RaiPolicyResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + current.Tags.Remove(key); + var result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName} + /// + /// + /// Operation Id + /// RaiPolicies_Get + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _raiPolicyClientDiagnostics.CreateScope("RaiPolicyResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _raiPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new RaiPolicyResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + current.Tags.Remove(key); + var result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/AccountsRestOperations.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/AccountsRestOperations.cs index 194a1dcd654a6..540cc47c77ea8 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/AccountsRestOperations.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/AccountsRestOperations.cs @@ -33,7 +33,7 @@ public AccountsRestOperations(HttpPipeline pipeline, string applicationId, Uri e { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-05-01"; + _apiVersion = apiVersion ?? "2023-10-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/CognitiveServicesManagementRestOperations.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/CognitiveServicesManagementRestOperations.cs index ef63b1106292b..a5e340559476f 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/CognitiveServicesManagementRestOperations.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/CognitiveServicesManagementRestOperations.cs @@ -33,7 +33,7 @@ public CognitiveServicesManagementRestOperations(HttpPipeline pipeline, string a { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-05-01"; + _apiVersion = apiVersion ?? "2023-10-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/CommitmentPlansRestOperations.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/CommitmentPlansRestOperations.cs index 911469321d88b..957de32397c87 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/CommitmentPlansRestOperations.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/CommitmentPlansRestOperations.cs @@ -33,7 +33,7 @@ public CommitmentPlansRestOperations(HttpPipeline pipeline, string applicationId { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-05-01"; + _apiVersion = apiVersion ?? "2023-10-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -454,7 +454,7 @@ public Response CreateOrUpdatePlan(string subscriptionId, string resourceGroupNa } } - internal HttpMessage CreateUpdatePlanRequest(string subscriptionId, string resourceGroupName, string commitmentPlanName, CognitiveServicesCommitmentPlanPatch patch) + internal HttpMessage CreateUpdatePlanRequest(string subscriptionId, string resourceGroupName, string commitmentPlanName, PatchResourceTagsAndSku commitmentPlan) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -472,7 +472,7 @@ internal HttpMessage CreateUpdatePlanRequest(string subscriptionId, string resou request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); + content.JsonWriter.WriteObjectValue(commitmentPlan); request.Content = content; _userAgent.Apply(message); return message; @@ -482,18 +482,18 @@ internal HttpMessage CreateUpdatePlanRequest(string subscriptionId, string resou /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// The name of the commitmentPlan associated with the Cognitive Services Account. - /// The parameters to provide for the created commitment plan. + /// The parameters to provide for the created commitment plan. /// The cancellation token to use. - /// , , or is null. + /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task UpdatePlanAsync(string subscriptionId, string resourceGroupName, string commitmentPlanName, CognitiveServicesCommitmentPlanPatch patch, CancellationToken cancellationToken = default) + public async Task UpdatePlanAsync(string subscriptionId, string resourceGroupName, string commitmentPlanName, PatchResourceTagsAndSku commitmentPlan, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(commitmentPlanName, nameof(commitmentPlanName)); - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(commitmentPlan, nameof(commitmentPlan)); - using var message = CreateUpdatePlanRequest(subscriptionId, resourceGroupName, commitmentPlanName, patch); + using var message = CreateUpdatePlanRequest(subscriptionId, resourceGroupName, commitmentPlanName, commitmentPlan); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -509,18 +509,18 @@ public async Task UpdatePlanAsync(string subscriptionId, string resour /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// The name of the commitmentPlan associated with the Cognitive Services Account. - /// The parameters to provide for the created commitment plan. + /// The parameters to provide for the created commitment plan. /// The cancellation token to use. - /// , , or is null. + /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response UpdatePlan(string subscriptionId, string resourceGroupName, string commitmentPlanName, CognitiveServicesCommitmentPlanPatch patch, CancellationToken cancellationToken = default) + public Response UpdatePlan(string subscriptionId, string resourceGroupName, string commitmentPlanName, PatchResourceTagsAndSku commitmentPlan, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(commitmentPlanName, nameof(commitmentPlanName)); - Argument.AssertNotNull(patch, nameof(patch)); + Argument.AssertNotNull(commitmentPlan, nameof(commitmentPlan)); - using var message = CreateUpdatePlanRequest(subscriptionId, resourceGroupName, commitmentPlanName, patch); + using var message = CreateUpdatePlanRequest(subscriptionId, resourceGroupName, commitmentPlanName, commitmentPlan); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/CommitmentTiersRestOperations.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/CommitmentTiersRestOperations.cs index 0a01852a3adf5..70d85ee582a94 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/CommitmentTiersRestOperations.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/CommitmentTiersRestOperations.cs @@ -33,7 +33,7 @@ public CommitmentTiersRestOperations(HttpPipeline pipeline, string applicationId { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-05-01"; + _apiVersion = apiVersion ?? "2023-10-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/DeletedAccountsRestOperations.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/DeletedAccountsRestOperations.cs index e504d8cd258c8..5011135f18f35 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/DeletedAccountsRestOperations.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/DeletedAccountsRestOperations.cs @@ -33,7 +33,7 @@ public DeletedAccountsRestOperations(HttpPipeline pipeline, string applicationId { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-05-01"; + _apiVersion = apiVersion ?? "2023-10-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/DeploymentsRestOperations.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/DeploymentsRestOperations.cs index d3588381b65b4..2f8b2675e90ff 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/DeploymentsRestOperations.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/DeploymentsRestOperations.cs @@ -33,7 +33,7 @@ public DeploymentsRestOperations(HttpPipeline pipeline, string applicationId, Ur { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-05-01"; + _apiVersion = apiVersion ?? "2023-10-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -288,6 +288,90 @@ public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, } } + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string accountName, string deploymentName, PatchResourceTagsAndSku deployment) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.CognitiveServices/accounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(deployment); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update specified deployments associated with the Cognitive Services account. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The name of the deployment associated with the Cognitive Services Account. + /// The deployment properties. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string accountName, string deploymentName, PatchResourceTagsAndSku deployment, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + Argument.AssertNotNull(deployment, nameof(deployment)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, accountName, deploymentName, deployment); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update specified deployments associated with the Cognitive Services account. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The name of the deployment associated with the Cognitive Services Account. + /// The deployment properties. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string accountName, string deploymentName, PatchResourceTagsAndSku deployment, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + Argument.AssertNotNull(deployment, nameof(deployment)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, accountName, deploymentName, deployment); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string accountName, string deploymentName) { var message = _pipeline.CreateMessage(); @@ -366,6 +450,91 @@ public Response Delete(string subscriptionId, string resourceGroupName, string a } } + internal HttpMessage CreateListSkusRequest(string subscriptionId, string resourceGroupName, string accountName, string deploymentName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.CognitiveServices/accounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/skus", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists the specified deployments skus associated with the Cognitive Services account. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The name of the deployment associated with the Cognitive Services Account. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListSkusAsync(string subscriptionId, string resourceGroupName, string accountName, string deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using var message = CreateListSkusRequest(subscriptionId, resourceGroupName, accountName, deploymentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentSkuListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DeploymentSkuListResult.DeserializeDeploymentSkuListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists the specified deployments skus associated with the Cognitive Services account. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The name of the deployment associated with the Cognitive Services Account. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListSkus(string subscriptionId, string resourceGroupName, string accountName, string deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using var message = CreateListSkusRequest(subscriptionId, resourceGroupName, accountName, deploymentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentSkuListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DeploymentSkuListResult.DeserializeDeploymentSkuListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string accountName) { var message = _pipeline.CreateMessage(); @@ -441,5 +610,85 @@ public Response ListNextPage(strin throw new RequestFailedException(message.Response); } } + + internal HttpMessage CreateListSkusNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string accountName, string deploymentName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists the specified deployments skus associated with the Cognitive Services account. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The name of the deployment associated with the Cognitive Services Account. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListSkusNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string accountName, string deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using var message = CreateListSkusNextPageRequest(nextLink, subscriptionId, resourceGroupName, accountName, deploymentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentSkuListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DeploymentSkuListResult.DeserializeDeploymentSkuListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists the specified deployments skus associated with the Cognitive Services account. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The name of the deployment associated with the Cognitive Services Account. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListSkusNextPage(string nextLink, string subscriptionId, string resourceGroupName, string accountName, string deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using var message = CreateListSkusNextPageRequest(nextLink, subscriptionId, resourceGroupName, accountName, deploymentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentSkuListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DeploymentSkuListResult.DeserializeDeploymentSkuListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/EncryptionScopesRestOperations.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/EncryptionScopesRestOperations.cs new file mode 100644 index 0000000000000..aba05b6a7ee70 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/EncryptionScopesRestOperations.cs @@ -0,0 +1,453 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CognitiveServices.Models; + +namespace Azure.ResourceManager.CognitiveServices +{ + internal partial class EncryptionScopesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of EncryptionScopesRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public EncryptionScopesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-10-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string accountName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.CognitiveServices/accounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/encryptionScopes", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the content filters associated with the Azure OpenAI account. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, accountName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + EncryptionScopeListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = EncryptionScopeListResult.DeserializeEncryptionScopeListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the content filters associated with the Azure OpenAI account. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, accountName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + EncryptionScopeListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = EncryptionScopeListResult.DeserializeEncryptionScopeListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string accountName, string encryptionScopeName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.CognitiveServices/accounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/encryptionScopes/", false); + uri.AppendPath(encryptionScopeName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the specified EncryptionScope associated with the Cognitive Services account. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The name of the encryptionScope associated with the Cognitive Services Account. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string accountName, string encryptionScopeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(encryptionScopeName, nameof(encryptionScopeName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName, encryptionScopeName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + EncryptionScopeData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = EncryptionScopeData.DeserializeEncryptionScopeData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((EncryptionScopeData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the specified EncryptionScope associated with the Cognitive Services account. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The name of the encryptionScope associated with the Cognitive Services Account. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string accountName, string encryptionScopeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(encryptionScopeName, nameof(encryptionScopeName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName, encryptionScopeName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + EncryptionScopeData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = EncryptionScopeData.DeserializeEncryptionScopeData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((EncryptionScopeData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string accountName, string encryptionScopeName, EncryptionScopeData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.CognitiveServices/accounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/encryptionScopes/", false); + uri.AppendPath(encryptionScopeName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update the state of specified encryptionScope associated with the Cognitive Services account. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The name of the encryptionScope associated with the Cognitive Services Account. + /// The encryptionScope properties. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string accountName, string encryptionScopeName, EncryptionScopeData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(encryptionScopeName, nameof(encryptionScopeName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, accountName, encryptionScopeName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + EncryptionScopeData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = EncryptionScopeData.DeserializeEncryptionScopeData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update the state of specified encryptionScope associated with the Cognitive Services account. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The name of the encryptionScope associated with the Cognitive Services Account. + /// The encryptionScope properties. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string accountName, string encryptionScopeName, EncryptionScopeData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(encryptionScopeName, nameof(encryptionScopeName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, accountName, encryptionScopeName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + EncryptionScopeData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = EncryptionScopeData.DeserializeEncryptionScopeData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string accountName, string encryptionScopeName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.CognitiveServices/accounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/encryptionScopes/", false); + uri.AppendPath(encryptionScopeName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified encryptionScope associated with the Cognitive Services account. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The name of the encryptionScope associated with the Cognitive Services Account. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string accountName, string encryptionScopeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(encryptionScopeName, nameof(encryptionScopeName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, accountName, encryptionScopeName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified encryptionScope associated with the Cognitive Services account. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The name of the encryptionScope associated with the Cognitive Services Account. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string accountName, string encryptionScopeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(encryptionScopeName, nameof(encryptionScopeName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, accountName, encryptionScopeName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string accountName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the content filters associated with the Azure OpenAI account. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, accountName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + EncryptionScopeListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = EncryptionScopeListResult.DeserializeEncryptionScopeListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the content filters associated with the Azure OpenAI account. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, accountName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + EncryptionScopeListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = EncryptionScopeListResult.DeserializeEncryptionScopeListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/ModelsRestOperations.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/ModelsRestOperations.cs index 2dee87c8d13d3..79709776579bb 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/ModelsRestOperations.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/ModelsRestOperations.cs @@ -33,7 +33,7 @@ public ModelsRestOperations(HttpPipeline pipeline, string applicationId, Uri end { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-05-01"; + _apiVersion = apiVersion ?? "2023-10-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs index 56317b5f99f81..69cf9994ae267 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs @@ -33,7 +33,7 @@ public PrivateEndpointConnectionsRestOperations(HttpPipeline pipeline, string ap { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-05-01"; + _apiVersion = apiVersion ?? "2023-10-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs index f549e046935b0..1cb36662cf865 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs @@ -33,7 +33,7 @@ public PrivateLinkResourcesRestOperations(HttpPipeline pipeline, string applicat { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-05-01"; + _apiVersion = apiVersion ?? "2023-10-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/RaiBlocklistItemsRestOperations.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/RaiBlocklistItemsRestOperations.cs new file mode 100644 index 0000000000000..fc90e1a60fe7f --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/RaiBlocklistItemsRestOperations.cs @@ -0,0 +1,481 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CognitiveServices.Models; + +namespace Azure.ResourceManager.CognitiveServices +{ + internal partial class RaiBlocklistItemsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of RaiBlocklistItemsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public RaiBlocklistItemsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-10-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.CognitiveServices/accounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/raiBlocklists/", false); + uri.AppendPath(raiBlocklistName, true); + uri.AppendPath("/raiBlocklistItems", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the blocklist items associated with the custom blocklist. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The name of the RaiBlocklist associated with the Cognitive Services Account. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(raiBlocklistName, nameof(raiBlocklistName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, accountName, raiBlocklistName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + RaiBlockListItemsResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RaiBlockListItemsResult.DeserializeRaiBlockListItemsResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the blocklist items associated with the custom blocklist. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The name of the RaiBlocklist associated with the Cognitive Services Account. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(raiBlocklistName, nameof(raiBlocklistName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, accountName, raiBlocklistName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + RaiBlockListItemsResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RaiBlockListItemsResult.DeserializeRaiBlockListItemsResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName, string raiBlocklistItemName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.CognitiveServices/accounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/raiBlocklists/", false); + uri.AppendPath(raiBlocklistName, true); + uri.AppendPath("/raiBlocklistItems/", false); + uri.AppendPath(raiBlocklistItemName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the specified custom blocklist Item associated with the custom blocklist. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The name of the RaiBlocklist associated with the Cognitive Services Account. + /// The name of the RaiBlocklist Item associated with the custom blocklist. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName, string raiBlocklistItemName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(raiBlocklistName, nameof(raiBlocklistName)); + Argument.AssertNotNullOrEmpty(raiBlocklistItemName, nameof(raiBlocklistItemName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName, raiBlocklistName, raiBlocklistItemName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + RaiBlocklistItemData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RaiBlocklistItemData.DeserializeRaiBlocklistItemData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((RaiBlocklistItemData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the specified custom blocklist Item associated with the custom blocklist. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The name of the RaiBlocklist associated with the Cognitive Services Account. + /// The name of the RaiBlocklist Item associated with the custom blocklist. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName, string raiBlocklistItemName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(raiBlocklistName, nameof(raiBlocklistName)); + Argument.AssertNotNullOrEmpty(raiBlocklistItemName, nameof(raiBlocklistItemName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName, raiBlocklistName, raiBlocklistItemName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + RaiBlocklistItemData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RaiBlocklistItemData.DeserializeRaiBlocklistItemData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((RaiBlocklistItemData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName, string raiBlocklistItemName, RaiBlocklistItemData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.CognitiveServices/accounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/raiBlocklists/", false); + uri.AppendPath(raiBlocklistName, true); + uri.AppendPath("/raiBlocklistItems/", false); + uri.AppendPath(raiBlocklistItemName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update the state of specified blocklist item associated with the Azure OpenAI account. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The name of the RaiBlocklist associated with the Cognitive Services Account. + /// The name of the RaiBlocklist Item associated with the custom blocklist. + /// Properties describing the custom blocklist. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName, string raiBlocklistItemName, RaiBlocklistItemData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(raiBlocklistName, nameof(raiBlocklistName)); + Argument.AssertNotNullOrEmpty(raiBlocklistItemName, nameof(raiBlocklistItemName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, accountName, raiBlocklistName, raiBlocklistItemName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + RaiBlocklistItemData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RaiBlocklistItemData.DeserializeRaiBlocklistItemData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update the state of specified blocklist item associated with the Azure OpenAI account. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The name of the RaiBlocklist associated with the Cognitive Services Account. + /// The name of the RaiBlocklist Item associated with the custom blocklist. + /// Properties describing the custom blocklist. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName, string raiBlocklistItemName, RaiBlocklistItemData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(raiBlocklistName, nameof(raiBlocklistName)); + Argument.AssertNotNullOrEmpty(raiBlocklistItemName, nameof(raiBlocklistItemName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, accountName, raiBlocklistName, raiBlocklistItemName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + RaiBlocklistItemData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RaiBlocklistItemData.DeserializeRaiBlocklistItemData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName, string raiBlocklistItemName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.CognitiveServices/accounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/raiBlocklists/", false); + uri.AppendPath(raiBlocklistName, true); + uri.AppendPath("/raiBlocklistItems/", false); + uri.AppendPath(raiBlocklistItemName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified blocklist Item associated with the custom blocklist. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The name of the RaiBlocklist associated with the Cognitive Services Account. + /// The name of the RaiBlocklist Item associated with the custom blocklist. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName, string raiBlocklistItemName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(raiBlocklistName, nameof(raiBlocklistName)); + Argument.AssertNotNullOrEmpty(raiBlocklistItemName, nameof(raiBlocklistItemName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, accountName, raiBlocklistName, raiBlocklistItemName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified blocklist Item associated with the custom blocklist. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The name of the RaiBlocklist associated with the Cognitive Services Account. + /// The name of the RaiBlocklist Item associated with the custom blocklist. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName, string raiBlocklistItemName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(raiBlocklistName, nameof(raiBlocklistName)); + Argument.AssertNotNullOrEmpty(raiBlocklistItemName, nameof(raiBlocklistItemName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, accountName, raiBlocklistName, raiBlocklistItemName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the blocklist items associated with the custom blocklist. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The name of the RaiBlocklist associated with the Cognitive Services Account. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(raiBlocklistName, nameof(raiBlocklistName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, accountName, raiBlocklistName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + RaiBlockListItemsResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RaiBlockListItemsResult.DeserializeRaiBlockListItemsResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the blocklist items associated with the custom blocklist. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The name of the RaiBlocklist associated with the Cognitive Services Account. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(raiBlocklistName, nameof(raiBlocklistName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, accountName, raiBlocklistName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + RaiBlockListItemsResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RaiBlockListItemsResult.DeserializeRaiBlockListItemsResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/RaiBlocklistsRestOperations.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/RaiBlocklistsRestOperations.cs new file mode 100644 index 0000000000000..54c5371e63132 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/RaiBlocklistsRestOperations.cs @@ -0,0 +1,453 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CognitiveServices.Models; + +namespace Azure.ResourceManager.CognitiveServices +{ + internal partial class RaiBlocklistsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of RaiBlocklistsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public RaiBlocklistsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-10-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string accountName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.CognitiveServices/accounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/raiBlocklists", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the custom blocklists associated with the Azure OpenAI account. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, accountName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + RaiBlockListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RaiBlockListResult.DeserializeRaiBlockListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the custom blocklists associated with the Azure OpenAI account. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, accountName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + RaiBlockListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RaiBlockListResult.DeserializeRaiBlockListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.CognitiveServices/accounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/raiBlocklists/", false); + uri.AppendPath(raiBlocklistName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the specified custom blocklist associated with the Azure OpenAI account. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The name of the RaiBlocklist associated with the Cognitive Services Account. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(raiBlocklistName, nameof(raiBlocklistName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName, raiBlocklistName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + RaiBlocklistData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RaiBlocklistData.DeserializeRaiBlocklistData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((RaiBlocklistData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the specified custom blocklist associated with the Azure OpenAI account. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The name of the RaiBlocklist associated with the Cognitive Services Account. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(raiBlocklistName, nameof(raiBlocklistName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName, raiBlocklistName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + RaiBlocklistData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RaiBlocklistData.DeserializeRaiBlocklistData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((RaiBlocklistData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName, RaiBlocklistData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.CognitiveServices/accounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/raiBlocklists/", false); + uri.AppendPath(raiBlocklistName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update the state of specified blocklist associated with the Azure OpenAI account. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The name of the RaiBlocklist associated with the Cognitive Services Account. + /// Properties describing the custom blocklist. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName, RaiBlocklistData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(raiBlocklistName, nameof(raiBlocklistName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, accountName, raiBlocklistName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + RaiBlocklistData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RaiBlocklistData.DeserializeRaiBlocklistData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update the state of specified blocklist associated with the Azure OpenAI account. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The name of the RaiBlocklist associated with the Cognitive Services Account. + /// Properties describing the custom blocklist. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName, RaiBlocklistData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(raiBlocklistName, nameof(raiBlocklistName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, accountName, raiBlocklistName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + RaiBlocklistData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RaiBlocklistData.DeserializeRaiBlocklistData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.CognitiveServices/accounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/raiBlocklists/", false); + uri.AppendPath(raiBlocklistName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified custom blocklist associated with the Azure OpenAI account. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The name of the RaiBlocklist associated with the Cognitive Services Account. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(raiBlocklistName, nameof(raiBlocklistName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, accountName, raiBlocklistName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified custom blocklist associated with the Azure OpenAI account. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The name of the RaiBlocklist associated with the Cognitive Services Account. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(raiBlocklistName, nameof(raiBlocklistName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, accountName, raiBlocklistName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string accountName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the custom blocklists associated with the Azure OpenAI account. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, accountName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + RaiBlockListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RaiBlockListResult.DeserializeRaiBlockListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the custom blocklists associated with the Azure OpenAI account. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, accountName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + RaiBlockListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RaiBlockListResult.DeserializeRaiBlockListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/RaiContentFiltersRestOperations.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/RaiContentFiltersRestOperations.cs new file mode 100644 index 0000000000000..638b7adf1e4ae --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/RaiContentFiltersRestOperations.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CognitiveServices.Models; + +namespace Azure.ResourceManager.CognitiveServices +{ + internal partial class RaiContentFiltersRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of RaiContentFiltersRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public RaiContentFiltersRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-10-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListRequest(string subscriptionId, AzureLocation location) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.CognitiveServices/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/raiContentFilters", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List Content Filters types. + /// The ID of the target subscription. + /// Resource location. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListRequest(subscriptionId, location); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + RaiContentFilterListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RaiContentFilterListResult.DeserializeRaiContentFilterListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Content Filters types. + /// The ID of the target subscription. + /// Resource location. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListRequest(subscriptionId, location); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + RaiContentFilterListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RaiContentFilterListResult.DeserializeRaiContentFilterListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/RaiPoliciesRestOperations.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/RaiPoliciesRestOperations.cs new file mode 100644 index 0000000000000..446180606618c --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/RaiPoliciesRestOperations.cs @@ -0,0 +1,453 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CognitiveServices.Models; + +namespace Azure.ResourceManager.CognitiveServices +{ + internal partial class RaiPoliciesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of RaiPoliciesRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public RaiPoliciesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-10-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string accountName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.CognitiveServices/accounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/raiPolicies", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the content filters associated with the Azure OpenAI account. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, accountName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + RaiPolicyListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RaiPolicyListResult.DeserializeRaiPolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the content filters associated with the Azure OpenAI account. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, accountName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + RaiPolicyListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RaiPolicyListResult.DeserializeRaiPolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string accountName, string raiPolicyName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.CognitiveServices/accounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/raiPolicies/", false); + uri.AppendPath(raiPolicyName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the specified Content Filters associated with the Azure OpenAI account. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The name of the RaiPolicy associated with the Cognitive Services Account. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string accountName, string raiPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(raiPolicyName, nameof(raiPolicyName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName, raiPolicyName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + RaiPolicyData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RaiPolicyData.DeserializeRaiPolicyData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((RaiPolicyData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the specified Content Filters associated with the Azure OpenAI account. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The name of the RaiPolicy associated with the Cognitive Services Account. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string accountName, string raiPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(raiPolicyName, nameof(raiPolicyName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName, raiPolicyName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + RaiPolicyData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RaiPolicyData.DeserializeRaiPolicyData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((RaiPolicyData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string accountName, string raiPolicyName, RaiPolicyData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.CognitiveServices/accounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/raiPolicies/", false); + uri.AppendPath(raiPolicyName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update the state of specified Content Filters associated with the Azure OpenAI account. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The name of the RaiPolicy associated with the Cognitive Services Account. + /// Properties describing the Content Filters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string accountName, string raiPolicyName, RaiPolicyData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(raiPolicyName, nameof(raiPolicyName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, accountName, raiPolicyName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + RaiPolicyData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RaiPolicyData.DeserializeRaiPolicyData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update the state of specified Content Filters associated with the Azure OpenAI account. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The name of the RaiPolicy associated with the Cognitive Services Account. + /// Properties describing the Content Filters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string accountName, string raiPolicyName, RaiPolicyData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(raiPolicyName, nameof(raiPolicyName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, accountName, raiPolicyName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + RaiPolicyData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RaiPolicyData.DeserializeRaiPolicyData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string accountName, string raiPolicyName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.CognitiveServices/accounts/", false); + uri.AppendPath(accountName, true); + uri.AppendPath("/raiPolicies/", false); + uri.AppendPath(raiPolicyName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the specified Content Filters associated with the Azure OpenAI account. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The name of the RaiPolicy associated with the Cognitive Services Account. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string accountName, string raiPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(raiPolicyName, nameof(raiPolicyName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, accountName, raiPolicyName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the specified Content Filters associated with the Azure OpenAI account. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The name of the RaiPolicy associated with the Cognitive Services Account. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string accountName, string raiPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(raiPolicyName, nameof(raiPolicyName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, accountName, raiPolicyName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string accountName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the content filters associated with the Azure OpenAI account. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, accountName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + RaiPolicyListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RaiPolicyListResult.DeserializeRaiPolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the content filters associated with the Azure OpenAI account. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Cognitive Services account. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string accountName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, accountName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + RaiPolicyListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RaiPolicyListResult.DeserializeRaiPolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/ResourceSkusRestOperations.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/ResourceSkusRestOperations.cs index 63f3f6a550a2f..ec2de57adb98c 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/ResourceSkusRestOperations.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/ResourceSkusRestOperations.cs @@ -33,7 +33,7 @@ public ResourceSkusRestOperations(HttpPipeline pipeline, string applicationId, U { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-05-01"; + _apiVersion = apiVersion ?? "2023-10-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/UsagesRestOperations.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/UsagesRestOperations.cs index d3d6eef442a22..cc2da5355ec6f 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/UsagesRestOperations.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/UsagesRestOperations.cs @@ -33,7 +33,7 @@ public UsagesRestOperations(HttpPipeline pipeline, string applicationId, Uri end { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-05-01"; + _apiVersion = apiVersion ?? "2023-10-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/autorest.md b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/autorest.md index 193b1c66f19b2..aae8d0451f1db 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/autorest.md +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/autorest.md @@ -8,7 +8,7 @@ azure-arm: true csharp: true library-name: CognitiveServices namespace: Azure.ResourceManager.CognitiveServices -require: https://github.com/Azure/azure-rest-api-specs/blob/ba1884683c35d1ea63d229a7106f207e507c3861/specification/cognitiveservices/resource-manager/readme.md +require: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/cognitiveservices/resource-manager/readme.md output-folder: $(this-folder)/Generated clear-output-folder: true sample-gen: