diff --git a/sdk/advisor/ci.mgmt.yml b/sdk/advisor/ci.mgmt.yml index 6b9f8d6952e6..22df99de35f2 100644 --- a/sdk/advisor/ci.mgmt.yml +++ b/sdk/advisor/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/advisor/ci.mgmt.yml - sdk/advisor/Azure.ResourceManager.Advisor/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/advisor/ci.mgmt.yml + - sdk/advisor/Azure.ResourceManager.Advisor/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/agrifood/ci.mgmt.yml b/sdk/agrifood/ci.mgmt.yml index ee27d71f9495..03a5f6399ccb 100644 --- a/sdk/agrifood/ci.mgmt.yml +++ b/sdk/agrifood/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/agrifood/ci.mgmt.yml - sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/agrifood/ci.mgmt.yml + - sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/alertsmanagement/ci.mgmt.yml b/sdk/alertsmanagement/ci.mgmt.yml index f33a90fffe5c..ad3a8d3d1efd 100644 --- a/sdk/alertsmanagement/ci.mgmt.yml +++ b/sdk/alertsmanagement/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/alertsmanagement/ci.mgmt.yml - sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/alertsmanagement/ci.mgmt.yml + - sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/analysisservices/ci.mgmt.yml b/sdk/analysisservices/ci.mgmt.yml index 33729b962d88..d3774b358380 100644 --- a/sdk/analysisservices/ci.mgmt.yml +++ b/sdk/analysisservices/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/analysisservices/ci.mgmt.yml - sdk/analysisservices/Azure.ResourceManager.Analysis/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/analysisservices/ci.mgmt.yml + - sdk/analysisservices/Azure.ResourceManager.Analysis/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/apicenter/ci.mgmt.yml b/sdk/apicenter/ci.mgmt.yml index 41c037327e33..4882d4409c0b 100644 --- a/sdk/apicenter/ci.mgmt.yml +++ b/sdk/apicenter/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/apicenter/ci.mgmt.yml - sdk/apicenter/Azure.ResourceManager.ApiCenter/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/apicenter/ci.mgmt.yml + - sdk/apicenter/Azure.ResourceManager.ApiCenter/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/apimanagement/ci.mgmt.yml b/sdk/apimanagement/ci.mgmt.yml index b72c80a2e0e6..2f766edb9528 100644 --- a/sdk/apimanagement/ci.mgmt.yml +++ b/sdk/apimanagement/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/apimanagement/ci.mgmt.yml - sdk/apimanagement/Azure.ResourceManager.ApiManagement/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/apimanagement/ci.mgmt.yml + - sdk/apimanagement/Azure.ResourceManager.ApiManagement/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/appcomplianceautomation/ci.mgmt.yml b/sdk/appcomplianceautomation/ci.mgmt.yml index d8a31e0139a8..7c3b00d97c17 100644 --- a/sdk/appcomplianceautomation/ci.mgmt.yml +++ b/sdk/appcomplianceautomation/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/appcomplianceautomation/ci.mgmt.yml - sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/appcomplianceautomation/ci.mgmt.yml + - sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/appconfiguration/ci.mgmt.yml b/sdk/appconfiguration/ci.mgmt.yml index a883eaefcd59..e53dd63aca0f 100644 --- a/sdk/appconfiguration/ci.mgmt.yml +++ b/sdk/appconfiguration/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/appconfiguration/ci.mgmt.yml - sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/appconfiguration/ci.mgmt.yml + - sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/ + # These comments should stay. extends: diff --git a/sdk/applicationinsights/ci.mgmt.yml b/sdk/applicationinsights/ci.mgmt.yml index af82b66e6952..361f4019d322 100644 --- a/sdk/applicationinsights/ci.mgmt.yml +++ b/sdk/applicationinsights/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/applicationinsights/ci.mgmt.yml - sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/applicationinsights/ci.mgmt.yml + - sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/appplatform/ci.mgmt.yml b/sdk/appplatform/ci.mgmt.yml index 1d28b9352b6c..023cebeb8d71 100644 --- a/sdk/appplatform/ci.mgmt.yml +++ b/sdk/appplatform/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/appplatform/ci.mgmt.yml - sdk/appplatform/Azure.ResourceManager.AppPlatform/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/appplatform/ci.mgmt.yml + - sdk/appplatform/Azure.ResourceManager.AppPlatform/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/arc-scvmm/ci.mgmt.yml b/sdk/arc-scvmm/ci.mgmt.yml index bbc2db0c9f63..53438df9d332 100644 --- a/sdk/arc-scvmm/ci.mgmt.yml +++ b/sdk/arc-scvmm/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/arc-scvmm/ci.mgmt.yml - sdk/arc-scvmm/Azure.ResourceManager.ScVmm/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/arc-scvmm/ci.mgmt.yml + - sdk/arc-scvmm/Azure.ResourceManager.ScVmm/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/astronomer/ci.mgmt.yml b/sdk/astronomer/ci.mgmt.yml index f6099036651c..d0de6d52b29a 100644 --- a/sdk/astronomer/ci.mgmt.yml +++ b/sdk/astronomer/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/astronomer/ci.mgmt.yml - sdk/astronomer/Azure.ResourceManager.Astro/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/astronomer/ci.mgmt.yml + - sdk/astronomer/Azure.ResourceManager.Astro/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/attestation/ci.mgmt.yml b/sdk/attestation/ci.mgmt.yml index 51d1ac0c8240..595f887b2c35 100644 --- a/sdk/attestation/ci.mgmt.yml +++ b/sdk/attestation/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/attestation/ci.mgmt.yml - sdk/attestation/Azure.ResourceManager.Attestation/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/attestation/ci.mgmt.yml + - sdk/attestation/Azure.ResourceManager.Attestation/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/authorization/ci.mgmt.yml b/sdk/authorization/ci.mgmt.yml index 7ac32fcc5543..9c9d9638348d 100644 --- a/sdk/authorization/ci.mgmt.yml +++ b/sdk/authorization/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/authorization/ci.mgmt.yml - sdk/authorization/Azure.ResourceManager.Authorization/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/authorization/ci.mgmt.yml + - sdk/authorization/Azure.ResourceManager.Authorization/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/automanage/ci.mgmt.yml b/sdk/automanage/ci.mgmt.yml index 5a2467820b85..8e45b6506aa8 100644 --- a/sdk/automanage/ci.mgmt.yml +++ b/sdk/automanage/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/automanage/ci.mgmt.yml - sdk/automanage/Azure.ResourceManager.Automanage/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/automanage/ci.mgmt.yml + - sdk/automanage/Azure.ResourceManager.Automanage/ + extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/automation/ci.mgmt.yml b/sdk/automation/ci.mgmt.yml index 45bec5d1c196..b2cb0f44bf22 100644 --- a/sdk/automation/ci.mgmt.yml +++ b/sdk/automation/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/automation/ci.mgmt.yml - sdk/automation/Azure.ResourceManager.Automation/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/automation/ci.mgmt.yml + - sdk/automation/Azure.ResourceManager.Automation/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/avs/ci.mgmt.yml b/sdk/avs/ci.mgmt.yml index 6404a2ba34ce..7030303dc9f4 100644 --- a/sdk/avs/ci.mgmt.yml +++ b/sdk/avs/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/avs/ci.mgmt.yml - sdk/avs/Azure.ResourceManager.Avs/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/avs/ci.mgmt.yml + - sdk/avs/Azure.ResourceManager.Avs/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/azurelargeinstance/ci.mgmt.yml b/sdk/azurelargeinstance/ci.mgmt.yml index fbe98927ef15..d9425419d2c3 100644 --- a/sdk/azurelargeinstance/ci.mgmt.yml +++ b/sdk/azurelargeinstance/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/azurelargeinstance/ci.mgmt.yml - sdk/azurelargeinstance/Azure.ResourceManager.LargeInstance/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/azurelargeinstance/ci.mgmt.yml + - sdk/azurelargeinstance/Azure.ResourceManager.LargeInstance/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/azurestackhci/ci.mgmt.yml b/sdk/azurestackhci/ci.mgmt.yml index 89c22080e00c..167241c22e36 100644 --- a/sdk/azurestackhci/ci.mgmt.yml +++ b/sdk/azurestackhci/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/azurestackhci/ci.mgmt.yml - sdk/azurestackhci/Azure.ResourceManager.Hci/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/azurestackhci/ci.mgmt.yml + - sdk/azurestackhci/Azure.ResourceManager.Hci/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/batch/ci.mgmt.yml b/sdk/batch/ci.mgmt.yml index fdb37873525c..57a9135b3c71 100644 --- a/sdk/batch/ci.mgmt.yml +++ b/sdk/batch/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/batch/ci.mgmt.yml - sdk/batch/Azure.ResourceManager.Batch/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/batch/ci.mgmt.yml + - sdk/batch/Azure.ResourceManager.Batch/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/billing/ci.mgmt.yml b/sdk/billing/ci.mgmt.yml index 67cf904850c6..0efcab4a9c90 100644 --- a/sdk/billing/ci.mgmt.yml +++ b/sdk/billing/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/billing/ci.mgmt.yml - sdk/billing/Azure.ResourceManager.Billing/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/billing/ci.mgmt.yml + - sdk/billing/Azure.ResourceManager.Billing/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/billingbenefits/ci.mgmt.yml b/sdk/billingbenefits/ci.mgmt.yml index 9900a842be4f..d2d1e939d8cd 100644 --- a/sdk/billingbenefits/ci.mgmt.yml +++ b/sdk/billingbenefits/ci.mgmt.yml @@ -2,6 +2,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -14,6 +15,18 @@ pr: - sdk/billingbenefits/ci.mgmt.yml - sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/billingbenefits/ci.mgmt.yml + - sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/blueprint/ci.mgmt.yml b/sdk/blueprint/ci.mgmt.yml index 65bd23b77f51..6524937da4ee 100644 --- a/sdk/blueprint/ci.mgmt.yml +++ b/sdk/blueprint/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/blueprint/ci.mgmt.yml - sdk/blueprint/Azure.ResourceManager.Blueprint/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/blueprint/ci.mgmt.yml + - sdk/blueprint/Azure.ResourceManager.Blueprint/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/botservice/ci.mgmt.yml b/sdk/botservice/ci.mgmt.yml index 8e5444ff3f9a..3e991a6ebab1 100644 --- a/sdk/botservice/ci.mgmt.yml +++ b/sdk/botservice/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/botservice/ci.mgmt.yml - sdk/botservice/Azure.ResourceManager.BotService/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/botservice/ci.mgmt.yml + - sdk/botservice/Azure.ResourceManager.BotService/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/cdn/ci.mgmt.yml b/sdk/cdn/ci.mgmt.yml index ac2ea82249d1..f1932c6d31b9 100644 --- a/sdk/cdn/ci.mgmt.yml +++ b/sdk/cdn/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/cdn/ci.mgmt.yml - sdk/cdn/Azure.ResourceManager.Cdn/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/cdn/ci.mgmt.yml + - sdk/cdn/Azure.ResourceManager.Cdn/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/changeanalysis/ci.mgmt.yml b/sdk/changeanalysis/ci.mgmt.yml index 65c6e90d195a..aee7612c339f 100644 --- a/sdk/changeanalysis/ci.mgmt.yml +++ b/sdk/changeanalysis/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/changeanalysis/ci.mgmt.yml - sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/changeanalysis/ci.mgmt.yml + - sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/chaos/ci.mgmt.yml b/sdk/chaos/ci.mgmt.yml index 585591bcb6bd..a74922d27932 100644 --- a/sdk/chaos/ci.mgmt.yml +++ b/sdk/chaos/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/chaos/ci.mgmt.yml - sdk/chaos/Azure.ResourceManager.Chaos/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/chaos/ci.mgmt.yml + - sdk/chaos/Azure.ResourceManager.Chaos/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: 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 ae6a6dc979f5..979e02824f65 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 @@ -22,7 +22,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/stable/2024-10-01/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 @@ -83,7 +83,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/stable/2024-10-01/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 @@ -125,7 +125,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/stable/2024-10-01/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 @@ -159,7 +159,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/stable/2024-10-01/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 @@ -189,7 +189,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/stable/2024-10-01/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 @@ -231,7 +231,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/stable/2024-10-01/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 04f9ce870073..615da8c0e529 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 @@ -20,7 +20,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/stable/2024-10-01/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 @@ -57,7 +57,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/stable/2024-10-01/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 @@ -92,7 +92,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/stable/2024-10-01/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 @@ -123,7 +123,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/stable/2024-10-01/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 @@ -166,7 +166,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/stable/2024-10-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. // 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 @@ -189,6 +189,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() @@ -197,11 +201,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 57fbf82748fb..db6f35e8625e 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 @@ -20,7 +20,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/stable/2024-10-01/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 @@ -47,13 +47,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/stable/2024-10-01/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(); @@ -62,7 +62,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"; @@ -70,24 +70,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 @@ -102,7 +92,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/stable/2024-10-01/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 @@ -124,5 +114,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/stable/2024-10-01/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 01ff3fbc8467..b317794b8848 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 @@ -21,7 +21,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/stable/2024-10-01/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 @@ -57,7 +57,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/stable/2024-10-01/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 @@ -84,7 +84,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/stable/2024-10-01/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 @@ -115,7 +115,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/stable/2024-10-01/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 @@ -147,7 +147,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/stable/2024-10-01/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 @@ -174,7 +174,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/stable/2024-10-01/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 @@ -202,7 +202,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/stable/2024-10-01/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 @@ -232,7 +232,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/stable/2024-10-01/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 @@ -262,7 +262,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/stable/2024-10-01/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 @@ -292,7 +292,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/stable/2024-10-01/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 e6ac7a25620d..a7802134b2a1 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 @@ -21,7 +21,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/stable/2024-10-01/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 @@ -72,7 +72,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/stable/2024-10-01/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 @@ -106,7 +106,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/stable/2024-10-01/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 @@ -136,7 +136,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/stable/2024-10-01/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 @@ -178,7 +178,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/stable/2024-10-01/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 a5cf3a9f02bb..9bade39a300f 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 @@ -21,7 +21,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/stable/2024-10-01/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 @@ -38,14 +38,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 @@ -60,7 +60,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/stable/2024-10-01/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 @@ -87,7 +87,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/stable/2024-10-01/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 @@ -118,7 +118,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/stable/2024-10-01/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 6db3e6b12e24..84ccf527fef8 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 @@ -20,7 +20,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/stable/2024-10-01/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 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/stable/2024-10-01/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 @@ -86,7 +86,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/stable/2024-10-01/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 02e0acb3a5b2..6900c103d0d8 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 @@ -20,7 +20,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/stable/2024-10-01/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 @@ -52,7 +52,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/stable/2024-10-01/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 @@ -80,7 +80,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/stable/2024-10-01/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 dd2ed1a15f8c..e0332a290589 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 @@ -19,7 +19,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/stable/2024-10-01/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 @@ -56,7 +56,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/stable/2024-10-01/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 @@ -91,7 +91,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/stable/2024-10-01/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 @@ -122,7 +122,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/stable/2024-10-01/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 ac1170ee8b3c..828cfdfea610 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 @@ -19,7 +19,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/stable/2024-10-01/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 @@ -51,7 +51,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/stable/2024-10-01/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 f22d1ead4ee6..f60883f764fe 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 @@ -19,7 +19,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/stable/2024-10-01/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 @@ -56,7 +56,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/stable/2024-10-01/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 @@ -91,7 +91,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/stable/2024-10-01/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 @@ -122,7 +122,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/stable/2024-10-01/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 @@ -165,7 +165,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/stable/2024-10-01/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 aef0f054ebdd..0195327450c1 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 @@ -19,7 +19,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/stable/2024-10-01/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 @@ -51,7 +51,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/stable/2024-10-01/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 @@ -88,7 +88,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/stable/2024-10-01/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 cf7f1095e934..6d2b7481c60b 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 @@ -20,7 +20,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/stable/2024-10-01/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 @@ -57,7 +57,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/stable/2024-10-01/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 @@ -92,7 +92,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/stable/2024-10-01/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 @@ -123,7 +123,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/stable/2024-10-01/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 @@ -166,7 +166,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/stable/2024-10-01/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 7321d9172339..0b518dd14b8b 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 @@ -20,7 +20,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/stable/2024-10-01/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 @@ -52,7 +52,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/stable/2024-10-01/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 @@ -98,7 +98,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/stable/2024-10-01/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_DefenderForAISettingCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_DefenderForAISettingCollection.cs new file mode 100644 index 000000000000..fa971e2b4a1e --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_DefenderForAISettingCollection.cs @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.CognitiveServices.Models; + +namespace Azure.ResourceManager.CognitiveServices.Samples +{ + public partial class Sample_DefenderForAISettingCollection + { + // ListDefenderForAISetting + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListDefenderForAISetting() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListDefenderForAISetting.json + // this example is just showing the usage of "DefenderForAISettings_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 DefenderForAISettingResource + DefenderForAISettingCollection collection = cognitiveServicesAccount.GetDefenderForAISettings(); + + // invoke the operation and iterate over the result + await foreach (DefenderForAISettingResource 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 + DefenderForAISettingData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // GetDefenderForAISetting + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetDefenderForAISetting() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetDefenderForAISetting.json + // this example is just showing the usage of "DefenderForAISettings_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 DefenderForAISettingResource + DefenderForAISettingCollection collection = cognitiveServicesAccount.GetDefenderForAISettings(); + + // invoke the operation + string defenderForAISettingName = "Default"; + DefenderForAISettingResource result = await collection.GetAsync(defenderForAISettingName); + + // 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 + DefenderForAISettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GetDefenderForAISetting + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetDefenderForAISetting() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetDefenderForAISetting.json + // this example is just showing the usage of "DefenderForAISettings_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 DefenderForAISettingResource + DefenderForAISettingCollection collection = cognitiveServicesAccount.GetDefenderForAISettings(); + + // invoke the operation + string defenderForAISettingName = "Default"; + bool result = await collection.ExistsAsync(defenderForAISettingName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // GetDefenderForAISetting + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDefenderForAISetting() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetDefenderForAISetting.json + // this example is just showing the usage of "DefenderForAISettings_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 DefenderForAISettingResource + DefenderForAISettingCollection collection = cognitiveServicesAccount.GetDefenderForAISettings(); + + // invoke the operation + string defenderForAISettingName = "Default"; + NullableResponse response = await collection.GetIfExistsAsync(defenderForAISettingName); + DefenderForAISettingResource 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 + DefenderForAISettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // PutDefenderForAISetting + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_PutDefenderForAISetting() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/PutDefenderForAISetting.json + // this example is just showing the usage of "DefenderForAISettings_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 DefenderForAISettingResource + DefenderForAISettingCollection collection = cognitiveServicesAccount.GetDefenderForAISettings(); + + // invoke the operation + string defenderForAISettingName = "Default"; + DefenderForAISettingData data = new DefenderForAISettingData() + { + State = DefenderForAISettingState.Enabled, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, defenderForAISettingName, data); + DefenderForAISettingResource 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 + DefenderForAISettingData 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_DefenderForAISettingResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_DefenderForAISettingResource.cs new file mode 100644 index 000000000000..d8835bf2cfd9 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_DefenderForAISettingResource.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.CognitiveServices.Models; + +namespace Azure.ResourceManager.CognitiveServices.Samples +{ + public partial class Sample_DefenderForAISettingResource + { + // GetDefenderForAISetting + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetDefenderForAISetting() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetDefenderForAISetting.json + // this example is just showing the usage of "DefenderForAISettings_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 DefenderForAISettingResource created on azure + // for more information of creating DefenderForAISettingResource, please refer to the document of DefenderForAISettingResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resourceGroupName"; + string accountName = "accountName"; + string defenderForAISettingName = "Default"; + ResourceIdentifier defenderForAISettingResourceId = DefenderForAISettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, defenderForAISettingName); + DefenderForAISettingResource defenderForAISetting = client.GetDefenderForAISettingResource(defenderForAISettingResourceId); + + // invoke the operation + DefenderForAISettingResource result = await defenderForAISetting.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 + DefenderForAISettingData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // UpdateDefenderForAISetting + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_UpdateDefenderForAISetting() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/UpdateDefenderForAISetting.json + // this example is just showing the usage of "DefenderForAISettings_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(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DefenderForAISettingResource created on azure + // for more information of creating DefenderForAISettingResource, please refer to the document of DefenderForAISettingResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resourceGroupName"; + string accountName = "accountName"; + string defenderForAISettingName = "Default"; + ResourceIdentifier defenderForAISettingResourceId = DefenderForAISettingResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, defenderForAISettingName); + DefenderForAISettingResource defenderForAISetting = client.GetDefenderForAISettingResource(defenderForAISettingResourceId); + + // invoke the operation + DefenderForAISettingData data = new DefenderForAISettingData() + { + State = DefenderForAISettingState.Enabled, + }; + DefenderForAISettingResource result = await defenderForAISetting.UpdateAsync(data); + + // 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 + DefenderForAISettingData 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_EncryptionScopeCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_EncryptionScopeCollection.cs new file mode 100644 index 000000000000..26d0cba98d1f --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_EncryptionScopeCollection.cs @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +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/stable/2024-10-01/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/stable/2024-10-01/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/stable/2024-10-01/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/stable/2024-10-01/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/stable/2024-10-01/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 000000000000..f2c98491c506 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_EncryptionScopeResource.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +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/stable/2024-10-01/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/stable/2024-10-01/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/stable/2024-10-01/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_NetworkSecurityPerimeterConfigurationCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_NetworkSecurityPerimeterConfigurationCollection.cs new file mode 100644 index 000000000000..fbfcc13ddbd9 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_NetworkSecurityPerimeterConfigurationCollection.cs @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.CognitiveServices.Samples +{ + public partial class Sample_NetworkSecurityPerimeterConfigurationCollection + { + // ListNetworkSecurityPerimeterConfigurations + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListNetworkSecurityPerimeterConfigurations() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListNetworkSecurityPerimeterConfigurations.json + // this example is just showing the usage of "NetworkSecurityPerimeterConfigurations_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 NetworkSecurityPerimeterConfigurationResource + NetworkSecurityPerimeterConfigurationCollection collection = cognitiveServicesAccount.GetNetworkSecurityPerimeterConfigurations(); + + // invoke the operation and iterate over the result + await foreach (NetworkSecurityPerimeterConfigurationResource 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 + NetworkSecurityPerimeterConfigurationData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // GetNetworkSecurityPerimeterConfigurations + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetNetworkSecurityPerimeterConfigurations() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetNetworkSecurityPerimeterConfigurations.json + // this example is just showing the usage of "NetworkSecurityPerimeterConfigurations_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 NetworkSecurityPerimeterConfigurationResource + NetworkSecurityPerimeterConfigurationCollection collection = cognitiveServicesAccount.GetNetworkSecurityPerimeterConfigurations(); + + // invoke the operation + string nspConfigurationName = "NSPConfigurationName"; + NetworkSecurityPerimeterConfigurationResource result = await collection.GetAsync(nspConfigurationName); + + // 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 + NetworkSecurityPerimeterConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GetNetworkSecurityPerimeterConfigurations + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetNetworkSecurityPerimeterConfigurations() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetNetworkSecurityPerimeterConfigurations.json + // this example is just showing the usage of "NetworkSecurityPerimeterConfigurations_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 NetworkSecurityPerimeterConfigurationResource + NetworkSecurityPerimeterConfigurationCollection collection = cognitiveServicesAccount.GetNetworkSecurityPerimeterConfigurations(); + + // invoke the operation + string nspConfigurationName = "NSPConfigurationName"; + bool result = await collection.ExistsAsync(nspConfigurationName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // GetNetworkSecurityPerimeterConfigurations + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetNetworkSecurityPerimeterConfigurations() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetNetworkSecurityPerimeterConfigurations.json + // this example is just showing the usage of "NetworkSecurityPerimeterConfigurations_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 NetworkSecurityPerimeterConfigurationResource + NetworkSecurityPerimeterConfigurationCollection collection = cognitiveServicesAccount.GetNetworkSecurityPerimeterConfigurations(); + + // invoke the operation + string nspConfigurationName = "NSPConfigurationName"; + NullableResponse response = await collection.GetIfExistsAsync(nspConfigurationName); + NetworkSecurityPerimeterConfigurationResource 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 + NetworkSecurityPerimeterConfigurationData 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_NetworkSecurityPerimeterConfigurationResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_NetworkSecurityPerimeterConfigurationResource.cs new file mode 100644 index 000000000000..2ecfc31fb0ef --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_NetworkSecurityPerimeterConfigurationResource.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.CognitiveServices.Samples +{ + public partial class Sample_NetworkSecurityPerimeterConfigurationResource + { + // GetNetworkSecurityPerimeterConfigurations + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetNetworkSecurityPerimeterConfigurations() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetNetworkSecurityPerimeterConfigurations.json + // this example is just showing the usage of "NetworkSecurityPerimeterConfigurations_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 NetworkSecurityPerimeterConfigurationResource created on azure + // for more information of creating NetworkSecurityPerimeterConfigurationResource, please refer to the document of NetworkSecurityPerimeterConfigurationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resourceGroupName"; + string accountName = "accountName"; + string nspConfigurationName = "NSPConfigurationName"; + ResourceIdentifier networkSecurityPerimeterConfigurationResourceId = NetworkSecurityPerimeterConfigurationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, nspConfigurationName); + NetworkSecurityPerimeterConfigurationResource networkSecurityPerimeterConfiguration = client.GetNetworkSecurityPerimeterConfigurationResource(networkSecurityPerimeterConfigurationResourceId); + + // invoke the operation + NetworkSecurityPerimeterConfigurationResource result = await networkSecurityPerimeterConfiguration.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 + NetworkSecurityPerimeterConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ReconcileNetworkSecurityPerimeterConfigurations + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Reconcile_ReconcileNetworkSecurityPerimeterConfigurations() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ReconcileNetworkSecurityPerimeterConfigurations.json + // this example is just showing the usage of "NetworkSecurityPerimeterConfigurations_Reconcile" 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 NetworkSecurityPerimeterConfigurationResource created on azure + // for more information of creating NetworkSecurityPerimeterConfigurationResource, please refer to the document of NetworkSecurityPerimeterConfigurationResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "resourceGroupName"; + string accountName = "accountName"; + string nspConfigurationName = "NSPConfigurationName"; + ResourceIdentifier networkSecurityPerimeterConfigurationResourceId = NetworkSecurityPerimeterConfigurationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, nspConfigurationName); + NetworkSecurityPerimeterConfigurationResource networkSecurityPerimeterConfiguration = client.GetNetworkSecurityPerimeterConfigurationResource(networkSecurityPerimeterConfigurationResourceId); + + // invoke the operation + ArmOperation lro = await networkSecurityPerimeterConfiguration.ReconcileAsync(WaitUntil.Completed); + NetworkSecurityPerimeterConfigurationResource 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 + NetworkSecurityPerimeterConfigurationData 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_RaiBlocklistCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_RaiBlocklistCollection.cs new file mode 100644 index 000000000000..ca15db9ec541 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_RaiBlocklistCollection.cs @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +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/stable/2024-10-01/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/stable/2024-10-01/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/stable/2024-10-01/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/stable/2024-10-01/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/stable/2024-10-01/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 000000000000..b71a74b7cac3 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_RaiBlocklistItemCollection.cs @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +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/stable/2024-10-01/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/stable/2024-10-01/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/stable/2024-10-01/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/stable/2024-10-01/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/stable/2024-10-01/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 000000000000..9edef8cb84bf --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_RaiBlocklistItemResource.cs @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +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/stable/2024-10-01/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/stable/2024-10-01/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/stable/2024-10-01/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 000000000000..c082f80806d4 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_RaiBlocklistResource.cs @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.CognitiveServices.Models; + +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/stable/2024-10-01/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/stable/2024-10-01/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/stable/2024-10-01/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"); + } + + // AddRaiBlocklistItems + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task BatchAddRaiBlocklistItem_AddRaiBlocklistItems() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/AddRaiBlocklistItems.json + // this example is just showing the usage of "RaiBlocklistItems_BatchAdd" 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 = "myblocklist"; + ResourceIdentifier raiBlocklistResourceId = RaiBlocklistResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, accountName, raiBlocklistName); + RaiBlocklistResource raiBlocklist = client.GetRaiBlocklistResource(raiBlocklistResourceId); + + // invoke the operation + IEnumerable content = new RaiBlocklistItemBulkRequest[] + { +new RaiBlocklistItemBulkRequest() +{ +Name = "myblocklistitem1", +Properties = new RaiBlocklistItemProperties() +{ +Pattern = "^[a-z0-9_-]{2,16}$", +IsRegex = true, +}, +},new RaiBlocklistItemBulkRequest() +{ +Name = "myblocklistitem2", +Properties = new RaiBlocklistItemProperties() +{ +Pattern = "blockwords", +IsRegex = false, +}, +} + }; + RaiBlocklistResource result = await raiBlocklist.BatchAddRaiBlocklistItemAsync(content); + + // 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}"); + } + + // DeleteRaiBlocklistItems + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task BatchDeleteRaiBlocklistItem_DeleteRaiBlocklistItems() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/DeleteRaiBlocklistItems.json + // this example is just showing the usage of "RaiBlocklistItems_BatchDelete" 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 + BinaryData raiBlocklistItemsNames = BinaryData.FromObjectAsJson(new object[] { "myblocklistitem1", "myblocklistitem2" }); + await raiBlocklist.BatchDeleteRaiBlocklistItemAsync(raiBlocklistItemsNames); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_RaiContentFilterCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_RaiContentFilterCollection.cs new file mode 100644 index 000000000000..47020c2b0f9c --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_RaiContentFilterCollection.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.CognitiveServices.Samples +{ + public partial class Sample_RaiContentFilterCollection + { + // ListRaiContentFilters + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListRaiContentFilters() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/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); + + // get the collection of this RaiContentFilterResource + AzureLocation location = new AzureLocation("WestUS"); + RaiContentFilterCollection collection = subscriptionResource.GetRaiContentFilters(location); + + // invoke the operation and iterate over the result + await foreach (RaiContentFilterResource 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 + RaiContentFilterData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // GetRaiContentFilters + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetRaiContentFilters() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetRaiContentFilter.json + // this example is just showing the usage of "RaiContentFilters_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 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); + + // get the collection of this RaiContentFilterResource + AzureLocation location = new AzureLocation("WestUS"); + RaiContentFilterCollection collection = subscriptionResource.GetRaiContentFilters(location); + + // invoke the operation + string filterName = "IndirectAttack"; + RaiContentFilterResource result = await collection.GetAsync(filterName); + + // 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 + RaiContentFilterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GetRaiContentFilters + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetRaiContentFilters() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetRaiContentFilter.json + // this example is just showing the usage of "RaiContentFilters_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 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); + + // get the collection of this RaiContentFilterResource + AzureLocation location = new AzureLocation("WestUS"); + RaiContentFilterCollection collection = subscriptionResource.GetRaiContentFilters(location); + + // invoke the operation + string filterName = "IndirectAttack"; + bool result = await collection.ExistsAsync(filterName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // GetRaiContentFilters + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetRaiContentFilters() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetRaiContentFilter.json + // this example is just showing the usage of "RaiContentFilters_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 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); + + // get the collection of this RaiContentFilterResource + AzureLocation location = new AzureLocation("WestUS"); + RaiContentFilterCollection collection = subscriptionResource.GetRaiContentFilters(location); + + // invoke the operation + string filterName = "IndirectAttack"; + NullableResponse response = await collection.GetIfExistsAsync(filterName); + RaiContentFilterResource 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 + RaiContentFilterData 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_RaiContentFilterResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_RaiContentFilterResource.cs new file mode 100644 index 000000000000..33d6b22682fb --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_RaiContentFilterResource.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.CognitiveServices.Samples +{ + public partial class Sample_RaiContentFilterResource + { + // GetRaiContentFilters + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetRaiContentFilters() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetRaiContentFilter.json + // this example is just showing the usage of "RaiContentFilters_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 RaiContentFilterResource created on azure + // for more information of creating RaiContentFilterResource, please refer to the document of RaiContentFilterResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + AzureLocation location = new AzureLocation("WestUS"); + string filterName = "IndirectAttack"; + ResourceIdentifier raiContentFilterResourceId = RaiContentFilterResource.CreateResourceIdentifier(subscriptionId, location, filterName); + RaiContentFilterResource raiContentFilter = client.GetRaiContentFilterResource(raiContentFilterResourceId); + + // invoke the operation + RaiContentFilterResource result = await raiContentFilter.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 + RaiContentFilterData 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_RaiPolicyCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_RaiPolicyCollection.cs new file mode 100644 index 000000000000..5173e8675cec --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_RaiPolicyCollection.cs @@ -0,0 +1,292 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +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/stable/2024-10-01/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/stable/2024-10-01/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/stable/2024-10-01/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/stable/2024-10-01/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/stable/2024-10-01/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() + { + Mode = RaiPolicyMode.AsynchronousFilter, + BasePolicyName = "Microsoft.Default", + ContentFilters = +{ +new RaiPolicyContentFilter() +{ +Name = "Hate", +Enabled = false, +SeverityThreshold = ContentLevel.High, +Blocking = false, +Source = RaiPolicyContentSource.Prompt, +},new RaiPolicyContentFilter() +{ +Name = "Hate", +Enabled = true, +SeverityThreshold = ContentLevel.Medium, +Blocking = true, +Source = RaiPolicyContentSource.Completion, +},new RaiPolicyContentFilter() +{ +Name = "Sexual", +Enabled = true, +SeverityThreshold = ContentLevel.High, +Blocking = true, +Source = RaiPolicyContentSource.Prompt, +},new RaiPolicyContentFilter() +{ +Name = "Sexual", +Enabled = true, +SeverityThreshold = ContentLevel.Medium, +Blocking = true, +Source = RaiPolicyContentSource.Completion, +},new RaiPolicyContentFilter() +{ +Name = "Selfharm", +Enabled = true, +SeverityThreshold = ContentLevel.High, +Blocking = true, +Source = RaiPolicyContentSource.Prompt, +},new RaiPolicyContentFilter() +{ +Name = "Selfharm", +Enabled = true, +SeverityThreshold = ContentLevel.Medium, +Blocking = true, +Source = RaiPolicyContentSource.Completion, +},new RaiPolicyContentFilter() +{ +Name = "Violence", +Enabled = true, +SeverityThreshold = ContentLevel.Medium, +Blocking = true, +Source = RaiPolicyContentSource.Prompt, +},new RaiPolicyContentFilter() +{ +Name = "Violence", +Enabled = true, +SeverityThreshold = ContentLevel.Medium, +Blocking = true, +Source = RaiPolicyContentSource.Completion, +},new RaiPolicyContentFilter() +{ +Name = "Jailbreak", +Enabled = true, +Blocking = true, +Source = RaiPolicyContentSource.Prompt, +},new RaiPolicyContentFilter() +{ +Name = "Protected Material Text", +Enabled = true, +Blocking = true, +Source = RaiPolicyContentSource.Completion, +},new RaiPolicyContentFilter() +{ +Name = "Protected Material Code", +Enabled = true, +Blocking = true, +Source = RaiPolicyContentSource.Completion, +},new RaiPolicyContentFilter() +{ +Name = "Profanity", +Enabled = true, +Blocking = true, +Source = RaiPolicyContentSource.Prompt, +} +}, + }, + }; + 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 000000000000..55a6d6f36f93 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/samples/Generated/Samples/Sample_RaiPolicyResource.cs @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +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/stable/2024-10-01/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/stable/2024-10-01/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() + { + Mode = RaiPolicyMode.AsynchronousFilter, + BasePolicyName = "Microsoft.Default", + ContentFilters = +{ +new RaiPolicyContentFilter() +{ +Name = "Hate", +Enabled = false, +SeverityThreshold = ContentLevel.High, +Blocking = false, +Source = RaiPolicyContentSource.Prompt, +},new RaiPolicyContentFilter() +{ +Name = "Hate", +Enabled = true, +SeverityThreshold = ContentLevel.Medium, +Blocking = true, +Source = RaiPolicyContentSource.Completion, +},new RaiPolicyContentFilter() +{ +Name = "Sexual", +Enabled = true, +SeverityThreshold = ContentLevel.High, +Blocking = true, +Source = RaiPolicyContentSource.Prompt, +},new RaiPolicyContentFilter() +{ +Name = "Sexual", +Enabled = true, +SeverityThreshold = ContentLevel.Medium, +Blocking = true, +Source = RaiPolicyContentSource.Completion, +},new RaiPolicyContentFilter() +{ +Name = "Selfharm", +Enabled = true, +SeverityThreshold = ContentLevel.High, +Blocking = true, +Source = RaiPolicyContentSource.Prompt, +},new RaiPolicyContentFilter() +{ +Name = "Selfharm", +Enabled = true, +SeverityThreshold = ContentLevel.Medium, +Blocking = true, +Source = RaiPolicyContentSource.Completion, +},new RaiPolicyContentFilter() +{ +Name = "Violence", +Enabled = true, +SeverityThreshold = ContentLevel.Medium, +Blocking = true, +Source = RaiPolicyContentSource.Prompt, +},new RaiPolicyContentFilter() +{ +Name = "Violence", +Enabled = true, +SeverityThreshold = ContentLevel.Medium, +Blocking = true, +Source = RaiPolicyContentSource.Completion, +},new RaiPolicyContentFilter() +{ +Name = "Jailbreak", +Enabled = true, +Blocking = true, +Source = RaiPolicyContentSource.Prompt, +},new RaiPolicyContentFilter() +{ +Name = "Protected Material Text", +Enabled = true, +Blocking = true, +Source = RaiPolicyContentSource.Completion, +},new RaiPolicyContentFilter() +{ +Name = "Protected Material Code", +Enabled = true, +Blocking = true, +Source = RaiPolicyContentSource.Completion, +},new RaiPolicyContentFilter() +{ +Name = "Profanity", +Enabled = true, +Blocking = true, +Source = RaiPolicyContentSource.Prompt, +} +}, + }, + }; + 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/stable/2024-10-01/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 2c8ed3909c22..89e4260ba80b 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 @@ -21,7 +21,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/stable/2024-10-01/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 @@ -49,7 +49,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/stable/2024-10-01/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 @@ -78,7 +78,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/stable/2024-10-01/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 @@ -111,7 +111,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/stable/2024-10-01/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 @@ -132,12 +132,67 @@ public async Task CheckDomainAvailability_CheckSKUAvailability() Console.WriteLine($"Succeeded: {result}"); } + // Calculate Model Capacity + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CalculateModelCapacity_CalculateModelCapacity() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/CalculateModelCapacity.json + // this example is just showing the usage of "CalculateModelCapacity" 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 = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation + CalculateModelCapacityParameter calculateModelCapacityParameter = new CalculateModelCapacityParameter() + { + Model = new CognitiveServicesAccountDeploymentModel() + { + Format = "OpenAI", + Name = "gpt-4", + Version = "0613", + }, + SkuName = "ProvisionedManaged", + Workloads = +{ +new ModelCapacityCalculatorWorkload() +{ +RequestPerMinute = 10L, +RequestParameters = new ModelCapacityCalculatorWorkloadRequestParam() +{ +AvgPromptTokens = 30L, +AvgGeneratedTokens = 50L, +}, +},new ModelCapacityCalculatorWorkload() +{ +RequestPerMinute = 20L, +RequestParameters = new ModelCapacityCalculatorWorkloadRequestParam() +{ +AvgPromptTokens = 60L, +AvgGeneratedTokens = 20L, +}, +} +}, + }; + CalculateModelCapacityResult result = await subscriptionResource.CalculateModelCapacityAsync(calculateModelCapacityParameter); + + Console.WriteLine($"Succeeded: {result}"); + } + // ListCommitmentTiers [NUnit.Framework.Test] [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/stable/2024-10-01/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 @@ -161,12 +216,12 @@ public async Task GetCommitmentTiers_ListCommitmentTiers() Console.WriteLine($"Succeeded"); } - // ListModels + // ListLocationModels [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetModels_ListModels() + public async Task GetModels_ListLocationModels() { - // 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/stable/2024-10-01/examples/ListLocationModels.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 @@ -189,5 +244,68 @@ public async Task GetModels_ListModels() Console.WriteLine($"Succeeded"); } + + // ListLocationBasedModelCapacities + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetLocationBasedModelCapacities_ListLocationBasedModelCapacities() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListLocationBasedModelCapacities.json + // this example is just showing the usage of "LocationBasedModelCapacities_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"); + string modelFormat = "OpenAI"; + string modelName = "ada"; + string modelVersion = "1"; + await foreach (ModelCapacityListResultValueItem item in subscriptionResource.GetLocationBasedModelCapacitiesAsync(location, modelFormat, modelName, modelVersion)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ListModelCapacities + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetModelCapacities_ListModelCapacities() + { + // Generated from example definition: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListModelCapacities.json + // this example is just showing the usage of "ModelCapacities_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 + string modelFormat = "OpenAI"; + string modelName = "ada"; + string modelVersion = "1"; + await foreach (ModelCapacityListResultValueItem item in subscriptionResource.GetModelCapacitiesAsync(modelFormat, modelName, modelVersion)) + { + 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 694159ba6d6d..4aae29123b21 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/ArmCognitiveServicesModelFactory.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/ArmCognitiveServicesModelFactory.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; using Azure.Core; using Azure.ResourceManager.Models; @@ -59,6 +60,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. @@ -76,8 +78,9 @@ public static CognitiveServicesAccountData CognitiveServicesAccountData(Resource /// The multiregion settings of Cognitive Services account. /// The commitment plan associations of Cognitive Services account. /// The abuse penalty. + /// Cognitive Services Rai Monitor Config. /// 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, RaiMonitorConfig raiMonitorConfig = null) { capabilities ??= new List(); userOwnedStorage ??= new List(); @@ -97,6 +100,7 @@ public static CognitiveServicesAccountProperties CognitiveServicesAccountPropert networkAcls, encryption, userOwnedStorage?.ToList(), + amlWorkspace, privateEndpointConnections?.ToList(), publicNetworkAccess, apiProperties, @@ -114,6 +118,7 @@ public static CognitiveServicesAccountProperties CognitiveServicesAccountPropert locations, commitmentPlanAssociations?.ToList(), abusePenalty, + raiMonitorConfig, serializedAdditionalRawData: null); } @@ -338,12 +343,14 @@ public static ServiceAccountUsageMetricName ServiceAccountUsageMetricName(string } /// Initializes a new instance of . + /// Deployment model publisher. /// Deployment model format. /// Deployment model name. /// Optional. Deployment model version. If version is not specified, a default version will be assigned. The default version is different for different models and might change when there is new version available for a model. Default version for a model could be found from list models API. /// Optional. Deployment model source ARM resource ID. + /// Optional. Source of the model, another Microsoft.CognitiveServices accounts ARM resource ID. /// The call rate limit Cognitive Services account. - /// Base Model Identifier. + /// Properties of Cognitive Services account deployment model. /// If the model is default version. /// The list of Model Sku. /// The max capacity. @@ -353,17 +360,19 @@ public static ServiceAccountUsageMetricName ServiceAccountUsageMetricName(string /// Model lifecycle status. /// Metadata pertaining to creation and last modification of the resource. /// A new instance for mocking. - public static CognitiveServicesAccountModel CognitiveServicesAccountModel(string format = null, string name = null, string version = null, string source = null, ServiceAccountCallRateLimit callRateLimit = null, CognitiveServicesAccountDeploymentModel baseModel = null, bool? isDefaultVersion = null, IEnumerable skus = null, int? maxCapacity = null, IDictionary capabilities = null, IDictionary finetuneCapabilities = null, ServiceAccountModelDeprecationInfo deprecation = null, ModelLifecycleStatus? lifecycleStatus = null, SystemData systemData = null) + public static CognitiveServicesAccountModel CognitiveServicesAccountModel(string publisher = null, string format = null, string name = null, string version = null, string source = null, ResourceIdentifier sourceAccount = null, ServiceAccountCallRateLimit callRateLimit = null, CognitiveServicesAccountDeploymentModel baseModel = null, bool? isDefaultVersion = null, IEnumerable skus = null, int? maxCapacity = null, IDictionary capabilities = null, IDictionary finetuneCapabilities = null, ServiceAccountModelDeprecationInfo deprecation = null, ModelLifecycleStatus? lifecycleStatus = null, SystemData systemData = null) { skus ??= new List(); capabilities ??= new Dictionary(); finetuneCapabilities ??= new Dictionary(); return new CognitiveServicesAccountModel( + publisher, format, name, version, source, + sourceAccount, callRateLimit, serializedAdditionalRawData: null, baseModel, @@ -378,19 +387,23 @@ public static CognitiveServicesAccountModel CognitiveServicesAccountModel(string } /// Initializes a new instance of . + /// Deployment model publisher. /// Deployment model format. /// Deployment model name. /// Optional. Deployment model version. If version is not specified, a default version will be assigned. The default version is different for different models and might change when there is new version available for a model. Default version for a model could be found from list models API. /// Optional. Deployment model source ARM resource ID. + /// Optional. Source of the model, another Microsoft.CognitiveServices accounts ARM resource ID. /// The call rate limit Cognitive Services account. /// A new instance for mocking. - public static CognitiveServicesAccountDeploymentModel CognitiveServicesAccountDeploymentModel(string format = null, string name = null, string version = null, string source = null, ServiceAccountCallRateLimit callRateLimit = null) + public static CognitiveServicesAccountDeploymentModel CognitiveServicesAccountDeploymentModel(string publisher = null, string format = null, string name = null, string version = null, string source = null, ResourceIdentifier sourceAccount = null, ServiceAccountCallRateLimit callRateLimit = null) { return new CognitiveServicesAccountDeploymentModel( + publisher, format, name, version, source, + sourceAccount, callRateLimit, serializedAdditionalRawData: null); } @@ -401,10 +414,12 @@ public static CognitiveServicesAccountDeploymentModel CognitiveServicesAccountDe /// The datetime of deprecation of the model SKU. /// The capacity configuration. /// The list of rateLimit. + /// The list of billing meter info. /// A new instance for mocking. - public static CognitiveServicesModelSku CognitiveServicesModelSku(string name = null, string usageName = null, DateTimeOffset? deprecationOn = null, CognitiveServicesCapacityConfig capacity = null, IEnumerable rateLimits = null) + public static CognitiveServicesModelSku CognitiveServicesModelSku(string name = null, string usageName = null, DateTimeOffset? deprecationOn = null, CognitiveServicesCapacityConfig capacity = null, IEnumerable rateLimits = null, IEnumerable cost = null) { rateLimits ??= new List(); + cost ??= new List(); return new CognitiveServicesModelSku( name, @@ -412,6 +427,7 @@ public static CognitiveServicesModelSku CognitiveServicesModelSku(string name = deprecationOn, capacity, rateLimits?.ToList(), + cost?.ToList(), serializedAdditionalRawData: null); } @@ -478,13 +494,34 @@ public static CommitmentCost CommitmentCost(string commitmentMeterId = null, str } /// Initializes a new instance of . - /// Model Metadata. - /// The Kind of the Model. - /// The SKU of the Model. + /// Cognitive Services account Model. + /// The kind (type) of cognitive service account. + /// The name of SKU. + /// The description of the model. /// A new instance for mocking. - public static CognitiveServicesModel CognitiveServicesModel(CognitiveServicesAccountModel model = null, string kind = null, string skuName = null) + public static CognitiveServicesModel CognitiveServicesModel(CognitiveServicesAccountModel model = null, string kind = null, string skuName = null, string description = null) + { + return new CognitiveServicesModel(model, kind, skuName, description, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The location of the Model Sku Capacity. + /// Cognitive Services account ModelSkuCapacity. + /// A new instance for mocking. + public static ModelCapacityListResultValueItem ModelCapacityListResultValueItem(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AzureLocation? location = null, ModelSkuCapacityProperties properties = null) { - return new CognitiveServicesModel(model, kind, skuName, serializedAdditionalRawData: null); + return new ModelCapacityListResultValueItem( + id, + name, + resourceType, + systemData, + location, + properties, + serializedAdditionalRawData: null); } /// Initializes a new instance of . @@ -515,6 +552,25 @@ public static CognitiveServicesDomainAvailabilityList CognitiveServicesDomainAva serializedAdditionalRawData: null); } + /// Initializes a new instance of . + /// Properties of Cognitive Services account deployment model. + /// + /// Model Estimated Capacity. + /// A new instance for mocking. + public static CalculateModelCapacityResult CalculateModelCapacityResult(CognitiveServicesAccountDeploymentModel model = null, string skuName = null, CalculateModelCapacityResultEstimatedCapacity estimatedCapacity = null) + { + return new CalculateModelCapacityResult(model, skuName, estimatedCapacity, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// + /// + /// A new instance for mocking. + public static CalculateModelCapacityResultEstimatedCapacity CalculateModelCapacityResultEstimatedCapacity(int? value = null, int? deployableValue = null) + { + return new CalculateModelCapacityResultEstimatedCapacity(value, deployableValue, serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// The id. /// The name. @@ -554,10 +610,13 @@ 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) { + tags ??= new Dictionary(); + return new CognitiveServicesAccountDeploymentData( id, name, @@ -565,6 +624,7 @@ public static CognitiveServicesAccountDeploymentData CognitiveServicesAccountDep systemData, sku, etag, + tags, properties, serializedAdditionalRawData: null); } @@ -572,14 +632,18 @@ public static CognitiveServicesAccountDeploymentData CognitiveServicesAccountDep /// 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. + /// The name of parent deployment. /// 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, string parentDeploymentName = null) { capabilities ??= new Dictionary(); rateLimits ??= new List(); @@ -593,6 +657,10 @@ public static CognitiveServicesAccountDeploymentProperties CognitiveServicesAcco callRateLimit, rateLimits?.ToList(), versionUpgradeOption, + dynamicThrottlingEnabled, + currentCapacity, + capacitySettings, + parentDeploymentName, serializedAdditionalRawData: null); } @@ -606,6 +674,16 @@ public static CognitiveServicesAccountDeploymentScaleSettings CognitiveServicesA return new CognitiveServicesAccountDeploymentScaleSettings(scaleType, capacity, activeCapacity, serializedAdditionalRawData: null); } + /// 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, serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// The id. /// The name. @@ -682,24 +760,375 @@ public static CommitmentPeriod CommitmentPeriod(string tier = null, int? count = serializedAdditionalRawData: null); } + /// 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, + serializedAdditionalRawData: null); + } + + /// 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, serializedAdditionalRawData: null, 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, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Content Filters policy type. + /// Rai policy mode. The enum value mapping is as below: Default = 0, Deferred=1, Blocking=2, Asynchronous_filter =3. Please use 'Asynchronous_filter' after 2024-10-01. It is the same as 'Deferred' in previous version. + /// Name of Rai policy. + /// The list of Content Filters. + /// The list of custom Blocklist. + /// A new instance for mocking. + public static RaiPolicyProperties RaiPolicyProperties(RaiPolicyType? policyType = null, RaiPolicyMode? mode = null, string basePolicyName = null, IEnumerable contentFilters = null, IEnumerable customBlocklists = null) + { + contentFilters ??= new List(); + customBlocklists ??= new List(); + + return new RaiPolicyProperties( + policyType, + mode, + basePolicyName, + contentFilters?.ToList(), + customBlocklists?.ToList(), + serializedAdditionalRawData: null); + } + + /// 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, serializedAdditionalRawData: null) : null, + serializedAdditionalRawData: 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, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Azure OpenAI Content Filter Properties. + /// A new instance for mocking. + public static RaiContentFilterData RaiContentFilterData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, RaiContentFilterProperties properties = null) + { + return new RaiContentFilterData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + /// 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) { + tags ??= new Dictionary(); + return new CommitmentPlanAccountAssociationData( id, name, resourceType, systemData, etag, + tags, accountId, serializedAdditionalRawData: null); } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// NSP Configuration properties. + /// A new instance for mocking. + public static NetworkSecurityPerimeterConfigurationData NetworkSecurityPerimeterConfigurationData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, NetworkSecurityPerimeterConfigurationProperties properties = null) + { + return new NetworkSecurityPerimeterConfigurationData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Provisioning state of NetworkSecurityPerimeter configuration. + /// List of Provisioning Issues. + /// Information about a linked Network Security Perimeter. + /// Network Security Perimeter Configuration Association Information. + /// Network Security Perimeter Profile Information. + /// A new instance for mocking. + public static NetworkSecurityPerimeterConfigurationProperties NetworkSecurityPerimeterConfigurationProperties(string provisioningState = null, IEnumerable provisioningIssues = null, NetworkSecurityPerimeter networkSecurityPerimeter = null, NetworkSecurityPerimeterConfigurationAssociationInfo resourceAssociation = null, NetworkSecurityPerimeterProfileInfo profile = null) + { + provisioningIssues ??= new List(); + + return new NetworkSecurityPerimeterConfigurationProperties( + provisioningState, + provisioningIssues?.ToList(), + networkSecurityPerimeter, + resourceAssociation, + profile, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Resource Etag. + /// Resource tags. + /// Defender for AI state on the AI resource. + /// A new instance for mocking. + public static DefenderForAISettingData DefenderForAISettingData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ETag? etag = null, IDictionary tags = null, DefenderForAISettingState? state = null) + { + tags ??= new Dictionary(); + + return new DefenderForAISettingData( + id, + name, + resourceType, + systemData, + etag, + tags, + state, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Gets the status of the cognitive services account at the time the operation was called. + /// Endpoint of the created account. + /// Gets the capabilities of the cognitive services account. Each item indicates the capability of a specific feature. The values are read-only and for reference only. + /// If the resource is migrated from an existing key. + /// Resource migration token. + /// Sku change info of account. + /// Optional subdomain name used for token-based authentication. + /// A collection of rules governing the accessibility from specific network locations. + /// The encryption properties for this resource. + /// The storage accounts for this resource. + /// 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. + /// Gets the date of cognitive services account creation. + /// The call rate limit Cognitive Services account. + /// The flag to enable dynamic throttling. + /// + /// + /// + /// + /// Dictionary of <string>. + /// + /// The deletion date, only available for deleted account. + /// The scheduled purge date, only available for deleted account. + /// The multiregion settings of Cognitive Services account. + /// The commitment plan associations of Cognitive Services account. + /// The abuse penalty. + /// A new instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static CognitiveServicesAccountProperties CognitiveServicesAccountProperties(ServiceAccountProvisioningState? provisioningState, string endpoint, IEnumerable capabilities, bool? isMigrated, string migrationToken, CognitiveServicesSkuChangeInfo skuChangeInfo, string customSubDomainName, CognitiveServicesNetworkRuleSet networkAcls, ServiceAccountEncryptionProperties encryption, IEnumerable userOwnedStorage, IEnumerable privateEndpointConnections, ServiceAccountPublicNetworkAccess? publicNetworkAccess, ServiceAccountApiProperties apiProperties, DateTimeOffset? createdOn, ServiceAccountCallRateLimit callRateLimit, bool? enableDynamicThrottling, ServiceAccountQuotaLimit quotaLimit, bool? restrictOutboundNetworkAccess, IEnumerable allowedFqdnList, bool? disableLocalAuth, IReadOnlyDictionary endpoints, bool? restore, DateTimeOffset? deletedOn, string scheduledPurgeDate, CognitiveServicesMultiRegionSettings locations, IEnumerable commitmentPlanAssociations, AbusePenalty abusePenalty) + { + return CognitiveServicesAccountProperties(provisioningState: provisioningState, endpoint: endpoint, capabilities: capabilities, isMigrated: isMigrated, migrationToken: migrationToken, skuChangeInfo: skuChangeInfo, customSubDomainName: customSubDomainName, networkAcls: networkAcls, encryption: encryption, userOwnedStorage: userOwnedStorage, amlWorkspace: default, privateEndpointConnections: privateEndpointConnections, publicNetworkAccess: publicNetworkAccess, apiProperties: apiProperties, createdOn: createdOn, callRateLimit: callRateLimit, enableDynamicThrottling: enableDynamicThrottling, quotaLimit: quotaLimit, restrictOutboundNetworkAccess: restrictOutboundNetworkAccess, allowedFqdnList: allowedFqdnList, disableLocalAuth: disableLocalAuth, endpoints: endpoints, restore: restore, deletedOn: deletedOn, scheduledPurgeDate: scheduledPurgeDate, locations: locations, commitmentPlanAssociations: commitmentPlanAssociations, abusePenalty: abusePenalty, raiMonitorConfig: default); + } + + /// Initializes a new instance of . + /// Deployment model format. + /// Deployment model name. + /// Optional. Deployment model version. If version is not specified, a default version will be assigned. The default version is different for different models and might change when there is new version available for a model. Default version for a model could be found from list models API. + /// Optional. Deployment model source ARM resource ID. + /// The call rate limit Cognitive Services account. + /// Base Model Identifier. + /// If the model is default version. + /// The list of Model Sku. + /// The max capacity. + /// The capabilities. + /// The capabilities for finetune models. + /// Cognitive Services account ModelDeprecationInfo. + /// Model lifecycle status. + /// Metadata pertaining to creation and last modification of the resource. + /// A new instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static CognitiveServicesAccountModel CognitiveServicesAccountModel(string format, string name, string version, string source, ServiceAccountCallRateLimit callRateLimit, CognitiveServicesAccountDeploymentModel baseModel, bool? isDefaultVersion, IEnumerable skus, int? maxCapacity, IDictionary capabilities, IDictionary finetuneCapabilities, ServiceAccountModelDeprecationInfo deprecation, ModelLifecycleStatus? lifecycleStatus, SystemData systemData) + { + return CognitiveServicesAccountModel(publisher: default, format: format, name: name, version: version, source: source, sourceAccount: default, callRateLimit: callRateLimit, baseModel: baseModel, isDefaultVersion: isDefaultVersion, skus: skus, maxCapacity: maxCapacity, capabilities: capabilities, finetuneCapabilities: finetuneCapabilities, deprecation: deprecation, lifecycleStatus: lifecycleStatus, systemData: systemData); + } + + /// Initializes a new instance of . + /// Deployment model format. + /// Deployment model name. + /// Optional. Deployment model version. If version is not specified, a default version will be assigned. The default version is different for different models and might change when there is new version available for a model. Default version for a model could be found from list models API. + /// Optional. Deployment model source ARM resource ID. + /// The call rate limit Cognitive Services account. + /// A new instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static CognitiveServicesAccountDeploymentModel CognitiveServicesAccountDeploymentModel(string format, string name, string version, string source, ServiceAccountCallRateLimit callRateLimit) + { + return CognitiveServicesAccountDeploymentModel(publisher: default, format: format, name: name, version: version, source: source, sourceAccount: default, callRateLimit: callRateLimit); + } + + /// Initializes a new instance of . + /// The name of the model SKU. + /// The usage name of the model SKU. + /// The datetime of deprecation of the model SKU. + /// The capacity configuration. + /// The list of rateLimit. + /// A new instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static CognitiveServicesModelSku CognitiveServicesModelSku(string name, string usageName, DateTimeOffset? deprecationOn, CognitiveServicesCapacityConfig capacity, IEnumerable rateLimits) + { + return CognitiveServicesModelSku(name: name, usageName: usageName, deprecationOn: deprecationOn, capacity: capacity, rateLimits: rateLimits, cost: default); + } + + /// Initializes a new instance of . + /// Model Metadata. + /// The Kind of the Model. + /// The SKU of the Model. + /// A new instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static CognitiveServicesModel CognitiveServicesModel(CognitiveServicesAccountModel model, string kind, string skuName) + { + return CognitiveServicesModel(model: model, kind: kind, skuName: skuName, description: default); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource model definition representing SKU. + /// Resource Etag. + /// Properties of Cognitive Services account deployment. + /// A new instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static CognitiveServicesAccountDeploymentData CognitiveServicesAccountDeploymentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, CognitiveServicesSku sku, ETag? etag, CognitiveServicesAccountDeploymentProperties properties) + { + return CognitiveServicesAccountDeploymentData(id: id, name: name, resourceType: resourceType, systemData: systemData, sku: sku, etag: etag, tags: default, properties: 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. + /// The capabilities. + /// The name of RAI policy. + /// The call rate limit Cognitive Services account. + /// + /// Deployment model version upgrade option. + /// A new instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static CognitiveServicesAccountDeploymentProperties CognitiveServicesAccountDeploymentProperties(CognitiveServicesAccountDeploymentProvisioningState? provisioningState, CognitiveServicesAccountDeploymentModel model, CognitiveServicesAccountDeploymentScaleSettings scaleSettings, IReadOnlyDictionary capabilities, string raiPolicyName, ServiceAccountCallRateLimit callRateLimit, IEnumerable rateLimits, DeploymentModelVersionUpgradeOption? versionUpgradeOption) + { + return CognitiveServicesAccountDeploymentProperties(provisioningState: provisioningState, model: model, scaleSettings: scaleSettings, capabilities: capabilities, raiPolicyName: raiPolicyName, callRateLimit: callRateLimit, rateLimits: rateLimits, versionUpgradeOption: versionUpgradeOption, dynamicThrottlingEnabled: default, currentCapacity: default, capacitySettings: default, parentDeploymentName: default); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Resource Etag. + /// The Azure resource id of the account. + /// A new instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static CommitmentPlanAccountAssociationData CommitmentPlanAccountAssociationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ETag? etag, string accountId) + { + return CommitmentPlanAccountAssociationData(id: id, name: name, resourceType: resourceType, systemData: systemData, etag: etag, tags: default, accountId: accountId); + } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountCollection.cs index 09d8bda433d1..1a0bb9dd497f 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountCollection.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountCollection.cs @@ -65,7 +65,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -114,7 +114,7 @@ public virtual async Task> Create /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -163,7 +163,7 @@ public virtual ArmOperation CreateOrUpdate(Wai /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -208,7 +208,7 @@ public virtual async Task> GetAsync(s /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -253,7 +253,7 @@ public virtual Response Get(string accountName /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -283,7 +283,7 @@ public virtual AsyncPageable GetAllAsync(Cance /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -313,7 +313,7 @@ public virtual Pageable GetAll(CancellationTok /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -356,7 +356,7 @@ public virtual async Task> ExistsAsync(string accountName, Cancel /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -399,7 +399,7 @@ public virtual Response Exists(string accountName, CancellationToken cance /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -444,7 +444,7 @@ public virtual async Task> Ge /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountDeploymentCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountDeploymentCollection.cs index e6890065c49e..af0e267fd268 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountDeploymentCollection.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountDeploymentCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -113,7 +113,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -162,7 +162,7 @@ public virtual ArmOperation CreateOr /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -207,7 +207,7 @@ public virtual async Task> /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -252,7 +252,7 @@ public virtual Response Get(string d /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -282,7 +282,7 @@ public virtual AsyncPageable GetAllA /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -312,7 +312,7 @@ public virtual Pageable GetAll(Cance /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -355,7 +355,7 @@ public virtual async Task> ExistsAsync(string deploymentName, Can /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -398,7 +398,7 @@ public virtual Response Exists(string deploymentName, CancellationToken ca /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -443,7 +443,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountDeploymentData.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountDeploymentData.Serialization.cs index 17def325aebe..a4af8771ad01 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountDeploymentData.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountDeploymentData.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Linq; using System.Text; using System.Text.Json; using Azure.Core; @@ -48,6 +49,17 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("etag"u8); writer.WriteStringValue(ETag.Value.ToString()); } + 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); @@ -77,6 +89,7 @@ internal static CognitiveServicesAccountDeploymentData DeserializeCognitiveServi } CognitiveServicesSku sku = default; ETag? etag = default; + IDictionary tags = default; CognitiveServicesAccountDeploymentProperties properties = default; ResourceIdentifier id = default; string name = default; @@ -104,6 +117,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) @@ -150,6 +177,7 @@ internal static CognitiveServicesAccountDeploymentData DeserializeCognitiveServi systemData, sku, etag, + tags ?? new ChangeTrackingDictionary(), properties, serializedAdditionalRawData); } @@ -188,6 +216,43 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Tags), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" tags: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Tags)) + { + if (Tags.Any()) + { + builder.Append(" tags: "); + builder.AppendLine("{"); + foreach (var item in Tags) + { + builder.Append($" '{item.Key}': "); + if (item.Value == null) + { + builder.Append("null"); + continue; + } + if (item.Value.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{item.Value}'''"); + } + else + { + builder.AppendLine($"'{item.Value}'"); + } + } + builder.AppendLine(" }"); + } + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Sku), out propertyOverride); if (hasPropertyOverride) { diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountDeploymentData.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountDeploymentData.cs index 9f1c76d9d33c..bdf7d73ae8c8 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountDeploymentData.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountDeploymentData.cs @@ -54,6 +54,7 @@ public partial class CognitiveServicesAccountDeploymentData : ResourceData /// Initializes a new instance of . public CognitiveServicesAccountDeploymentData() { + Tags = new ChangeTrackingDictionary(); } /// Initializes a new instance of . @@ -63,12 +64,14 @@ public CognitiveServicesAccountDeploymentData() /// The systemData. /// The resource model definition representing SKU. /// Resource Etag. + /// Resource tags. /// Properties of Cognitive Services account deployment. /// Keeps track of any properties unknown to the library. - internal CognitiveServicesAccountDeploymentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, CognitiveServicesSku sku, ETag? etag, CognitiveServicesAccountDeploymentProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal CognitiveServicesAccountDeploymentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, CognitiveServicesSku sku, ETag? etag, IDictionary tags, CognitiveServicesAccountDeploymentProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Sku = sku; ETag = etag; + Tags = tags; Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -79,6 +82,9 @@ internal CognitiveServicesAccountDeploymentData(ResourceIdentifier id, string na /// Resource Etag. [WirePath("etag")] public ETag? ETag { get; } + /// Resource tags. + [WirePath("tags")] + public IDictionary Tags { get; } /// Properties of Cognitive Services account deployment. [WirePath("properties")] 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 5daa9aefcabd..32d4699f2eea 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountDeploymentResource.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountDeploymentResource.cs @@ -6,11 +6,14 @@ #nullable disable using System; +using System.Collections.Generic; using System.Globalization; using System.Threading; using System.Threading.Tasks; +using Autorest.CSharp.Core; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager.CognitiveServices.Models; namespace Azure.ResourceManager.CognitiveServices { @@ -101,7 +104,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -141,7 +144,7 @@ public virtual async Task> /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -181,7 +184,7 @@ public virtual Response Get(Cancella /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -223,7 +226,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -253,7 +256,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 @@ -261,11 +264,11 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Operation Id - /// Deployments_CreateOrUpdate + /// Deployments_Update /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -274,19 +277,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 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; @@ -299,7 +302,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 @@ -307,11 +310,11 @@ public virtual async Task /// /// Operation Id - /// Deployments_CreateOrUpdate + /// Deployments_Update /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -320,19 +323,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 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; @@ -343,5 +346,423 @@ 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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, e => SkuResource.DeserializeSkuResource(e), _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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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, e => SkuResource.DeserializeSkuResource(e), _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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 1424ae28761b..0b61ae1534c7 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountResource.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountResource.cs @@ -115,7 +115,7 @@ public virtual CognitiveServicesPrivateEndpointConnectionCollection GetCognitive /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -146,7 +146,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -184,7 +184,7 @@ public virtual CognitiveServicesAccountDeploymentCollection GetCognitiveServices /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -215,7 +215,7 @@ public virtual async Task> /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -253,7 +253,7 @@ public virtual CommitmentPlanCollection GetCommitmentPlans() /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -284,7 +284,7 @@ public virtual async Task> GetCommitmentPlanAsy /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -302,6 +302,351 @@ 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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); + } + + /// Gets a collection of NetworkSecurityPerimeterConfigurationResources in the CognitiveServicesAccount. + /// An object representing collection of NetworkSecurityPerimeterConfigurationResources and their operations over a NetworkSecurityPerimeterConfigurationResource. + public virtual NetworkSecurityPerimeterConfigurationCollection GetNetworkSecurityPerimeterConfigurations() + { + return GetCachedClient(client => new NetworkSecurityPerimeterConfigurationCollection(client, Id)); + } + + /// + /// Gets the specified NSP configurations for an account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/networkSecurityPerimeterConfigurations/{nspConfigurationName} + /// + /// + /// Operation Id + /// NetworkSecurityPerimeterConfigurations_Get + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the NSP Configuration. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNetworkSecurityPerimeterConfigurationAsync(string nspConfigurationName, CancellationToken cancellationToken = default) + { + return await GetNetworkSecurityPerimeterConfigurations().GetAsync(nspConfigurationName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified NSP configurations for an account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/networkSecurityPerimeterConfigurations/{nspConfigurationName} + /// + /// + /// Operation Id + /// NetworkSecurityPerimeterConfigurations_Get + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the NSP Configuration. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNetworkSecurityPerimeterConfiguration(string nspConfigurationName, CancellationToken cancellationToken = default) + { + return GetNetworkSecurityPerimeterConfigurations().Get(nspConfigurationName, cancellationToken); + } + + /// Gets a collection of DefenderForAISettingResources in the CognitiveServicesAccount. + /// An object representing collection of DefenderForAISettingResources and their operations over a DefenderForAISettingResource. + public virtual DefenderForAISettingCollection GetDefenderForAISettings() + { + return GetCachedClient(client => new DefenderForAISettingCollection(client, Id)); + } + + /// + /// Gets the specified Defender for AI setting by name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/defenderForAISettings/{defenderForAISettingName} + /// + /// + /// Operation Id + /// DefenderForAISettings_Get + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the defender for AI setting. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDefenderForAISettingAsync(string defenderForAISettingName, CancellationToken cancellationToken = default) + { + return await GetDefenderForAISettings().GetAsync(defenderForAISettingName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified Defender for AI setting by name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/defenderForAISettings/{defenderForAISettingName} + /// + /// + /// Operation Id + /// DefenderForAISettings_Get + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the defender for AI setting. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDefenderForAISetting(string defenderForAISettingName, CancellationToken cancellationToken = default) + { + return GetDefenderForAISettings().Get(defenderForAISettingName, cancellationToken); + } + /// /// Returns a Cognitive Services account specified by the parameters. /// @@ -315,7 +660,7 @@ public virtual Response GetCommitmentPlan(string commitm /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -355,7 +700,7 @@ public virtual async Task> GetAsync(C /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -395,7 +740,7 @@ public virtual Response Get(CancellationToken /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -437,7 +782,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -479,7 +824,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -525,7 +870,7 @@ public virtual async Task> Update /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -571,7 +916,7 @@ public virtual ArmOperation Update(WaitUntil w /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -609,7 +954,7 @@ public virtual async Task> GetKeysAsync(Cancella /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -647,7 +992,7 @@ public virtual Response GetKeys(CancellationToken cancell /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -689,7 +1034,7 @@ public virtual async Task> RegenerateKeyAsync(Re /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -731,7 +1076,7 @@ public virtual Response RegenerateKey(RegenerateServiceAc /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -760,7 +1105,7 @@ public virtual AsyncPageable GetSkusAsync(Cancellat /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -789,7 +1134,7 @@ public virtual Pageable GetSkus(CancellationToken c /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -819,7 +1164,7 @@ public virtual AsyncPageable GetUsagesAsync(string filter = /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -849,7 +1194,7 @@ public virtual Pageable GetUsages(string filter = null, Can /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -879,7 +1224,7 @@ public virtual AsyncPageable GetModelsAsync(Cance /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -909,7 +1254,7 @@ public virtual Pageable GetModels(CancellationTok /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// @@ -934,7 +1279,7 @@ public virtual AsyncPageable GetPrivateLin /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// @@ -959,7 +1304,7 @@ public virtual Pageable GetPrivateLinkReso /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -1021,7 +1366,7 @@ public virtual async Task> AddTagAsyn /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -1083,7 +1428,7 @@ public virtual Response AddTag(string key, str /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -1140,7 +1485,7 @@ public virtual async Task> SetTagsAsy /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -1197,7 +1542,7 @@ public virtual Response SetTags(IDictionary /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -1257,7 +1602,7 @@ public virtual async Task> RemoveTagA /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesCommitmentPlanCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesCommitmentPlanCollection.cs index 3b26950989a2..f6b0b88f45b9 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesCommitmentPlanCollection.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesCommitmentPlanCollection.cs @@ -65,7 +65,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -114,7 +114,7 @@ public virtual async Task> /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -163,7 +163,7 @@ public virtual ArmOperation CreateOrUpd /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -208,7 +208,7 @@ public virtual async Task> Get /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -253,7 +253,7 @@ public virtual Response Get(string comm /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -283,7 +283,7 @@ public virtual AsyncPageable GetAllAsyn /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -313,7 +313,7 @@ public virtual Pageable GetAll(Cancella /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -356,7 +356,7 @@ public virtual async Task> ExistsAsync(string commitmentPlanName, /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -399,7 +399,7 @@ public virtual Response Exists(string commitmentPlanName, CancellationToke /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -444,7 +444,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesCommitmentPlanResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesCommitmentPlanResource.cs index f6ea735365ab..fde21d5c4a06 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesCommitmentPlanResource.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesCommitmentPlanResource.cs @@ -110,7 +110,7 @@ public virtual CommitmentPlanAccountAssociationCollection GetCommitmentPlanAccou /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -141,7 +141,7 @@ public virtual async Task> Ge /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -172,7 +172,7 @@ public virtual Response GetCommitmentP /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -212,7 +212,7 @@ public virtual async Task> Get /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -252,7 +252,7 @@ public virtual Response Get(Cancellatio /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -294,7 +294,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -336,7 +336,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -345,19 +345,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; @@ -382,7 +382,7 @@ public virtual async Task> /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -391,19 +391,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; @@ -428,7 +428,7 @@ public virtual ArmOperation Update(Wait /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -460,7 +460,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); @@ -490,7 +490,7 @@ public virtual async Task> Add /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -522,7 +522,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); @@ -552,7 +552,7 @@ public virtual Response AddTag(string k /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -583,7 +583,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()); @@ -609,7 +609,7 @@ public virtual async Task> Set /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -640,7 +640,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()); @@ -666,7 +666,7 @@ public virtual Response SetTags(IDictio /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -696,7 +696,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); @@ -726,7 +726,7 @@ public virtual async Task> Rem /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -756,7 +756,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/CognitiveServicesDeletedAccountCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesDeletedAccountCollection.cs index 99944912ebe6..668533de66fe 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesDeletedAccountCollection.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesDeletedAccountCollection.cs @@ -62,7 +62,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -110,7 +110,7 @@ public virtual async Task> Get /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -158,7 +158,7 @@ public virtual Response Get(AzureLocati /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -204,7 +204,7 @@ public virtual async Task> ExistsAsync(AzureLocation location, st /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -250,7 +250,7 @@ public virtual Response Exists(AzureLocation location, string resourceGrou /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -298,7 +298,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesDeletedAccountResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesDeletedAccountResource.cs index 887a48045d22..b4f03982244f 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesDeletedAccountResource.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesDeletedAccountResource.cs @@ -102,7 +102,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -142,7 +142,7 @@ public virtual async Task> Get /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -182,7 +182,7 @@ public virtual Response Get(Cancellatio /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -224,7 +224,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesPrivateEndpointConnectionCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesPrivateEndpointConnectionCollection.cs index 891828855443..856efa8a03e1 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesPrivateEndpointConnectionCollection.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesPrivateEndpointConnectionCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -109,7 +109,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -154,7 +154,7 @@ public virtual Response Get( /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -183,7 +183,7 @@ public virtual AsyncPageable /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -212,7 +212,7 @@ public virtual Pageable GetA /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -255,7 +255,7 @@ public virtual async Task> ExistsAsync(string privateEndpointConn /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -298,7 +298,7 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -343,7 +343,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesPrivateEndpointConnectionResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesPrivateEndpointConnectionResource.cs index cf0c4228fe81..b90be59e0938 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesPrivateEndpointConnectionResource.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesPrivateEndpointConnectionResource.cs @@ -101,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -141,7 +141,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -181,7 +181,7 @@ public virtual Response Get( /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -223,7 +223,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanAccountAssociationCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanAccountAssociationCollection.cs index e0949d181892..96dcc25abf0b 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanAccountAssociationCollection.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanAccountAssociationCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -113,7 +113,7 @@ public virtual async Task /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -162,7 +162,7 @@ public virtual ArmOperation CreateOrUp /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -207,7 +207,7 @@ public virtual async Task> Ge /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -252,7 +252,7 @@ public virtual Response Get(string com /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -282,7 +282,7 @@ public virtual AsyncPageable GetAllAsy /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -312,7 +312,7 @@ public virtual Pageable GetAll(Cancell /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -355,7 +355,7 @@ public virtual async Task> ExistsAsync(string commitmentPlanAssoc /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -398,7 +398,7 @@ public virtual Response Exists(string commitmentPlanAssociationName, Cance /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -443,7 +443,7 @@ public virtual async Task /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanAccountAssociationData.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanAccountAssociationData.Serialization.cs index f8e1c1687fce..5abc0239fe0c 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanAccountAssociationData.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanAccountAssociationData.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Linq; using System.Text; using System.Text.Json; using Azure.Core; @@ -42,6 +43,17 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("etag"u8); writer.WriteStringValue(ETag.Value.ToString()); } + 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)) @@ -73,6 +85,7 @@ internal static CommitmentPlanAccountAssociationData DeserializeCommitmentPlanAc return null; } ETag? etag = default; + IDictionary tags = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; @@ -91,6 +104,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()); @@ -144,6 +171,7 @@ internal static CommitmentPlanAccountAssociationData DeserializeCommitmentPlanAc type, systemData, etag, + tags ?? new ChangeTrackingDictionary(), accountId, serializedAdditionalRawData); } @@ -182,6 +210,43 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Tags), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" tags: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Tags)) + { + if (Tags.Any()) + { + builder.Append(" tags: "); + builder.AppendLine("{"); + foreach (var item in Tags) + { + builder.Append($" '{item.Key}': "); + if (item.Value == null) + { + builder.Append("null"); + continue; + } + if (item.Value.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{item.Value}'''"); + } + else + { + builder.AppendLine($"'{item.Value}'"); + } + } + builder.AppendLine(" }"); + } + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ETag), out propertyOverride); if (hasPropertyOverride) { diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanAccountAssociationData.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanAccountAssociationData.cs index b620e2672e0c..07ff3894647f 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanAccountAssociationData.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanAccountAssociationData.cs @@ -53,6 +53,7 @@ public partial class CommitmentPlanAccountAssociationData : ResourceData /// Initializes a new instance of . public CommitmentPlanAccountAssociationData() { + Tags = new ChangeTrackingDictionary(); } /// Initializes a new instance of . @@ -61,11 +62,13 @@ public CommitmentPlanAccountAssociationData() /// The resourceType. /// The systemData. /// Resource Etag. + /// Resource tags. /// The Azure resource id of the account. /// Keeps track of any properties unknown to the library. - internal CommitmentPlanAccountAssociationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ETag? etag, string accountId, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal CommitmentPlanAccountAssociationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ETag? etag, IDictionary tags, string accountId, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ETag = etag; + Tags = tags; AccountId = accountId; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -73,6 +76,9 @@ internal CommitmentPlanAccountAssociationData(ResourceIdentifier id, string name /// Resource Etag. [WirePath("etag")] public ETag? ETag { get; } + /// Resource tags. + [WirePath("tags")] + public IDictionary Tags { get; } /// The Azure resource id of the account. [WirePath("properties.accountId")] 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 5e23772c10c8..ca5e5560a47e 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; @@ -101,7 +102,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -141,7 +142,7 @@ public virtual async Task> Ge /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -181,7 +182,7 @@ public virtual Response Get(Cancellati /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -223,7 +224,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -265,7 +266,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -311,7 +312,7 @@ public virtual async Task /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -343,5 +344,341 @@ 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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/CommitmentPlanCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanCollection.cs index 58bde2e96d60..7af9d9d926e9 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanCollection.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -115,7 +115,7 @@ public virtual async Task> CreateOrUpdateAs /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -166,7 +166,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil wai /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -211,7 +211,7 @@ public virtual async Task> GetAsync(string comm /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -256,7 +256,7 @@ public virtual Response Get(string commitmentPlanName, C /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -286,7 +286,7 @@ public virtual AsyncPageable GetAllAsync(CancellationTok /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -316,7 +316,7 @@ public virtual Pageable GetAll(CancellationToken cancell /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -359,7 +359,7 @@ public virtual async Task> ExistsAsync(string commitmentPlanName, /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -402,7 +402,7 @@ public virtual Response Exists(string commitmentPlanName, CancellationToke /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -447,7 +447,7 @@ public virtual async Task> GetIfExistsA /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanResource.cs index abac906bee29..798edf8b7390 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanResource.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CommitmentPlanResource.cs @@ -102,7 +102,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -142,7 +142,7 @@ public virtual async Task> GetAsync(Cancellatio /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -182,7 +182,7 @@ public virtual Response Get(CancellationToken cancellati /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -224,7 +224,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -266,7 +266,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -314,7 +314,7 @@ public virtual async Task> UpdateAsync(Wait /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -362,7 +362,7 @@ public virtual ArmOperation Update(WaitUntil waitUntil, /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -419,7 +419,7 @@ public virtual async Task> AddTagAsync(string k /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -476,7 +476,7 @@ public virtual Response AddTag(string key, string value, /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -532,7 +532,7 @@ public virtual async Task> SetTagsAsync(IDictio /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -588,7 +588,7 @@ public virtual Response SetTags(IDictionary /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -643,7 +643,7 @@ public virtual async Task> RemoveTagAsync(strin /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/DefenderForAISettingCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/DefenderForAISettingCollection.cs new file mode 100644 index 000000000000..e8a2a836cf85 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/DefenderForAISettingCollection.cs @@ -0,0 +1,497 @@ +// 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.Core; +using Azure.Core.Pipeline; + +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 GetDefenderForAISettings method from an instance of . + /// + public partial class DefenderForAISettingCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _defenderForAISettingClientDiagnostics; + private readonly DefenderForAISettingsRestOperations _defenderForAISettingRestClient; + + /// Initializes a new instance of the class for mocking. + protected DefenderForAISettingCollection() + { + } + + /// 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 DefenderForAISettingCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _defenderForAISettingClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.CognitiveServices", DefenderForAISettingResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DefenderForAISettingResource.ResourceType, out string defenderForAISettingApiVersion); + _defenderForAISettingRestClient = new DefenderForAISettingsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, defenderForAISettingApiVersion); +#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)); + } + + /// + /// Creates or Updates the specified Defender for AI setting. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/defenderForAISettings/{defenderForAISettingName} + /// + /// + /// Operation Id + /// DefenderForAISettings_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 defender for AI setting. + /// Properties describing the Defender for AI setting. + /// 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 defenderForAISettingName, DefenderForAISettingData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(defenderForAISettingName, nameof(defenderForAISettingName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _defenderForAISettingClientDiagnostics.CreateScope("DefenderForAISettingCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _defenderForAISettingRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, defenderForAISettingName, data, cancellationToken).ConfigureAwait(false); + var uri = _defenderForAISettingRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, defenderForAISettingName, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new CognitiveServicesArmOperation(Response.FromValue(new DefenderForAISettingResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or Updates the specified Defender for AI setting. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/defenderForAISettings/{defenderForAISettingName} + /// + /// + /// Operation Id + /// DefenderForAISettings_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 defender for AI setting. + /// Properties describing the Defender for AI setting. + /// 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 defenderForAISettingName, DefenderForAISettingData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(defenderForAISettingName, nameof(defenderForAISettingName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _defenderForAISettingClientDiagnostics.CreateScope("DefenderForAISettingCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _defenderForAISettingRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, defenderForAISettingName, data, cancellationToken); + var uri = _defenderForAISettingRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, defenderForAISettingName, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new CognitiveServicesArmOperation(Response.FromValue(new DefenderForAISettingResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the specified Defender for AI setting by name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/defenderForAISettings/{defenderForAISettingName} + /// + /// + /// Operation Id + /// DefenderForAISettings_Get + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the defender for AI setting. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string defenderForAISettingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(defenderForAISettingName, nameof(defenderForAISettingName)); + + using var scope = _defenderForAISettingClientDiagnostics.CreateScope("DefenderForAISettingCollection.Get"); + scope.Start(); + try + { + var response = await _defenderForAISettingRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, defenderForAISettingName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DefenderForAISettingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the specified Defender for AI setting by name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/defenderForAISettings/{defenderForAISettingName} + /// + /// + /// Operation Id + /// DefenderForAISettings_Get + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the defender for AI setting. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string defenderForAISettingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(defenderForAISettingName, nameof(defenderForAISettingName)); + + using var scope = _defenderForAISettingClientDiagnostics.CreateScope("DefenderForAISettingCollection.Get"); + scope.Start(); + try + { + var response = _defenderForAISettingRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, defenderForAISettingName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DefenderForAISettingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists the Defender for AI settings. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/defenderForAISettings + /// + /// + /// Operation Id + /// DefenderForAISettings_List + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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) => _defenderForAISettingRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _defenderForAISettingRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DefenderForAISettingResource(Client, DefenderForAISettingData.DeserializeDefenderForAISettingData(e)), _defenderForAISettingClientDiagnostics, Pipeline, "DefenderForAISettingCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the Defender for AI settings. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/defenderForAISettings + /// + /// + /// Operation Id + /// DefenderForAISettings_List + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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) => _defenderForAISettingRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _defenderForAISettingRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DefenderForAISettingResource(Client, DefenderForAISettingData.DeserializeDefenderForAISettingData(e)), _defenderForAISettingClientDiagnostics, Pipeline, "DefenderForAISettingCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/defenderForAISettings/{defenderForAISettingName} + /// + /// + /// Operation Id + /// DefenderForAISettings_Get + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the defender for AI setting. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string defenderForAISettingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(defenderForAISettingName, nameof(defenderForAISettingName)); + + using var scope = _defenderForAISettingClientDiagnostics.CreateScope("DefenderForAISettingCollection.Exists"); + scope.Start(); + try + { + var response = await _defenderForAISettingRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, defenderForAISettingName, 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}/defenderForAISettings/{defenderForAISettingName} + /// + /// + /// Operation Id + /// DefenderForAISettings_Get + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the defender for AI setting. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string defenderForAISettingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(defenderForAISettingName, nameof(defenderForAISettingName)); + + using var scope = _defenderForAISettingClientDiagnostics.CreateScope("DefenderForAISettingCollection.Exists"); + scope.Start(); + try + { + var response = _defenderForAISettingRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, defenderForAISettingName, 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}/defenderForAISettings/{defenderForAISettingName} + /// + /// + /// Operation Id + /// DefenderForAISettings_Get + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the defender for AI setting. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string defenderForAISettingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(defenderForAISettingName, nameof(defenderForAISettingName)); + + using var scope = _defenderForAISettingClientDiagnostics.CreateScope("DefenderForAISettingCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _defenderForAISettingRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, defenderForAISettingName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DefenderForAISettingResource(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}/defenderForAISettings/{defenderForAISettingName} + /// + /// + /// Operation Id + /// DefenderForAISettings_Get + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the defender for AI setting. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string defenderForAISettingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(defenderForAISettingName, nameof(defenderForAISettingName)); + + using var scope = _defenderForAISettingClientDiagnostics.CreateScope("DefenderForAISettingCollection.GetIfExists"); + scope.Start(); + try + { + var response = _defenderForAISettingRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, defenderForAISettingName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DefenderForAISettingResource(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/DefenderForAISettingData.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/DefenderForAISettingData.Serialization.cs new file mode 100644 index 000000000000..01df7c4c9964 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/DefenderForAISettingData.Serialization.cs @@ -0,0 +1,355 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.CognitiveServices.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.CognitiveServices +{ + public partial class DefenderForAISettingData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DefenderForAISettingData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (options.Format != "W" && Optional.IsDefined(ETag)) + { + writer.WritePropertyName("etag"u8); + writer.WriteStringValue(ETag.Value.ToString()); + } + 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(State)) + { + writer.WritePropertyName("state"u8); + writer.WriteStringValue(State.Value.ToString()); + } + writer.WriteEndObject(); + } + + DefenderForAISettingData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DefenderForAISettingData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDefenderForAISettingData(document.RootElement, options); + } + + internal static DefenderForAISettingData DeserializeDefenderForAISettingData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ETag? etag = default; + IDictionary tags = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + DefenderForAISettingState? state = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + 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("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; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("state"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + state = new DefenderForAISettingState(property0.Value.GetString()); + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DefenderForAISettingData( + id, + name, + type, + systemData, + etag, + tags ?? new ChangeTrackingDictionary(), + state, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Tags), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" tags: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Tags)) + { + if (Tags.Any()) + { + builder.Append(" tags: "); + builder.AppendLine("{"); + foreach (var item in Tags) + { + builder.Append($" '{item.Key}': "); + if (item.Value == null) + { + builder.Append("null"); + continue; + } + if (item.Value.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{item.Value}'''"); + } + else + { + builder.AppendLine($"'{item.Value}'"); + } + } + builder.AppendLine(" }"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ETag), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" etag: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ETag)) + { + builder.Append(" etag: "); + builder.AppendLine($"'{ETag.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.Append(" properties:"); + builder.AppendLine(" {"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(State), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" state: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(State)) + { + builder.Append(" state: "); + builder.AppendLine($"'{State.Value.ToString()}'"); + } + } + + builder.AppendLine(" }"); + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(DefenderForAISettingData)} does not support writing '{options.Format}' format."); + } + } + + DefenderForAISettingData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDefenderForAISettingData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DefenderForAISettingData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/DefenderForAISettingData.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/DefenderForAISettingData.cs new file mode 100644 index 000000000000..8145638936d7 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/DefenderForAISettingData.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.CognitiveServices.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.CognitiveServices +{ + /// + /// A class representing the DefenderForAISetting data model. + /// The Defender for AI resource. + /// + public partial class DefenderForAISettingData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public DefenderForAISettingData() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Resource Etag. + /// Resource tags. + /// Defender for AI state on the AI resource. + /// Keeps track of any properties unknown to the library. + internal DefenderForAISettingData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ETag? etag, IDictionary tags, DefenderForAISettingState? state, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + ETag = etag; + Tags = tags; + State = state; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Resource Etag. + [WirePath("etag")] + public ETag? ETag { get; } + /// Resource tags. + [WirePath("tags")] + public IDictionary Tags { get; } + /// Defender for AI state on the AI resource. + [WirePath("properties.state")] + public DefenderForAISettingState? State { get; set; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/DefenderForAISettingResource.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/DefenderForAISettingResource.Serialization.cs new file mode 100644 index 000000000000..725672f07fdb --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/DefenderForAISettingResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.CognitiveServices +{ + public partial class DefenderForAISettingResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + DefenderForAISettingData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + DefenderForAISettingData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/DefenderForAISettingResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/DefenderForAISettingResource.cs new file mode 100644 index 000000000000..51201f20c22b --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/DefenderForAISettingResource.cs @@ -0,0 +1,614 @@ +// 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.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.CognitiveServices +{ + /// + /// A Class representing a DefenderForAISetting 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 GetDefenderForAISettingResource method. + /// Otherwise you can get one from its parent resource using the GetDefenderForAISetting method. + /// + public partial class DefenderForAISettingResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The defenderForAISettingName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string defenderForAISettingName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/defenderForAISettings/{defenderForAISettingName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _defenderForAISettingClientDiagnostics; + private readonly DefenderForAISettingsRestOperations _defenderForAISettingRestClient; + private readonly DefenderForAISettingData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.CognitiveServices/accounts/defenderForAISettings"; + + /// Initializes a new instance of the class for mocking. + protected DefenderForAISettingResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DefenderForAISettingResource(ArmClient client, DefenderForAISettingData 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 DefenderForAISettingResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _defenderForAISettingClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.CognitiveServices", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string defenderForAISettingApiVersion); + _defenderForAISettingRestClient = new DefenderForAISettingsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, defenderForAISettingApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// 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 DefenderForAISettingData 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 Defender for AI setting by name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/defenderForAISettings/{defenderForAISettingName} + /// + /// + /// Operation Id + /// DefenderForAISettings_Get + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _defenderForAISettingClientDiagnostics.CreateScope("DefenderForAISettingResource.Get"); + scope.Start(); + try + { + var response = await _defenderForAISettingRestClient.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 DefenderForAISettingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the specified Defender for AI setting by name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/defenderForAISettings/{defenderForAISettingName} + /// + /// + /// Operation Id + /// DefenderForAISettings_Get + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _defenderForAISettingClientDiagnostics.CreateScope("DefenderForAISettingResource.Get"); + scope.Start(); + try + { + var response = _defenderForAISettingRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DefenderForAISettingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the specified Defender for AI setting. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/defenderForAISettings/{defenderForAISettingName} + /// + /// + /// Operation Id + /// DefenderForAISettings_Update + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Properties describing the Defender for AI setting. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(DefenderForAISettingData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _defenderForAISettingClientDiagnostics.CreateScope("DefenderForAISettingResource.Update"); + scope.Start(); + try + { + var response = await _defenderForAISettingRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DefenderForAISettingResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the specified Defender for AI setting. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/defenderForAISettings/{defenderForAISettingName} + /// + /// + /// Operation Id + /// DefenderForAISettings_Update + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Properties describing the Defender for AI setting. + /// The cancellation token to use. + /// is null. + public virtual Response Update(DefenderForAISettingData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _defenderForAISettingClientDiagnostics.CreateScope("DefenderForAISettingResource.Update"); + scope.Start(); + try + { + var response = _defenderForAISettingRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + return Response.FromValue(new DefenderForAISettingResource(Client, response.Value), response.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}/defenderForAISettings/{defenderForAISettingName} + /// + /// + /// Operation Id + /// DefenderForAISettings_Get + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 = _defenderForAISettingClientDiagnostics.CreateScope("DefenderForAISettingResource.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 _defenderForAISettingRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DefenderForAISettingResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DefenderForAISettingData(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + 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}/defenderForAISettings/{defenderForAISettingName} + /// + /// + /// Operation Id + /// DefenderForAISettings_Get + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 = _defenderForAISettingClientDiagnostics.CreateScope("DefenderForAISettingResource.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 = _defenderForAISettingRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new DefenderForAISettingResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DefenderForAISettingData(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + 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}/defenderForAISettings/{defenderForAISettingName} + /// + /// + /// Operation Id + /// DefenderForAISettings_Get + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 = _defenderForAISettingClientDiagnostics.CreateScope("DefenderForAISettingResource.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 _defenderForAISettingRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DefenderForAISettingResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DefenderForAISettingData(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + 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}/defenderForAISettings/{defenderForAISettingName} + /// + /// + /// Operation Id + /// DefenderForAISettings_Get + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 = _defenderForAISettingClientDiagnostics.CreateScope("DefenderForAISettingResource.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 = _defenderForAISettingRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new DefenderForAISettingResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DefenderForAISettingData(); + patch.Tags.ReplaceWith(tags); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + 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}/defenderForAISettings/{defenderForAISettingName} + /// + /// + /// Operation Id + /// DefenderForAISettings_Get + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 = _defenderForAISettingClientDiagnostics.CreateScope("DefenderForAISettingResource.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 _defenderForAISettingRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DefenderForAISettingResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DefenderForAISettingData(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + 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}/defenderForAISettings/{defenderForAISettingName} + /// + /// + /// Operation Id + /// DefenderForAISettings_Get + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 = _defenderForAISettingClientDiagnostics.CreateScope("DefenderForAISettingResource.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 = _defenderForAISettingRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new DefenderForAISettingResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DefenderForAISettingData(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + 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 000000000000..3ee893173a6c --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/EncryptionScopeCollection.cs @@ -0,0 +1,497 @@ +// 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.Core; +using Azure.Core.Pipeline; + +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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 uri = _encryptionScopeRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, encryptionScopeName, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new CognitiveServicesArmOperation(Response.FromValue(new EncryptionScopeResource(Client, response), response.GetRawResponse()), rehydrationToken); + 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 uri = _encryptionScopeRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, encryptionScopeName, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new CognitiveServicesArmOperation(Response.FromValue(new EncryptionScopeResource(Client, response), response.GetRawResponse()), rehydrationToken); + 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/EncryptionScopeData.Serialization.cs new file mode 100644 index 000000000000..521f27202bf4 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/EncryptionScopeData.Serialization.cs @@ -0,0 +1,337 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.CognitiveServices.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.CognitiveServices +{ + public partial class EncryptionScopeData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EncryptionScopeData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (options.Format != "W" && Optional.IsDefined(ETag)) + { + writer.WritePropertyName("etag"u8); + writer.WriteStringValue(ETag.Value.ToString()); + } + 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, options); + } + } + + EncryptionScopeData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EncryptionScopeData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEncryptionScopeData(document.RootElement, options); + } + + internal static EncryptionScopeData DeserializeEncryptionScopeData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ETag? etag = default; + IDictionary tags = default; + EncryptionScopeProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + 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, options); + 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; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EncryptionScopeData( + id, + name, + type, + systemData, + etag, + tags ?? new ChangeTrackingDictionary(), + properties, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Tags), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" tags: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Tags)) + { + if (Tags.Any()) + { + builder.Append(" tags: "); + builder.AppendLine("{"); + foreach (var item in Tags) + { + builder.Append($" '{item.Key}': "); + if (item.Value == null) + { + builder.Append("null"); + continue; + } + if (item.Value.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{item.Value}'''"); + } + else + { + builder.AppendLine($"'{item.Value}'"); + } + } + builder.AppendLine(" }"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ETag), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" etag: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ETag)) + { + builder.Append(" etag: "); + builder.AppendLine($"'{ETag.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" properties: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Properties)) + { + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(EncryptionScopeData)} does not support writing '{options.Format}' format."); + } + } + + EncryptionScopeData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEncryptionScopeData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EncryptionScopeData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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 000000000000..44148d204504 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/EncryptionScopeData.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +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 + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// 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. + /// Keeps track of any properties unknown to the library. + internal EncryptionScopeData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ETag? etag, IDictionary tags, EncryptionScopeProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + ETag = etag; + Tags = tags; + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Resource Etag. + [WirePath("etag")] + public ETag? ETag { get; } + /// Resource tags. + [WirePath("tags")] + public IDictionary Tags { get; } + /// Properties of Cognitive Services EncryptionScope. + [WirePath("properties")] + public EncryptionScopeProperties Properties { get; set; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/EncryptionScopeResource.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/EncryptionScopeResource.Serialization.cs new file mode 100644 index 000000000000..d5077cd53cae --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/EncryptionScopeResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.CognitiveServices +{ + public partial class EncryptionScopeResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + EncryptionScopeData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + EncryptionScopeData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} 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 000000000000..4a045de6d1af --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/EncryptionScopeResource.cs @@ -0,0 +1,688 @@ +// 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.Core; +using Azure.Core.Pipeline; + +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; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.CognitiveServices/accounts/encryptionScopes"; + + /// 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 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 uri = _encryptionScopeRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new CognitiveServicesArmOperation(Response.FromValue(new EncryptionScopeResource(Client, response), response.GetRawResponse()), rehydrationToken); + 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 uri = _encryptionScopeRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new CognitiveServicesArmOperation(Response.FromValue(new EncryptionScopeResource(Client, response), response.GetRawResponse()), rehydrationToken); + 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 6778ed3f6bd7..6562c5fa72b5 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/CognitiveServicesExtensions.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/CognitiveServicesExtensions.cs @@ -166,6 +166,139 @@ 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 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 RaiContentFilterResource GetRaiContentFilterResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableCognitiveServicesArmClient(client).GetRaiContentFilterResource(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 NetworkSecurityPerimeterConfigurationResource GetNetworkSecurityPerimeterConfigurationResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableCognitiveServicesArmClient(client).GetNetworkSecurityPerimeterConfigurationResource(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 DefenderForAISettingResource GetDefenderForAISettingResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableCognitiveServicesArmClient(client).GetDefenderForAISettingResource(id); + } + /// /// Gets a collection of CognitiveServicesAccountResources in the ResourceGroupResource. /// @@ -196,7 +329,7 @@ public static CognitiveServicesAccountCollection GetCognitiveServicesAccounts(th /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -234,7 +367,7 @@ public static async Task> GetCognitiv /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -289,7 +422,7 @@ public static CognitiveServicesCommitmentPlanCollection GetCognitiveServicesComm /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -327,7 +460,7 @@ public static async Task> GetC /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -382,7 +515,7 @@ public static CognitiveServicesDeletedAccountCollection GetCognitiveServicesDele /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -422,7 +555,7 @@ public static async Task> GetC /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -449,6 +582,102 @@ public static Response GetCognitiveServ return GetMockableCognitiveServicesSubscriptionResource(subscriptionResource).GetCognitiveServicesDeletedAccount(location, resourceGroupName, accountName, cancellationToken); } + /// + /// Gets a collection of RaiContentFilterResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Resource location. + /// is null. + /// An object representing collection of RaiContentFilterResources and their operations over a RaiContentFilterResource. + public static RaiContentFilterCollection GetRaiContentFilters(this SubscriptionResource subscriptionResource, AzureLocation location) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableCognitiveServicesSubscriptionResource(subscriptionResource).GetRaiContentFilters(location); + } + + /// + /// Get Content Filters by Name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/raiContentFilters/{filterName} + /// + /// + /// Operation Id + /// RaiContentFilters_Get + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Resource location. + /// The name of the RAI Content Filter. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetRaiContentFilterAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string filterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return await GetMockableCognitiveServicesSubscriptionResource(subscriptionResource).GetRaiContentFilterAsync(location, filterName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get Content Filters by Name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/raiContentFilters/{filterName} + /// + /// + /// Operation Id + /// RaiContentFilters_Get + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Resource location. + /// The name of the RAI Content Filter. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetRaiContentFilter(this SubscriptionResource subscriptionResource, AzureLocation location, string filterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableCognitiveServicesSubscriptionResource(subscriptionResource).GetRaiContentFilter(location, filterName, cancellationToken); + } + /// /// Returns all the resources of a particular type belonging to a subscription. /// @@ -462,7 +691,7 @@ public static Response GetCognitiveServ /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -498,7 +727,7 @@ public static AsyncPageable GetCognitiveServic /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -534,7 +763,7 @@ public static Pageable GetCognitiveServicesAcc /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -570,7 +799,7 @@ public static AsyncPageable GetDeletedA /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -606,7 +835,7 @@ public static Pageable GetDeletedAccoun /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// @@ -638,7 +867,7 @@ public static AsyncPageable GetResourceSkusAsync( /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// @@ -670,7 +899,7 @@ public static Pageable GetResourceSkus(this Subsc /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// @@ -704,7 +933,7 @@ public static AsyncPageable GetUsagesAsync(this Subscriptio /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// @@ -738,7 +967,7 @@ public static Pageable GetUsages(this SubscriptionResource /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// @@ -772,7 +1001,7 @@ public static AsyncPageable CheckSkuAvaila /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// @@ -806,7 +1035,7 @@ public static Pageable CheckSkuAvailabilit /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// @@ -838,7 +1067,7 @@ public static async Task> Chec /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// @@ -857,6 +1086,70 @@ public static Response CheckDomainAvail return GetMockableCognitiveServicesSubscriptionResource(subscriptionResource).CheckDomainAvailability(content, cancellationToken); } + /// + /// Model capacity calculator. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/calculateModelCapacity + /// + /// + /// Operation Id + /// CalculateModelCapacity + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Check Domain Availability parameter. + /// The cancellation token to use. + /// or is null. + public static async Task> CalculateModelCapacityAsync(this SubscriptionResource subscriptionResource, CalculateModelCapacityParameter calculateModelCapacityParameter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return await GetMockableCognitiveServicesSubscriptionResource(subscriptionResource).CalculateModelCapacityAsync(calculateModelCapacityParameter, cancellationToken).ConfigureAwait(false); + } + + /// + /// Model capacity calculator. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/calculateModelCapacity + /// + /// + /// Operation Id + /// CalculateModelCapacity + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Check Domain Availability parameter. + /// The cancellation token to use. + /// or is null. + public static Response CalculateModelCapacity(this SubscriptionResource subscriptionResource, CalculateModelCapacityParameter calculateModelCapacityParameter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableCognitiveServicesSubscriptionResource(subscriptionResource).CalculateModelCapacity(calculateModelCapacityParameter, cancellationToken); + } + /// /// List Commitment Tiers. /// @@ -870,7 +1163,7 @@ public static Response CheckDomainAvail /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// @@ -903,7 +1196,7 @@ public static AsyncPageable GetCommitmentTiersAsync(this Subscri /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// @@ -936,7 +1229,7 @@ public static Pageable GetCommitmentTiers(this SubscriptionResou /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// @@ -969,7 +1262,7 @@ public static AsyncPageable GetModelsAsync(this Subscrip /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// @@ -989,6 +1282,148 @@ public static Pageable GetModels(this SubscriptionResour return GetMockableCognitiveServicesSubscriptionResource(subscriptionResource).GetModels(location, cancellationToken); } + /// + /// List Location Based ModelCapacities. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/modelCapacities + /// + /// + /// Operation Id + /// LocationBasedModelCapacities_List + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Resource location. + /// The format of the Model. + /// The name of the Model. + /// The version of the Model. + /// The cancellation token to use. + /// , , or is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetLocationBasedModelCapacitiesAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string modelFormat, string modelName, string modelVersion, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableCognitiveServicesSubscriptionResource(subscriptionResource).GetLocationBasedModelCapacitiesAsync(location, modelFormat, modelName, modelVersion, cancellationToken); + } + + /// + /// List Location Based ModelCapacities. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/modelCapacities + /// + /// + /// Operation Id + /// LocationBasedModelCapacities_List + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Resource location. + /// The format of the Model. + /// The name of the Model. + /// The version of the Model. + /// The cancellation token to use. + /// , , or is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetLocationBasedModelCapacities(this SubscriptionResource subscriptionResource, AzureLocation location, string modelFormat, string modelName, string modelVersion, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableCognitiveServicesSubscriptionResource(subscriptionResource).GetLocationBasedModelCapacities(location, modelFormat, modelName, modelVersion, cancellationToken); + } + + /// + /// List ModelCapacities. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/modelCapacities + /// + /// + /// Operation Id + /// ModelCapacities_List + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The format of the Model. + /// The name of the Model. + /// The version of the Model. + /// The cancellation token to use. + /// , , or is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetModelCapacitiesAsync(this SubscriptionResource subscriptionResource, string modelFormat, string modelName, string modelVersion, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableCognitiveServicesSubscriptionResource(subscriptionResource).GetModelCapacitiesAsync(modelFormat, modelName, modelVersion, cancellationToken); + } + + /// + /// List ModelCapacities. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/modelCapacities + /// + /// + /// Operation Id + /// ModelCapacities_List + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The format of the Model. + /// The name of the Model. + /// The version of the Model. + /// The cancellation token to use. + /// , , or is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetModelCapacities(this SubscriptionResource subscriptionResource, string modelFormat, string modelName, string modelVersion, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableCognitiveServicesSubscriptionResource(subscriptionResource).GetModelCapacities(modelFormat, modelName, modelVersion, cancellationToken); + } + /// /// Returns all the resources of a particular type belonging to a subscription. /// @@ -1002,7 +1437,7 @@ public static Pageable GetModels(this SubscriptionResour /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -1038,7 +1473,7 @@ public static AsyncPageable GetCognitiv /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource 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 98960cf56995..746195803c79 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/MockableCognitiveServicesArmClient.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/MockableCognitiveServicesArmClient.cs @@ -117,5 +117,89 @@ 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); + } + + /// + /// 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 RaiContentFilterResource GetRaiContentFilterResource(ResourceIdentifier id) + { + RaiContentFilterResource.ValidateResourceId(id); + return new RaiContentFilterResource(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 NetworkSecurityPerimeterConfigurationResource GetNetworkSecurityPerimeterConfigurationResource(ResourceIdentifier id) + { + NetworkSecurityPerimeterConfigurationResource.ValidateResourceId(id); + return new NetworkSecurityPerimeterConfigurationResource(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 DefenderForAISettingResource GetDefenderForAISettingResource(ResourceIdentifier id) + { + DefenderForAISettingResource.ValidateResourceId(id); + return new DefenderForAISettingResource(Client, id); + } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/MockableCognitiveServicesResourceGroupResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/MockableCognitiveServicesResourceGroupResource.cs index 943dc56409a2..fb287040703f 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/MockableCognitiveServicesResourceGroupResource.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/MockableCognitiveServicesResourceGroupResource.cs @@ -53,7 +53,7 @@ public virtual CognitiveServicesAccountCollection GetCognitiveServicesAccounts() /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -84,7 +84,7 @@ public virtual async Task> GetCogniti /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -122,7 +122,7 @@ public virtual CognitiveServicesCommitmentPlanCollection GetCognitiveServicesCom /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -153,7 +153,7 @@ public virtual async Task> Get /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource 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 844a7e700b33..a208771e7989 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/MockableCognitiveServicesSubscriptionResource.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/MockableCognitiveServicesSubscriptionResource.cs @@ -32,6 +32,10 @@ public partial class MockableCognitiveServicesSubscriptionResource : ArmResource private CommitmentTiersRestOperations _commitmentTiersRestClient; private ClientDiagnostics _modelsClientDiagnostics; private ModelsRestOperations _modelsRestClient; + private ClientDiagnostics _locationBasedModelCapacitiesClientDiagnostics; + private LocationBasedModelCapacitiesRestOperations _locationBasedModelCapacitiesRestClient; + private ClientDiagnostics _modelCapacitiesClientDiagnostics; + private ModelCapacitiesRestOperations _modelCapacitiesRestClient; private ClientDiagnostics _cognitiveServicesCommitmentPlanCommitmentPlansClientDiagnostics; private CommitmentPlansRestOperations _cognitiveServicesCommitmentPlanCommitmentPlansRestClient; @@ -61,6 +65,10 @@ internal MockableCognitiveServicesSubscriptionResource(ArmClient client, Resourc private CommitmentTiersRestOperations CommitmentTiersRestClient => _commitmentTiersRestClient ??= new CommitmentTiersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); private ClientDiagnostics ModelsClientDiagnostics => _modelsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CognitiveServices", ProviderConstants.DefaultProviderNamespace, Diagnostics); private ModelsRestOperations ModelsRestClient => _modelsRestClient ??= new ModelsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics LocationBasedModelCapacitiesClientDiagnostics => _locationBasedModelCapacitiesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CognitiveServices", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private LocationBasedModelCapacitiesRestOperations LocationBasedModelCapacitiesRestClient => _locationBasedModelCapacitiesRestClient ??= new LocationBasedModelCapacitiesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ModelCapacitiesClientDiagnostics => _modelCapacitiesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.CognitiveServices", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ModelCapacitiesRestOperations ModelCapacitiesRestClient => _modelCapacitiesRestClient ??= new ModelCapacitiesRestOperations(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)); @@ -90,7 +98,7 @@ public virtual CognitiveServicesDeletedAccountCollection GetCognitiveServicesDel /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -123,7 +131,7 @@ public virtual async Task> Get /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -143,6 +151,78 @@ public virtual Response GetCognitiveSer return GetCognitiveServicesDeletedAccounts().Get(location, resourceGroupName, accountName, cancellationToken); } + /// Gets a collection of RaiContentFilterResources in the SubscriptionResource. + /// Resource location. + /// An object representing collection of RaiContentFilterResources and their operations over a RaiContentFilterResource. + public virtual RaiContentFilterCollection GetRaiContentFilters(AzureLocation location) + { + return new RaiContentFilterCollection(Client, Id, location); + } + + /// + /// Get Content Filters by Name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/raiContentFilters/{filterName} + /// + /// + /// Operation Id + /// RaiContentFilters_Get + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Resource location. + /// The name of the RAI Content Filter. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetRaiContentFilterAsync(AzureLocation location, string filterName, CancellationToken cancellationToken = default) + { + return await GetRaiContentFilters(location).GetAsync(filterName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get Content Filters by Name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/raiContentFilters/{filterName} + /// + /// + /// Operation Id + /// RaiContentFilters_Get + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Resource location. + /// The name of the RAI Content Filter. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetRaiContentFilter(AzureLocation location, string filterName, CancellationToken cancellationToken = default) + { + return GetRaiContentFilters(location).Get(filterName, cancellationToken); + } + /// /// Returns all the resources of a particular type belonging to a subscription. /// @@ -156,7 +236,7 @@ public virtual Response GetCognitiveSer /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -186,7 +266,7 @@ public virtual AsyncPageable GetCognitiveServi /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -216,7 +296,7 @@ public virtual Pageable GetCognitiveServicesAc /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -246,7 +326,7 @@ public virtual AsyncPageable GetDeleted /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -276,7 +356,7 @@ public virtual Pageable GetDeletedAccou /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// @@ -302,7 +382,7 @@ public virtual AsyncPageable GetResourceSkusAsync /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// @@ -328,7 +408,7 @@ public virtual Pageable GetResourceSkus(Cancellat /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// @@ -356,7 +436,7 @@ public virtual AsyncPageable GetUsagesAsync(AzureLocation l /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// @@ -384,7 +464,7 @@ public virtual Pageable GetUsages(AzureLocation location, s /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// @@ -414,7 +494,7 @@ public virtual AsyncPageable CheckSkuAvail /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// @@ -444,7 +524,7 @@ public virtual Pageable CheckSkuAvailabili /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// @@ -482,7 +562,7 @@ public virtual async Task> Che /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// @@ -507,6 +587,82 @@ public virtual Response CheckDomainAvai } } + /// + /// Model capacity calculator. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/calculateModelCapacity + /// + /// + /// Operation Id + /// CalculateModelCapacity + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// + /// Check Domain Availability parameter. + /// The cancellation token to use. + /// is null. + public virtual async Task> CalculateModelCapacityAsync(CalculateModelCapacityParameter calculateModelCapacityParameter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(calculateModelCapacityParameter, nameof(calculateModelCapacityParameter)); + + using var scope = DefaultClientDiagnostics.CreateScope("MockableCognitiveServicesSubscriptionResource.CalculateModelCapacity"); + scope.Start(); + try + { + var response = await DefaultRestClient.CalculateModelCapacityAsync(Id.SubscriptionId, calculateModelCapacityParameter, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Model capacity calculator. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/calculateModelCapacity + /// + /// + /// Operation Id + /// CalculateModelCapacity + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// + /// Check Domain Availability parameter. + /// The cancellation token to use. + /// is null. + public virtual Response CalculateModelCapacity(CalculateModelCapacityParameter calculateModelCapacityParameter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(calculateModelCapacityParameter, nameof(calculateModelCapacityParameter)); + + using var scope = DefaultClientDiagnostics.CreateScope("MockableCognitiveServicesSubscriptionResource.CalculateModelCapacity"); + scope.Start(); + try + { + var response = DefaultRestClient.CalculateModelCapacity(Id.SubscriptionId, calculateModelCapacityParameter, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// /// List Commitment Tiers. /// @@ -520,7 +676,7 @@ public virtual Response CheckDomainAvai /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// @@ -547,7 +703,7 @@ public virtual AsyncPageable GetCommitmentTiersAsync(AzureLocati /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// @@ -574,7 +730,7 @@ public virtual Pageable GetCommitmentTiers(AzureLocation locatio /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// @@ -601,7 +757,7 @@ public virtual AsyncPageable GetModelsAsync(AzureLocatio /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// @@ -615,6 +771,144 @@ public virtual Pageable GetModels(AzureLocation location return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => CognitiveServicesModel.DeserializeCognitiveServicesModel(e), ModelsClientDiagnostics, Pipeline, "MockableCognitiveServicesSubscriptionResource.GetModels", "value", "nextLink", cancellationToken); } + /// + /// List Location Based ModelCapacities. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/modelCapacities + /// + /// + /// Operation Id + /// LocationBasedModelCapacities_List + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// + /// Resource location. + /// The format of the Model. + /// The name of the Model. + /// The version of the Model. + /// The cancellation token to use. + /// , or is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetLocationBasedModelCapacitiesAsync(AzureLocation location, string modelFormat, string modelName, string modelVersion, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(modelFormat, nameof(modelFormat)); + Argument.AssertNotNull(modelName, nameof(modelName)); + Argument.AssertNotNull(modelVersion, nameof(modelVersion)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => LocationBasedModelCapacitiesRestClient.CreateListRequest(Id.SubscriptionId, location, modelFormat, modelName, modelVersion); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LocationBasedModelCapacitiesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location, modelFormat, modelName, modelVersion); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => ModelCapacityListResultValueItem.DeserializeModelCapacityListResultValueItem(e), LocationBasedModelCapacitiesClientDiagnostics, Pipeline, "MockableCognitiveServicesSubscriptionResource.GetLocationBasedModelCapacities", "value", "nextLink", cancellationToken); + } + + /// + /// List Location Based ModelCapacities. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/modelCapacities + /// + /// + /// Operation Id + /// LocationBasedModelCapacities_List + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// + /// Resource location. + /// The format of the Model. + /// The name of the Model. + /// The version of the Model. + /// The cancellation token to use. + /// , or is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetLocationBasedModelCapacities(AzureLocation location, string modelFormat, string modelName, string modelVersion, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(modelFormat, nameof(modelFormat)); + Argument.AssertNotNull(modelName, nameof(modelName)); + Argument.AssertNotNull(modelVersion, nameof(modelVersion)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => LocationBasedModelCapacitiesRestClient.CreateListRequest(Id.SubscriptionId, location, modelFormat, modelName, modelVersion); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => LocationBasedModelCapacitiesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location, modelFormat, modelName, modelVersion); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => ModelCapacityListResultValueItem.DeserializeModelCapacityListResultValueItem(e), LocationBasedModelCapacitiesClientDiagnostics, Pipeline, "MockableCognitiveServicesSubscriptionResource.GetLocationBasedModelCapacities", "value", "nextLink", cancellationToken); + } + + /// + /// List ModelCapacities. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/modelCapacities + /// + /// + /// Operation Id + /// ModelCapacities_List + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// + /// The format of the Model. + /// The name of the Model. + /// The version of the Model. + /// The cancellation token to use. + /// , or is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetModelCapacitiesAsync(string modelFormat, string modelName, string modelVersion, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(modelFormat, nameof(modelFormat)); + Argument.AssertNotNull(modelName, nameof(modelName)); + Argument.AssertNotNull(modelVersion, nameof(modelVersion)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => ModelCapacitiesRestClient.CreateListRequest(Id.SubscriptionId, modelFormat, modelName, modelVersion); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ModelCapacitiesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, modelFormat, modelName, modelVersion); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => ModelCapacityListResultValueItem.DeserializeModelCapacityListResultValueItem(e), ModelCapacitiesClientDiagnostics, Pipeline, "MockableCognitiveServicesSubscriptionResource.GetModelCapacities", "value", "nextLink", cancellationToken); + } + + /// + /// List ModelCapacities. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/modelCapacities + /// + /// + /// Operation Id + /// ModelCapacities_List + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// + /// The format of the Model. + /// The name of the Model. + /// The version of the Model. + /// The cancellation token to use. + /// , or is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetModelCapacities(string modelFormat, string modelName, string modelVersion, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(modelFormat, nameof(modelFormat)); + Argument.AssertNotNull(modelName, nameof(modelName)); + Argument.AssertNotNull(modelVersion, nameof(modelVersion)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => ModelCapacitiesRestClient.CreateListRequest(Id.SubscriptionId, modelFormat, modelName, modelVersion); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ModelCapacitiesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, modelFormat, modelName, modelVersion); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => ModelCapacityListResultValueItem.DeserializeModelCapacityListResultValueItem(e), ModelCapacitiesClientDiagnostics, Pipeline, "MockableCognitiveServicesSubscriptionResource.GetModelCapacities", "value", "nextLink", cancellationToken); + } + /// /// Returns all the resources of a particular type belonging to a subscription. /// @@ -628,7 +922,7 @@ public virtual Pageable GetModels(AzureLocation location /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource @@ -658,7 +952,7 @@ public virtual AsyncPageable GetCogniti /// /// /// Default Api Version - /// 2023-05-01 + /// 2024-10-01 /// /// /// Resource diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/LongRunningOperation/NetworkSecurityPerimeterConfigurationOperationSource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/LongRunningOperation/NetworkSecurityPerimeterConfigurationOperationSource.cs new file mode 100644 index 000000000000..9e25e097d3fa --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/LongRunningOperation/NetworkSecurityPerimeterConfigurationOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices +{ + internal class NetworkSecurityPerimeterConfigurationOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal NetworkSecurityPerimeterConfigurationOperationSource(ArmClient client) + { + _client = client; + } + + NetworkSecurityPerimeterConfigurationResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = NetworkSecurityPerimeterConfigurationData.DeserializeNetworkSecurityPerimeterConfigurationData(document.RootElement); + return new NetworkSecurityPerimeterConfigurationResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = NetworkSecurityPerimeterConfigurationData.DeserializeNetworkSecurityPerimeterConfigurationData(document.RootElement); + return new NetworkSecurityPerimeterConfigurationResource(_client, data); + } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/BillingMeterInfo.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/BillingMeterInfo.Serialization.cs new file mode 100644 index 000000000000..fa93beff0808 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/BillingMeterInfo.Serialization.cs @@ -0,0 +1,238 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + public partial class BillingMeterInfo : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BillingMeterInfo)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(MeterId)) + { + writer.WritePropertyName("meterId"u8); + writer.WriteStringValue(MeterId); + } + if (Optional.IsDefined(Unit)) + { + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + BillingMeterInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BillingMeterInfo)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBillingMeterInfo(document.RootElement, options); + } + + internal static BillingMeterInfo DeserializeBillingMeterInfo(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string meterId = default; + string unit = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("meterId"u8)) + { + meterId = property.Value.GetString(); + continue; + } + if (property.NameEquals("unit"u8)) + { + unit = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new BillingMeterInfo(name, meterId, unit, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MeterId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" meterId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(MeterId)) + { + builder.Append(" meterId: "); + if (MeterId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{MeterId}'''"); + } + else + { + builder.AppendLine($"'{MeterId}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Unit), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" unit: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Unit)) + { + builder.Append(" unit: "); + if (Unit.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Unit}'''"); + } + else + { + builder.AppendLine($"'{Unit}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(BillingMeterInfo)} does not support writing '{options.Format}' format."); + } + } + + BillingMeterInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeBillingMeterInfo(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BillingMeterInfo)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/BillingMeterInfo.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/BillingMeterInfo.cs new file mode 100644 index 000000000000..0f6ace2944e6 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/BillingMeterInfo.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// The BillingMeterInfo. + public partial class BillingMeterInfo + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public BillingMeterInfo() + { + } + + /// Initializes a new instance of . + /// + /// + /// + /// Keeps track of any properties unknown to the library. + internal BillingMeterInfo(string name, string meterId, string unit, IDictionary serializedAdditionalRawData) + { + Name = name; + MeterId = meterId; + Unit = unit; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Gets or sets the name. + [WirePath("name")] + public string Name { get; set; } + /// Gets or sets the meter id. + [WirePath("meterId")] + public string MeterId { get; set; } + /// Gets or sets the unit. + [WirePath("unit")] + public string Unit { get; set; } + } +} 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 000000000000..73d4f33e5416 --- /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 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 != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CalculateModelCapacityParameter.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CalculateModelCapacityParameter.Serialization.cs new file mode 100644 index 000000000000..c6a9db6ce2d4 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CalculateModelCapacityParameter.Serialization.cs @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + public partial class CalculateModelCapacityParameter : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CalculateModelCapacityParameter)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Model)) + { + writer.WritePropertyName("model"u8); + writer.WriteObjectValue(Model, options); + } + if (Optional.IsDefined(SkuName)) + { + writer.WritePropertyName("skuName"u8); + writer.WriteStringValue(SkuName); + } + if (Optional.IsCollectionDefined(Workloads)) + { + writer.WritePropertyName("workloads"u8); + writer.WriteStartArray(); + foreach (var item in Workloads) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CalculateModelCapacityParameter IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CalculateModelCapacityParameter)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCalculateModelCapacityParameter(document.RootElement, options); + } + + internal static CalculateModelCapacityParameter DeserializeCalculateModelCapacityParameter(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CognitiveServicesAccountDeploymentModel model = default; + string skuName = default; + IList workloads = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("model"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + model = CognitiveServicesAccountDeploymentModel.DeserializeCognitiveServicesAccountDeploymentModel(property.Value, options); + continue; + } + if (property.NameEquals("skuName"u8)) + { + skuName = property.Value.GetString(); + continue; + } + if (property.NameEquals("workloads"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ModelCapacityCalculatorWorkload.DeserializeModelCapacityCalculatorWorkload(item, options)); + } + workloads = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CalculateModelCapacityParameter(model, skuName, workloads ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CalculateModelCapacityParameter)} does not support writing '{options.Format}' format."); + } + } + + CalculateModelCapacityParameter IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCalculateModelCapacityParameter(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CalculateModelCapacityParameter)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CalculateModelCapacityParameter.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CalculateModelCapacityParameter.cs new file mode 100644 index 000000000000..5fa6193f071e --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CalculateModelCapacityParameter.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// Calculate Model Capacity parameter. + public partial class CalculateModelCapacityParameter + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public CalculateModelCapacityParameter() + { + Workloads = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Properties of Cognitive Services account deployment model. + /// The name of SKU. + /// List of Model Capacity Calculator Workload. + /// Keeps track of any properties unknown to the library. + internal CalculateModelCapacityParameter(CognitiveServicesAccountDeploymentModel model, string skuName, IList workloads, IDictionary serializedAdditionalRawData) + { + Model = model; + SkuName = skuName; + Workloads = workloads; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Properties of Cognitive Services account deployment model. + [WirePath("model")] + public CognitiveServicesAccountDeploymentModel Model { get; set; } + /// The name of SKU. + [WirePath("skuName")] + public string SkuName { get; set; } + /// List of Model Capacity Calculator Workload. + [WirePath("workloads")] + public IList Workloads { get; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CalculateModelCapacityResult.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CalculateModelCapacityResult.Serialization.cs new file mode 100644 index 000000000000..855fd61f189b --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CalculateModelCapacityResult.Serialization.cs @@ -0,0 +1,230 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + public partial class CalculateModelCapacityResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CalculateModelCapacityResult)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Model)) + { + writer.WritePropertyName("model"u8); + writer.WriteObjectValue(Model, options); + } + if (Optional.IsDefined(SkuName)) + { + writer.WritePropertyName("skuName"u8); + writer.WriteStringValue(SkuName); + } + if (Optional.IsDefined(EstimatedCapacity)) + { + writer.WritePropertyName("estimatedCapacity"u8); + writer.WriteObjectValue(EstimatedCapacity, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CalculateModelCapacityResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CalculateModelCapacityResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCalculateModelCapacityResult(document.RootElement, options); + } + + internal static CalculateModelCapacityResult DeserializeCalculateModelCapacityResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CognitiveServicesAccountDeploymentModel model = default; + string skuName = default; + CalculateModelCapacityResultEstimatedCapacity estimatedCapacity = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("model"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + model = CognitiveServicesAccountDeploymentModel.DeserializeCognitiveServicesAccountDeploymentModel(property.Value, options); + continue; + } + if (property.NameEquals("skuName"u8)) + { + skuName = property.Value.GetString(); + continue; + } + if (property.NameEquals("estimatedCapacity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + estimatedCapacity = CalculateModelCapacityResultEstimatedCapacity.DeserializeCalculateModelCapacityResultEstimatedCapacity(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CalculateModelCapacityResult(model, skuName, estimatedCapacity, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Model), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" model: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Model)) + { + builder.Append(" model: "); + BicepSerializationHelpers.AppendChildObject(builder, Model, options, 2, false, " model: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SkuName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" skuName: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SkuName)) + { + builder.Append(" skuName: "); + if (SkuName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{SkuName}'''"); + } + else + { + builder.AppendLine($"'{SkuName}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EstimatedCapacity), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" estimatedCapacity: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(EstimatedCapacity)) + { + builder.Append(" estimatedCapacity: "); + BicepSerializationHelpers.AppendChildObject(builder, EstimatedCapacity, options, 2, false, " estimatedCapacity: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(CalculateModelCapacityResult)} does not support writing '{options.Format}' format."); + } + } + + CalculateModelCapacityResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCalculateModelCapacityResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CalculateModelCapacityResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CalculateModelCapacityResult.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CalculateModelCapacityResult.cs new file mode 100644 index 000000000000..87fbf6e24a84 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CalculateModelCapacityResult.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// Calculate Model Capacity result. + public partial class CalculateModelCapacityResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal CalculateModelCapacityResult() + { + } + + /// Initializes a new instance of . + /// Properties of Cognitive Services account deployment model. + /// + /// Model Estimated Capacity. + /// Keeps track of any properties unknown to the library. + internal CalculateModelCapacityResult(CognitiveServicesAccountDeploymentModel model, string skuName, CalculateModelCapacityResultEstimatedCapacity estimatedCapacity, IDictionary serializedAdditionalRawData) + { + Model = model; + SkuName = skuName; + EstimatedCapacity = estimatedCapacity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Properties of Cognitive Services account deployment model. + [WirePath("model")] + public CognitiveServicesAccountDeploymentModel Model { get; } + /// Gets the sku name. + [WirePath("skuName")] + public string SkuName { get; } + /// Model Estimated Capacity. + [WirePath("estimatedCapacity")] + public CalculateModelCapacityResultEstimatedCapacity EstimatedCapacity { get; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CalculateModelCapacityResultEstimatedCapacity.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CalculateModelCapacityResultEstimatedCapacity.Serialization.cs new file mode 100644 index 000000000000..38063971fbfe --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CalculateModelCapacityResultEstimatedCapacity.Serialization.cs @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + public partial class CalculateModelCapacityResultEstimatedCapacity : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CalculateModelCapacityResultEstimatedCapacity)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value.Value); + } + if (Optional.IsDefined(DeployableValue)) + { + writer.WritePropertyName("deployableValue"u8); + writer.WriteNumberValue(DeployableValue.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CalculateModelCapacityResultEstimatedCapacity IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CalculateModelCapacityResultEstimatedCapacity)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCalculateModelCapacityResultEstimatedCapacity(document.RootElement, options); + } + + internal static CalculateModelCapacityResultEstimatedCapacity DeserializeCalculateModelCapacityResultEstimatedCapacity(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int? value = default; + int? deployableValue = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + value = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("deployableValue"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deployableValue = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CalculateModelCapacityResultEstimatedCapacity(value, deployableValue, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Value)) + { + builder.Append(" value: "); + builder.AppendLine($"{Value.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DeployableValue), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" deployableValue: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DeployableValue)) + { + builder.Append(" deployableValue: "); + builder.AppendLine($"{DeployableValue.Value}"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(CalculateModelCapacityResultEstimatedCapacity)} does not support writing '{options.Format}' format."); + } + } + + CalculateModelCapacityResultEstimatedCapacity IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCalculateModelCapacityResultEstimatedCapacity(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CalculateModelCapacityResultEstimatedCapacity)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CalculateModelCapacityResultEstimatedCapacity.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CalculateModelCapacityResultEstimatedCapacity.cs new file mode 100644 index 000000000000..d0cfe54c69c3 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CalculateModelCapacityResultEstimatedCapacity.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// Model Estimated Capacity. + public partial class CalculateModelCapacityResultEstimatedCapacity + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal CalculateModelCapacityResultEstimatedCapacity() + { + } + + /// Initializes a new instance of . + /// + /// + /// Keeps track of any properties unknown to the library. + internal CalculateModelCapacityResultEstimatedCapacity(int? value, int? deployableValue, IDictionary serializedAdditionalRawData) + { + Value = value; + DeployableValue = deployableValue; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Gets the value. + [WirePath("value")] + public int? Value { get; } + /// Gets the deployable value. + [WirePath("deployableValue")] + public int? DeployableValue { get; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentModel.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentModel.Serialization.cs index c1447fa3db9e..f07114d20b54 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentModel.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentModel.Serialization.cs @@ -35,6 +35,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(CognitiveServicesAccountDeploymentModel)} does not support writing '{format}' format."); } + if (Optional.IsDefined(Publisher)) + { + writer.WritePropertyName("publisher"u8); + writer.WriteStringValue(Publisher); + } if (Optional.IsDefined(Format)) { writer.WritePropertyName("format"u8); @@ -55,6 +60,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("source"u8); writer.WriteStringValue(Source); } + if (Optional.IsDefined(SourceAccount)) + { + writer.WritePropertyName("sourceAccount"u8); + writer.WriteStringValue(SourceAccount); + } if (options.Format != "W" && Optional.IsDefined(CallRateLimit)) { writer.WritePropertyName("callRateLimit"u8); @@ -97,15 +107,22 @@ internal static CognitiveServicesAccountDeploymentModel DeserializeCognitiveServ { return null; } + string publisher = default; string format = default; string name = default; string version = default; string source = default; + ResourceIdentifier sourceAccount = default; ServiceAccountCallRateLimit callRateLimit = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("publisher"u8)) + { + publisher = property.Value.GetString(); + continue; + } if (property.NameEquals("format"u8)) { format = property.Value.GetString(); @@ -126,6 +143,15 @@ internal static CognitiveServicesAccountDeploymentModel DeserializeCognitiveServ source = property.Value.GetString(); continue; } + if (property.NameEquals("sourceAccount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sourceAccount = new ResourceIdentifier(property.Value.GetString()); + continue; + } if (property.NameEquals("callRateLimit"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -142,10 +168,12 @@ internal static CognitiveServicesAccountDeploymentModel DeserializeCognitiveServ } serializedAdditionalRawData = rawDataDictionary; return new CognitiveServicesAccountDeploymentModel( + publisher, format, name, version, source, + sourceAccount, callRateLimit, serializedAdditionalRawData); } @@ -161,6 +189,29 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.AppendLine("{"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Publisher), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" publisher: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Publisher)) + { + builder.Append(" publisher: "); + if (Publisher.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Publisher}'''"); + } + else + { + builder.AppendLine($"'{Publisher}'"); + } + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Format), out propertyOverride); if (hasPropertyOverride) { @@ -253,6 +304,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SourceAccount), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" sourceAccount: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SourceAccount)) + { + builder.Append(" sourceAccount: "); + builder.AppendLine($"'{SourceAccount.ToString()}'"); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CallRateLimit), out propertyOverride); if (hasPropertyOverride) { diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentModel.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentModel.cs index fb48318e98a5..c58d01f76672 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentModel.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentModel.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using Azure.Core; namespace Azure.ResourceManager.CognitiveServices.Models { @@ -51,22 +52,29 @@ public CognitiveServicesAccountDeploymentModel() } /// Initializes a new instance of . + /// Deployment model publisher. /// Deployment model format. /// Deployment model name. /// Optional. Deployment model version. If version is not specified, a default version will be assigned. The default version is different for different models and might change when there is new version available for a model. Default version for a model could be found from list models API. /// Optional. Deployment model source ARM resource ID. + /// Optional. Source of the model, another Microsoft.CognitiveServices accounts ARM resource ID. /// The call rate limit Cognitive Services account. /// Keeps track of any properties unknown to the library. - internal CognitiveServicesAccountDeploymentModel(string format, string name, string version, string source, ServiceAccountCallRateLimit callRateLimit, IDictionary serializedAdditionalRawData) + internal CognitiveServicesAccountDeploymentModel(string publisher, string format, string name, string version, string source, ResourceIdentifier sourceAccount, ServiceAccountCallRateLimit callRateLimit, IDictionary serializedAdditionalRawData) { + Publisher = publisher; Format = format; Name = name; Version = version; Source = source; + SourceAccount = sourceAccount; CallRateLimit = callRateLimit; _serializedAdditionalRawData = serializedAdditionalRawData; } + /// Deployment model publisher. + [WirePath("publisher")] + public string Publisher { get; set; } /// Deployment model format. [WirePath("format")] public string Format { get; set; } @@ -79,6 +87,9 @@ internal CognitiveServicesAccountDeploymentModel(string format, string name, str /// Optional. Deployment model source ARM resource ID. [WirePath("source")] public string Source { get; set; } + /// Optional. Source of the model, another Microsoft.CognitiveServices accounts ARM resource ID. + [WirePath("sourceAccount")] + public ResourceIdentifier SourceAccount { get; set; } /// The call rate limit Cognitive Services account. [WirePath("callRateLimit")] public ServiceAccountCallRateLimit CallRateLimit { get; } 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 78c89649b89a..961acf00b6c9 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 @@ -87,6 +87,26 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("versionUpgradeOption"u8); writer.WriteStringValue(VersionUpgradeOption.Value.ToString()); } + if (options.Format != "W" && Optional.IsDefined(DynamicThrottlingEnabled)) + { + writer.WritePropertyName("dynamicThrottlingEnabled"u8); + writer.WriteBooleanValue(DynamicThrottlingEnabled.Value); + } + if (Optional.IsDefined(CurrentCapacity)) + { + writer.WritePropertyName("currentCapacity"u8); + writer.WriteNumberValue(CurrentCapacity.Value); + } + if (Optional.IsDefined(CapacitySettings)) + { + writer.WritePropertyName("capacitySettings"u8); + writer.WriteObjectValue(CapacitySettings, options); + } + if (Optional.IsDefined(ParentDeploymentName)) + { + writer.WritePropertyName("parentDeploymentName"u8); + writer.WriteStringValue(ParentDeploymentName); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -132,6 +152,10 @@ internal static CognitiveServicesAccountDeploymentProperties DeserializeCognitiv ServiceAccountCallRateLimit callRateLimit = default; IReadOnlyList rateLimits = default; DeploymentModelVersionUpgradeOption? versionUpgradeOption = default; + bool? dynamicThrottlingEnabled = default; + int? currentCapacity = default; + DeploymentCapacitySettings capacitySettings = default; + string parentDeploymentName = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -214,6 +238,38 @@ 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, options); + continue; + } + if (property.NameEquals("parentDeploymentName"u8)) + { + parentDeploymentName = property.Value.GetString(); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -229,6 +285,10 @@ internal static CognitiveServicesAccountDeploymentProperties DeserializeCognitiv callRateLimit, rateLimits ?? new ChangeTrackingList(), versionUpgradeOption, + dynamicThrottlingEnabled, + currentCapacity, + capacitySettings, + parentDeploymentName, serializedAdditionalRawData); } @@ -401,6 +461,75 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DynamicThrottlingEnabled), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" dynamicThrottlingEnabled: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DynamicThrottlingEnabled)) + { + builder.Append(" dynamicThrottlingEnabled: "); + var boolValue = DynamicThrottlingEnabled.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CurrentCapacity), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" currentCapacity: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(CurrentCapacity)) + { + builder.Append(" currentCapacity: "); + builder.AppendLine($"{CurrentCapacity.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CapacitySettings), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" capacitySettings: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(CapacitySettings)) + { + builder.Append(" capacitySettings: "); + BicepSerializationHelpers.AppendChildObject(builder, CapacitySettings, options, 2, false, " capacitySettings: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ParentDeploymentName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" parentDeploymentName: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ParentDeploymentName)) + { + builder.Append(" parentDeploymentName: "); + if (ParentDeploymentName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ParentDeploymentName}'''"); + } + else + { + builder.AppendLine($"'{ParentDeploymentName}'"); + } + } + } + builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } 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 3173288523e6..149abbf2916e 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentProperties.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentProperties.cs @@ -55,14 +55,18 @@ 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. + /// If the dynamic throttling is enabled. + /// The current capacity. + /// Internal use only. + /// The name of parent deployment. /// Keeps track of any properties unknown to the library. - internal CognitiveServicesAccountDeploymentProperties(CognitiveServicesAccountDeploymentProvisioningState? provisioningState, CognitiveServicesAccountDeploymentModel model, CognitiveServicesAccountDeploymentScaleSettings scaleSettings, IReadOnlyDictionary capabilities, string raiPolicyName, ServiceAccountCallRateLimit callRateLimit, IReadOnlyList rateLimits, DeploymentModelVersionUpgradeOption? versionUpgradeOption, IDictionary serializedAdditionalRawData) + internal CognitiveServicesAccountDeploymentProperties(CognitiveServicesAccountDeploymentProvisioningState? provisioningState, CognitiveServicesAccountDeploymentModel model, CognitiveServicesAccountDeploymentScaleSettings scaleSettings, IReadOnlyDictionary capabilities, string raiPolicyName, ServiceAccountCallRateLimit callRateLimit, IReadOnlyList rateLimits, DeploymentModelVersionUpgradeOption? versionUpgradeOption, bool? dynamicThrottlingEnabled, int? currentCapacity, DeploymentCapacitySettings capacitySettings, string parentDeploymentName, IDictionary serializedAdditionalRawData) { ProvisioningState = provisioningState; Model = model; @@ -72,6 +76,10 @@ internal CognitiveServicesAccountDeploymentProperties(CognitiveServicesAccountDe CallRateLimit = callRateLimit; RateLimits = rateLimits; VersionUpgradeOption = versionUpgradeOption; + DynamicThrottlingEnabled = dynamicThrottlingEnabled; + CurrentCapacity = currentCapacity; + CapacitySettings = capacitySettings; + ParentDeploymentName = parentDeploymentName; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -81,7 +89,7 @@ internal CognitiveServicesAccountDeploymentProperties(CognitiveServicesAccountDe /// Properties of Cognitive Services account deployment model. [WirePath("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.). [WirePath("scaleSettings")] public CognitiveServicesAccountDeploymentScaleSettings ScaleSettings { get; set; } /// The capabilities. @@ -99,5 +107,17 @@ internal CognitiveServicesAccountDeploymentProperties(CognitiveServicesAccountDe /// Deployment model version upgrade option. [WirePath("versionUpgradeOption")] public DeploymentModelVersionUpgradeOption? VersionUpgradeOption { get; set; } + /// If the dynamic throttling is enabled. + [WirePath("dynamicThrottlingEnabled")] + public bool? DynamicThrottlingEnabled { get; } + /// The current capacity. + [WirePath("currentCapacity")] + public int? CurrentCapacity { get; set; } + /// Internal use only. + [WirePath("capacitySettings")] + public DeploymentCapacitySettings CapacitySettings { get; set; } + /// The name of parent deployment. + [WirePath("parentDeploymentName")] + public string ParentDeploymentName { 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 025cd8a5f8fd..f7e5aa4475d8 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentScaleSettings.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountDeploymentScaleSettings.cs @@ -10,7 +10,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 { /// diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountModel.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountModel.Serialization.cs index 6cac298112c9..6d5575b720a9 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountModel.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountModel.Serialization.cs @@ -131,10 +131,12 @@ internal static CognitiveServicesAccountModel DeserializeCognitiveServicesAccoun ServiceAccountModelDeprecationInfo deprecation = default; ModelLifecycleStatus? lifecycleStatus = default; SystemData systemData = default; + string publisher = default; string format = default; string name = default; string version = default; string source = default; + ResourceIdentifier sourceAccount = default; ServiceAccountCallRateLimit callRateLimit = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -236,6 +238,11 @@ internal static CognitiveServicesAccountModel DeserializeCognitiveServicesAccoun systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } + if (property.NameEquals("publisher"u8)) + { + publisher = property.Value.GetString(); + continue; + } if (property.NameEquals("format"u8)) { format = property.Value.GetString(); @@ -256,6 +263,15 @@ internal static CognitiveServicesAccountModel DeserializeCognitiveServicesAccoun source = property.Value.GetString(); continue; } + if (property.NameEquals("sourceAccount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sourceAccount = new ResourceIdentifier(property.Value.GetString()); + continue; + } if (property.NameEquals("callRateLimit"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -272,10 +288,12 @@ internal static CognitiveServicesAccountModel DeserializeCognitiveServicesAccoun } serializedAdditionalRawData = rawDataDictionary; return new CognitiveServicesAccountModel( + publisher, format, name, version, source, + sourceAccount, callRateLimit, serializedAdditionalRawData, baseModel, @@ -488,6 +506,29 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Publisher), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" publisher: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Publisher)) + { + builder.Append(" publisher: "); + if (Publisher.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Publisher}'''"); + } + else + { + builder.AppendLine($"'{Publisher}'"); + } + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Format), out propertyOverride); if (hasPropertyOverride) { @@ -580,6 +621,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SourceAccount), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" sourceAccount: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SourceAccount)) + { + builder.Append(" sourceAccount: "); + builder.AppendLine($"'{SourceAccount.ToString()}'"); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CallRateLimit), out propertyOverride); if (hasPropertyOverride) { diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountModel.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountModel.cs index a63303154ac6..2fbcc1bcaf95 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountModel.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountModel.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using Azure.Core; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.CognitiveServices.Models @@ -23,13 +24,15 @@ public CognitiveServicesAccountModel() } /// Initializes a new instance of . + /// Deployment model publisher. /// Deployment model format. /// Deployment model name. /// Optional. Deployment model version. If version is not specified, a default version will be assigned. The default version is different for different models and might change when there is new version available for a model. Default version for a model could be found from list models API. /// Optional. Deployment model source ARM resource ID. + /// Optional. Source of the model, another Microsoft.CognitiveServices accounts ARM resource ID. /// The call rate limit Cognitive Services account. /// Keeps track of any properties unknown to the library. - /// Base Model Identifier. + /// Properties of Cognitive Services account deployment model. /// If the model is default version. /// The list of Model Sku. /// The max capacity. @@ -38,7 +41,7 @@ public CognitiveServicesAccountModel() /// Cognitive Services account ModelDeprecationInfo. /// Model lifecycle status. /// Metadata pertaining to creation and last modification of the resource. - internal CognitiveServicesAccountModel(string format, string name, string version, string source, ServiceAccountCallRateLimit callRateLimit, IDictionary serializedAdditionalRawData, CognitiveServicesAccountDeploymentModel baseModel, bool? isDefaultVersion, IList skus, int? maxCapacity, IDictionary capabilities, IDictionary finetuneCapabilities, ServiceAccountModelDeprecationInfo deprecation, ModelLifecycleStatus? lifecycleStatus, SystemData systemData) : base(format, name, version, source, callRateLimit, serializedAdditionalRawData) + internal CognitiveServicesAccountModel(string publisher, string format, string name, string version, string source, ResourceIdentifier sourceAccount, ServiceAccountCallRateLimit callRateLimit, IDictionary serializedAdditionalRawData, CognitiveServicesAccountDeploymentModel baseModel, bool? isDefaultVersion, IList skus, int? maxCapacity, IDictionary capabilities, IDictionary finetuneCapabilities, ServiceAccountModelDeprecationInfo deprecation, ModelLifecycleStatus? lifecycleStatus, SystemData systemData) : base(publisher, format, name, version, source, sourceAccount, callRateLimit, serializedAdditionalRawData) { BaseModel = baseModel; IsDefaultVersion = isDefaultVersion; @@ -51,7 +54,7 @@ internal CognitiveServicesAccountModel(string format, string name, string versio SystemData = systemData; } - /// Base Model Identifier. + /// Properties of Cognitive Services account deployment model. [WirePath("baseModel")] public CognitiveServicesAccountDeploymentModel BaseModel { get; set; } /// If the model is default version. 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 389306b9f7f1..58075eadb7f8 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 @@ -96,6 +96,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WriteEndArray(); } + if (Optional.IsDefined(AmlWorkspace)) + { + writer.WritePropertyName("amlWorkspace"u8); + writer.WriteObjectValue(AmlWorkspace, options); + } if (options.Format != "W" && Optional.IsCollectionDefined(PrivateEndpointConnections)) { writer.WritePropertyName("privateEndpointConnections"u8); @@ -202,6 +207,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("abusePenalty"u8); writer.WriteObjectValue(AbusePenalty, options); } + if (Optional.IsDefined(RaiMonitorConfig)) + { + writer.WritePropertyName("raiMonitorConfig"u8); + writer.WriteObjectValue(RaiMonitorConfig, options); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -249,6 +259,7 @@ internal static CognitiveServicesAccountProperties DeserializeCognitiveServicesA CognitiveServicesNetworkRuleSet networkAcls = default; ServiceAccountEncryptionProperties encryption = default; IList userOwnedStorage = default; + UserOwnedAmlWorkspace amlWorkspace = default; IReadOnlyList privateEndpointConnections = default; ServiceAccountPublicNetworkAccess? publicNetworkAccess = default; ServiceAccountApiProperties apiProperties = default; @@ -266,6 +277,7 @@ internal static CognitiveServicesAccountProperties DeserializeCognitiveServicesA CognitiveServicesMultiRegionSettings locations = default; IReadOnlyList commitmentPlanAssociations = default; AbusePenalty abusePenalty = default; + RaiMonitorConfig raiMonitorConfig = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -358,6 +370,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, options); + continue; + } if (property.NameEquals("privateEndpointConnections"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -527,6 +548,15 @@ internal static CognitiveServicesAccountProperties DeserializeCognitiveServicesA abusePenalty = AbusePenalty.DeserializeAbusePenalty(property.Value, options); continue; } + if (property.NameEquals("raiMonitorConfig"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + raiMonitorConfig = RaiMonitorConfig.DeserializeRaiMonitorConfig(property.Value, options); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -544,6 +574,7 @@ internal static CognitiveServicesAccountProperties DeserializeCognitiveServicesA networkAcls, encryption, userOwnedStorage ?? new ChangeTrackingList(), + amlWorkspace, privateEndpointConnections ?? new ChangeTrackingList(), publicNetworkAccess, apiProperties, @@ -561,6 +592,7 @@ internal static CognitiveServicesAccountProperties DeserializeCognitiveServicesA locations, commitmentPlanAssociations ?? new ChangeTrackingList(), abusePenalty, + raiMonitorConfig, serializedAdditionalRawData); } @@ -766,6 +798,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AmlWorkspace), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" amlWorkspace: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AmlWorkspace)) + { + builder.Append(" amlWorkspace: "); + BicepSerializationHelpers.AppendChildObject(builder, AmlWorkspace, options, 2, false, " amlWorkspace: "); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PrivateEndpointConnections), out propertyOverride); if (hasPropertyOverride) { @@ -1094,6 +1141,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RaiMonitorConfig), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" raiMonitorConfig: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RaiMonitorConfig)) + { + builder.Append(" raiMonitorConfig: "); + BicepSerializationHelpers.AppendChildObject(builder, RaiMonitorConfig, options, 2, false, " raiMonitorConfig: "); + } + } + builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } 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 cddb00bf4cbc..0ad2112d5bfa 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountProperties.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesAccountProperties.cs @@ -67,6 +67,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. @@ -84,8 +85,9 @@ public CognitiveServicesAccountProperties() /// The multiregion settings of Cognitive Services account. /// The commitment plan associations of Cognitive Services account. /// The abuse penalty. + /// Cognitive Services Rai Monitor Config. /// Keeps track of any properties unknown to the library. - 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, IDictionary serializedAdditionalRawData) + 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, RaiMonitorConfig raiMonitorConfig, IDictionary serializedAdditionalRawData) { ProvisioningState = provisioningState; Endpoint = endpoint; @@ -97,6 +99,7 @@ internal CognitiveServicesAccountProperties(ServiceAccountProvisioningState? pro NetworkAcls = networkAcls; Encryption = encryption; UserOwnedStorage = userOwnedStorage; + AmlWorkspace = amlWorkspace; PrivateEndpointConnections = privateEndpointConnections; PublicNetworkAccess = publicNetworkAccess; ApiProperties = apiProperties; @@ -114,6 +117,7 @@ internal CognitiveServicesAccountProperties(ServiceAccountProvisioningState? pro Locations = locations; CommitmentPlanAssociations = commitmentPlanAssociations; AbusePenalty = abusePenalty; + RaiMonitorConfig = raiMonitorConfig; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -147,6 +151,9 @@ internal CognitiveServicesAccountProperties(ServiceAccountProvisioningState? pro /// The storage accounts for this resource. [WirePath("userOwnedStorage")] public IList UserOwnedStorage { get; } + /// The user owned AML workspace properties. + [WirePath("amlWorkspace")] + public UserOwnedAmlWorkspace AmlWorkspace { get; set; } /// The private endpoint connection associated with the Cognitive Services account. [WirePath("privateEndpointConnections")] public IReadOnlyList PrivateEndpointConnections { get; } @@ -198,5 +205,8 @@ internal CognitiveServicesAccountProperties(ServiceAccountProvisioningState? pro /// The abuse penalty. [WirePath("abusePenalty")] public AbusePenalty AbusePenalty { get; } + /// Cognitive Services Rai Monitor Config. + [WirePath("raiMonitorConfig")] + public RaiMonitorConfig RaiMonitorConfig { get; set; } } } 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 76ddc4c31a95..34d867133dfb 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 @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Linq; using System.Text; using System.Text.Json; using Azure.Core; @@ -55,6 +56,16 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit 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(); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -96,6 +107,7 @@ internal static CognitiveServicesCapacityConfig DeserializeCognitiveServicesCapa int? maximum = default; int? step = default; int? @default = default; + IList allowedValues = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -136,13 +148,33 @@ 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; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new CognitiveServicesCapacityConfig(minimum, maximum, step, @default, serializedAdditionalRawData); + return new CognitiveServicesCapacityConfig( + minimum, + maximum, + step, + @default, + allowedValues ?? new ChangeTrackingList(), + serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -216,6 +248,29 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AllowedValues), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" allowedValues: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(AllowedValues)) + { + if (AllowedValues.Any()) + { + builder.Append(" allowedValues: "); + builder.AppendLine("["); + foreach (var item in AllowedValues) + { + builder.AppendLine($" {item}"); + } + builder.AppendLine(" ]"); + } + } + } + builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } 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 3de946bc5d35..2a862822465e 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesCapacityConfig.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesCapacityConfig.cs @@ -48,6 +48,7 @@ public partial class CognitiveServicesCapacityConfig /// Initializes a new instance of . public CognitiveServicesCapacityConfig() { + AllowedValues = new ChangeTrackingList(); } /// Initializes a new instance of . @@ -55,13 +56,15 @@ public CognitiveServicesCapacityConfig() /// The maximum capacity. /// The minimal incremental between allowed values for capacity. /// The default capacity. + /// The array of allowed values for capacity. /// Keeps track of any properties unknown to the library. - internal CognitiveServicesCapacityConfig(int? minimum, int? maximum, int? step, int? @default, IDictionary serializedAdditionalRawData) + internal CognitiveServicesCapacityConfig(int? minimum, int? maximum, int? step, int? @default, IList allowedValues, IDictionary serializedAdditionalRawData) { Minimum = minimum; Maximum = maximum; Step = step; Default = @default; + AllowedValues = allowedValues; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -77,5 +80,8 @@ internal CognitiveServicesCapacityConfig(int? minimum, int? maximum, int? step, /// The default capacity. [WirePath("default")] public int? Default { get; set; } + /// The array of allowed values for capacity. + [WirePath("allowedValues")] + public IList AllowedValues { get; } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesModel.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesModel.Serialization.cs index 294bf04bb533..66e1f80f61cb 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesModel.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesModel.Serialization.cs @@ -50,6 +50,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("skuName"u8); writer.WriteStringValue(SkuName); } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -90,6 +95,7 @@ internal static CognitiveServicesModel DeserializeCognitiveServicesModel(JsonEle CognitiveServicesAccountModel model = default; string kind = default; string skuName = default; + string description = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -113,13 +119,18 @@ internal static CognitiveServicesModel DeserializeCognitiveServicesModel(JsonEle skuName = property.Value.GetString(); continue; } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new CognitiveServicesModel(model, kind, skuName, serializedAdditionalRawData); + return new CognitiveServicesModel(model, kind, skuName, description, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -194,6 +205,29 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Description), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" description: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Description)) + { + builder.Append(" description: "); + if (Description.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Description}'''"); + } + else + { + builder.AppendLine($"'{Description}'"); + } + } + } + builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesModel.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesModel.cs index ba6c1cca2881..db7950157345 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesModel.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesModel.cs @@ -51,26 +51,31 @@ internal CognitiveServicesModel() } /// Initializes a new instance of . - /// Model Metadata. - /// The Kind of the Model. - /// The SKU of the Model. + /// Cognitive Services account Model. + /// The kind (type) of cognitive service account. + /// The name of SKU. + /// The description of the model. /// Keeps track of any properties unknown to the library. - internal CognitiveServicesModel(CognitiveServicesAccountModel model, string kind, string skuName, IDictionary serializedAdditionalRawData) + internal CognitiveServicesModel(CognitiveServicesAccountModel model, string kind, string skuName, string description, IDictionary serializedAdditionalRawData) { Model = model; Kind = kind; SkuName = skuName; + Description = description; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Model Metadata. + /// Cognitive Services account Model. [WirePath("model")] public CognitiveServicesAccountModel Model { get; } - /// The Kind of the Model. + /// The kind (type) of cognitive service account. [WirePath("kind")] public string Kind { get; } - /// The SKU of the Model. + /// The name of SKU. [WirePath("skuName")] public string SkuName { get; } + /// The description of the model. + [WirePath("description")] + public string Description { get; } } } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesModelSku.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesModelSku.Serialization.cs index ffafaa182097..db1606fcad43 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesModelSku.Serialization.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesModelSku.Serialization.cs @@ -66,6 +66,16 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WriteEndArray(); } + if (Optional.IsCollectionDefined(Cost)) + { + writer.WritePropertyName("cost"u8); + writer.WriteStartArray(); + foreach (var item in Cost) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -108,6 +118,7 @@ internal static CognitiveServicesModelSku DeserializeCognitiveServicesModelSku(J DateTimeOffset? deprecationDate = default; CognitiveServicesCapacityConfig capacity = default; IReadOnlyList rateLimits = default; + IList cost = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -154,6 +165,20 @@ internal static CognitiveServicesModelSku DeserializeCognitiveServicesModelSku(J rateLimits = array; continue; } + if (property.NameEquals("cost"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(BillingMeterInfo.DeserializeBillingMeterInfo(item, options)); + } + cost = array; + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -166,6 +191,7 @@ internal static CognitiveServicesModelSku DeserializeCognitiveServicesModelSku(J deprecationDate, capacity, rateLimits ?? new ChangeTrackingList(), + cost ?? new ChangeTrackingList(), serializedAdditionalRawData); } @@ -280,6 +306,29 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Cost), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" cost: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Cost)) + { + if (Cost.Any()) + { + builder.Append(" cost: "); + builder.AppendLine("["); + foreach (var item in Cost) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " cost: "); + } + builder.AppendLine(" ]"); + } + } + } + builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesModelSku.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesModelSku.cs index 4e042a76ccd3..1bbf481ce2d3 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesModelSku.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesModelSku.cs @@ -49,6 +49,7 @@ public partial class CognitiveServicesModelSku public CognitiveServicesModelSku() { RateLimits = new ChangeTrackingList(); + Cost = new ChangeTrackingList(); } /// Initializes a new instance of . @@ -57,14 +58,16 @@ public CognitiveServicesModelSku() /// The datetime of deprecation of the model SKU. /// The capacity configuration. /// The list of rateLimit. + /// The list of billing meter info. /// Keeps track of any properties unknown to the library. - internal CognitiveServicesModelSku(string name, string usageName, DateTimeOffset? deprecationOn, CognitiveServicesCapacityConfig capacity, IReadOnlyList rateLimits, IDictionary serializedAdditionalRawData) + internal CognitiveServicesModelSku(string name, string usageName, DateTimeOffset? deprecationOn, CognitiveServicesCapacityConfig capacity, IReadOnlyList rateLimits, IList cost, IDictionary serializedAdditionalRawData) { Name = name; UsageName = usageName; DeprecationOn = deprecationOn; Capacity = capacity; RateLimits = rateLimits; + Cost = cost; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -83,5 +86,8 @@ internal CognitiveServicesModelSku(string name, string usageName, DateTimeOffset /// The list of rateLimit. [WirePath("rateLimits")] public IReadOnlyList RateLimits { get; } + /// The list of billing meter info. + [WirePath("cost")] + public IList Cost { 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 78def2f87df3..56ce10a7cf94 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 @@ -41,6 +41,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit 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); @@ -99,6 +104,7 @@ internal static CognitiveServicesNetworkRuleSet DeserializeCognitiveServicesNetw return null; } CognitiveServicesNetworkRuleAction? defaultAction = default; + ByPassSelection? bypass = default; IList ipRules = default; IList virtualNetworkRules = default; IDictionary serializedAdditionalRawData = default; @@ -114,6 +120,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) @@ -148,7 +163,7 @@ internal static CognitiveServicesNetworkRuleSet DeserializeCognitiveServicesNetw } } serializedAdditionalRawData = rawDataDictionary; - return new CognitiveServicesNetworkRuleSet(defaultAction, ipRules ?? new ChangeTrackingList(), virtualNetworkRules ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new CognitiveServicesNetworkRuleSet(defaultAction, bypass, ipRules ?? new ChangeTrackingList(), virtualNetworkRules ?? new ChangeTrackingList(), serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -177,6 +192,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Bypass), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" bypass: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Bypass)) + { + builder.Append(" bypass: "); + builder.AppendLine($"'{Bypass.Value.ToString()}'"); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IPRules), out propertyOverride); if (hasPropertyOverride) { 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 94c896ed3c86..945ad4d41777 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesNetworkRuleSet.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesNetworkRuleSet.cs @@ -54,12 +54,14 @@ 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. /// Keeps track of any properties unknown to the library. - internal CognitiveServicesNetworkRuleSet(CognitiveServicesNetworkRuleAction? defaultAction, IList ipRules, IList virtualNetworkRules, IDictionary serializedAdditionalRawData) + internal CognitiveServicesNetworkRuleSet(CognitiveServicesNetworkRuleAction? defaultAction, ByPassSelection? bypass, IList ipRules, IList virtualNetworkRules, IDictionary serializedAdditionalRawData) { DefaultAction = defaultAction; + Bypass = bypass; IPRules = ipRules; VirtualNetworkRules = virtualNetworkRules; _serializedAdditionalRawData = serializedAdditionalRawData; @@ -68,6 +70,9 @@ internal CognitiveServicesNetworkRuleSet(CognitiveServicesNetworkRuleAction? def /// The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. [WirePath("defaultAction")] public CognitiveServicesNetworkRuleAction? DefaultAction { get; set; } + /// Setting for trusted services. + [WirePath("bypass")] + public ByPassSelection? Bypass { get; set; } /// The list of IP address rules. [WirePath("ipRules")] public IList IPRules { get; } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuAvailabilityContent.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuAvailabilityContent.cs index 1ae6342b31ea..af227845ff1e 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuAvailabilityContent.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesSkuAvailabilityContent.cs @@ -49,7 +49,7 @@ public partial class CognitiveServicesSkuAvailabilityContent /// Initializes a new instance of . /// The SKU of the resource. - /// The Kind of the resource. + /// The kind (type) of cognitive service account. /// The Type of the resource. /// or is null. public CognitiveServicesSkuAvailabilityContent(IEnumerable skus, string kind, ResourceType resourceType) @@ -64,7 +64,7 @@ public CognitiveServicesSkuAvailabilityContent(IEnumerable skus, string /// Initializes a new instance of . /// The SKU of the resource. - /// The Kind of the resource. + /// The kind (type) of cognitive service account. /// The Type of the resource. /// Keeps track of any properties unknown to the library. internal CognitiveServicesSkuAvailabilityContent(IList skus, string kind, ResourceType resourceType, IDictionary serializedAdditionalRawData) @@ -83,7 +83,7 @@ internal CognitiveServicesSkuAvailabilityContent() /// The SKU of the resource. [WirePath("skus")] public IList Skus { get; } - /// The Kind of the resource. + /// The kind (type) of cognitive service account. [WirePath("kind")] public string Kind { get; } /// The Type of the resource. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ContentLevel.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ContentLevel.cs new file mode 100644 index 000000000000..bae484b2f5d8 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ContentLevel.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 ContentLevel : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ContentLevel(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 ContentLevel Low { get; } = new ContentLevel(LowValue); + /// Medium. + public static ContentLevel Medium { get; } = new ContentLevel(MediumValue); + /// High. + public static ContentLevel High { get; } = new ContentLevel(HighValue); + /// Determines if two values are the same. + public static bool operator ==(ContentLevel left, ContentLevel right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ContentLevel left, ContentLevel right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ContentLevel(string value) => new ContentLevel(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ContentLevel other && Equals(other); + /// + public bool Equals(ContentLevel other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CustomBlocklistConfig.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CustomBlocklistConfig.Serialization.cs new file mode 100644 index 000000000000..7277350fd84f --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CustomBlocklistConfig.Serialization.cs @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + public partial class CustomBlocklistConfig : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomBlocklistConfig)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Source)) + { + writer.WritePropertyName("source"u8); + writer.WriteStringValue(Source.Value.ToString()); + } + } + + CustomBlocklistConfig IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomBlocklistConfig)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomBlocklistConfig(document.RootElement, options); + } + + internal static CustomBlocklistConfig DeserializeCustomBlocklistConfig(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + RaiPolicyContentSource? source = default; + string blocklistName = default; + bool? blocking = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("source"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + source = new RaiPolicyContentSource(property.Value.GetString()); + continue; + } + 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; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomBlocklistConfig(blocklistName, blocking, serializedAdditionalRawData, source); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Source), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" source: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Source)) + { + builder.Append(" source: "); + builder.AppendLine($"'{Source.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(BlocklistName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" blocklistName: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(BlocklistName)) + { + builder.Append(" blocklistName: "); + if (BlocklistName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{BlocklistName}'''"); + } + else + { + builder.AppendLine($"'{BlocklistName}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Blocking), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" blocking: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Blocking)) + { + builder.Append(" blocking: "); + var boolValue = Blocking.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(CustomBlocklistConfig)} does not support writing '{options.Format}' format."); + } + } + + CustomBlocklistConfig IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomBlocklistConfig(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomBlocklistConfig)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CustomBlocklistConfig.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CustomBlocklistConfig.cs new file mode 100644 index 000000000000..4bc043cc513b --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CustomBlocklistConfig.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// Gets or sets the source to which filter applies. + public partial class CustomBlocklistConfig : RaiBlocklistConfig + { + /// Initializes a new instance of . + public CustomBlocklistConfig() + { + } + + /// Initializes a new instance of . + /// Name of ContentFilter. + /// If blocking would occur. + /// Keeps track of any properties unknown to the library. + /// Content source to apply the Content Filters. + internal CustomBlocklistConfig(string blocklistName, bool? blocking, IDictionary serializedAdditionalRawData, RaiPolicyContentSource? source) : base(blocklistName, blocking, serializedAdditionalRawData) + { + Source = source; + } + + /// Content source to apply the Content Filters. + [WirePath("source")] + public RaiPolicyContentSource? Source { get; set; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/DefenderForAISettingResult.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/DefenderForAISettingResult.Serialization.cs new file mode 100644 index 000000000000..75ae48a200c9 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/DefenderForAISettingResult.Serialization.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + internal partial class DefenderForAISettingResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DefenderForAISettingResult)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DefenderForAISettingResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DefenderForAISettingResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDefenderForAISettingResult(document.RootElement, options); + } + + internal static DefenderForAISettingResult DeserializeDefenderForAISettingResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string nextLink = default; + IReadOnlyList value = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + 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(DefenderForAISettingData.DeserializeDefenderForAISettingData(item, options)); + } + value = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DefenderForAISettingResult(nextLink, value ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(DefenderForAISettingResult)} does not support writing '{options.Format}' format."); + } + } + + DefenderForAISettingResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDefenderForAISettingResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DefenderForAISettingResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/DefenderForAISettingResult.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/DefenderForAISettingResult.cs new file mode 100644 index 000000000000..91e9e5cb0f60 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/DefenderForAISettingResult.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// The list of cognitive services Defender for AI Settings. + internal partial class DefenderForAISettingResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal DefenderForAISettingResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The link used to get the next page of Defender for AI Settings. + /// The list of Defender for AI Settings. + /// Keeps track of any properties unknown to the library. + internal DefenderForAISettingResult(string nextLink, IReadOnlyList value, IDictionary serializedAdditionalRawData) + { + NextLink = nextLink; + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The link used to get the next page of Defender for AI Settings. + public string NextLink { get; } + /// The list of Defender for AI Settings. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/DefenderForAISettingState.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/DefenderForAISettingState.cs new file mode 100644 index 000000000000..9f54324f1a83 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/DefenderForAISettingState.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 +{ + /// Defender for AI state on the AI resource. + public readonly partial struct DefenderForAISettingState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DefenderForAISettingState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DisabledValue = "Disabled"; + private const string EnabledValue = "Enabled"; + + /// Disabled. + public static DefenderForAISettingState Disabled { get; } = new DefenderForAISettingState(DisabledValue); + /// Enabled. + public static DefenderForAISettingState Enabled { get; } = new DefenderForAISettingState(EnabledValue); + /// Determines if two values are the same. + public static bool operator ==(DefenderForAISettingState left, DefenderForAISettingState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DefenderForAISettingState left, DefenderForAISettingState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DefenderForAISettingState(string value) => new DefenderForAISettingState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DefenderForAISettingState other && Equals(other); + /// + public bool Equals(DefenderForAISettingState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _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 000000000000..61176a762553 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/DeploymentCapacitySettings.Serialization.cs @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + public partial class DeploymentCapacitySettings : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DeploymentCapacitySettings)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(DesignatedCapacity)) + { + writer.WritePropertyName("designatedCapacity"u8); + writer.WriteNumberValue(DesignatedCapacity.Value); + } + if (Optional.IsDefined(Priority)) + { + writer.WritePropertyName("priority"u8); + writer.WriteNumberValue(Priority.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DeploymentCapacitySettings IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DeploymentCapacitySettings)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDeploymentCapacitySettings(document.RootElement, options); + } + + internal static DeploymentCapacitySettings DeserializeDeploymentCapacitySettings(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int? designatedCapacity = default; + int? priority = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + 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; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DeploymentCapacitySettings(designatedCapacity, priority, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DesignatedCapacity), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" designatedCapacity: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DesignatedCapacity)) + { + builder.Append(" designatedCapacity: "); + builder.AppendLine($"{DesignatedCapacity.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Priority), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" priority: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Priority)) + { + builder.Append(" priority: "); + builder.AppendLine($"{Priority.Value}"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(DeploymentCapacitySettings)} does not support writing '{options.Format}' format."); + } + } + + DeploymentCapacitySettings IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDeploymentCapacitySettings(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DeploymentCapacitySettings)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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 000000000000..641ee4e677f4 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/DeploymentCapacitySettings.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// Internal use only. + public partial class DeploymentCapacitySettings + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public DeploymentCapacitySettings() + { + } + + /// Initializes a new instance of . + /// The designated capacity. + /// The priority of this capacity setting. + /// Keeps track of any properties unknown to the library. + internal DeploymentCapacitySettings(int? designatedCapacity, int? priority, IDictionary serializedAdditionalRawData) + { + DesignatedCapacity = designatedCapacity; + Priority = priority; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The designated capacity. + [WirePath("designatedCapacity")] + public int? DesignatedCapacity { get; set; } + /// The priority of this capacity setting. + [WirePath("priority")] + 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 000000000000..2e44bf628bdf --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/DeploymentSkuListResult.Serialization.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + internal partial class DeploymentSkuListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DeploymentSkuListResult)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DeploymentSkuListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DeploymentSkuListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDeploymentSkuListResult(document.RootElement, options); + } + + internal static DeploymentSkuListResult DeserializeDeploymentSkuListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string nextLink = default; + IReadOnlyList value = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + 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, options)); + } + value = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DeploymentSkuListResult(nextLink, value ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(DeploymentSkuListResult)} does not support writing '{options.Format}' format."); + } + } + + DeploymentSkuListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDeploymentSkuListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DeploymentSkuListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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 000000000000..b16d8c588dfb --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/DeploymentSkuListResult.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// The list of cognitive services accounts operation response. + internal partial class DeploymentSkuListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// 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. + /// Keeps track of any properties unknown to the library. + internal DeploymentSkuListResult(string nextLink, IReadOnlyList value, IDictionary serializedAdditionalRawData) + { + NextLink = nextLink; + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// 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/EncryptionScopeListResult.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/EncryptionScopeListResult.Serialization.cs new file mode 100644 index 000000000000..5a99459809eb --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/EncryptionScopeListResult.Serialization.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + internal partial class EncryptionScopeListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EncryptionScopeListResult)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + EncryptionScopeListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EncryptionScopeListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEncryptionScopeListResult(document.RootElement, options); + } + + internal static EncryptionScopeListResult DeserializeEncryptionScopeListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string nextLink = default; + IReadOnlyList value = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + 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, options)); + } + value = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EncryptionScopeListResult(nextLink, value ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(EncryptionScopeListResult)} does not support writing '{options.Format}' format."); + } + } + + EncryptionScopeListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEncryptionScopeListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EncryptionScopeListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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 000000000000..eb6761716a08 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/EncryptionScopeListResult.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// The list of cognitive services EncryptionScopes. + internal partial class EncryptionScopeListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// 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. + /// Keeps track of any properties unknown to the library. + internal EncryptionScopeListResult(string nextLink, IReadOnlyList value, IDictionary serializedAdditionalRawData) + { + NextLink = nextLink; + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// 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 000000000000..56a8f0019da2 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/EncryptionScopeProperties.Serialization.cs @@ -0,0 +1,232 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + public partial class EncryptionScopeProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EncryptionScopeProperties)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Optional.IsDefined(State)) + { + writer.WritePropertyName("state"u8); + writer.WriteStringValue(State.Value.ToString()); + } + } + + EncryptionScopeProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EncryptionScopeProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEncryptionScopeProperties(document.RootElement, options); + } + + internal static EncryptionScopeProperties DeserializeEncryptionScopeProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + EncryptionScopeProvisioningState? provisioningState = default; + EncryptionScopeState? state = default; + CognitiveServicesKeyVaultProperties keyVaultProperties = default; + ServiceAccountEncryptionKeySource? keySource = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + 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, options); + continue; + } + if (property.NameEquals("keySource"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keySource = new ServiceAccountEncryptionKeySource(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EncryptionScopeProperties(keyVaultProperties, keySource, serializedAdditionalRawData, provisioningState, state); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" provisioningState: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ProvisioningState)) + { + builder.Append(" provisioningState: "); + builder.AppendLine($"'{ProvisioningState.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(State), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" state: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(State)) + { + builder.Append(" state: "); + builder.AppendLine($"'{State.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(KeyVaultProperties), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" keyVaultProperties: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(KeyVaultProperties)) + { + builder.Append(" keyVaultProperties: "); + BicepSerializationHelpers.AppendChildObject(builder, KeyVaultProperties, options, 2, false, " keyVaultProperties: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(KeySource), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" keySource: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(KeySource)) + { + builder.Append(" keySource: "); + builder.AppendLine($"'{KeySource.Value.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(EncryptionScopeProperties)} does not support writing '{options.Format}' format."); + } + } + + EncryptionScopeProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEncryptionScopeProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EncryptionScopeProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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 000000000000..e4755b8a68e6 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/EncryptionScopeProperties.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +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. + /// Keeps track of any properties unknown to the library. + /// Gets the status of the resource at the time the operation was called. + /// The encryptionScope state. + internal EncryptionScopeProperties(CognitiveServicesKeyVaultProperties keyVaultProperties, ServiceAccountEncryptionKeySource? keySource, IDictionary serializedAdditionalRawData, EncryptionScopeProvisioningState? provisioningState, EncryptionScopeState? state) : base(keyVaultProperties, keySource, serializedAdditionalRawData) + { + ProvisioningState = provisioningState; + State = state; + } + + /// Gets the status of the resource at the time the operation was called. + [WirePath("provisioningState")] + public EncryptionScopeProvisioningState? ProvisioningState { get; } + /// The encryptionScope state. + [WirePath("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 000000000000..af39c9dec800 --- /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 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 != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 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 000000000000..414784ac646d --- /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 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 != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ModelCapacityCalculatorWorkload.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ModelCapacityCalculatorWorkload.Serialization.cs new file mode 100644 index 000000000000..37d65afe4430 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ModelCapacityCalculatorWorkload.Serialization.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + public partial class ModelCapacityCalculatorWorkload : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ModelCapacityCalculatorWorkload)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(RequestPerMinute)) + { + writer.WritePropertyName("requestPerMinute"u8); + writer.WriteNumberValue(RequestPerMinute.Value); + } + if (Optional.IsDefined(RequestParameters)) + { + writer.WritePropertyName("requestParameters"u8); + writer.WriteObjectValue(RequestParameters, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ModelCapacityCalculatorWorkload IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ModelCapacityCalculatorWorkload)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeModelCapacityCalculatorWorkload(document.RootElement, options); + } + + internal static ModelCapacityCalculatorWorkload DeserializeModelCapacityCalculatorWorkload(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + long? requestPerMinute = default; + ModelCapacityCalculatorWorkloadRequestParam requestParameters = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("requestPerMinute"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + requestPerMinute = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("requestParameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + requestParameters = ModelCapacityCalculatorWorkloadRequestParam.DeserializeModelCapacityCalculatorWorkloadRequestParam(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ModelCapacityCalculatorWorkload(requestPerMinute, requestParameters, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ModelCapacityCalculatorWorkload)} does not support writing '{options.Format}' format."); + } + } + + ModelCapacityCalculatorWorkload IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeModelCapacityCalculatorWorkload(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ModelCapacityCalculatorWorkload)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ModelCapacityCalculatorWorkload.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ModelCapacityCalculatorWorkload.cs new file mode 100644 index 000000000000..045c23f917cb --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ModelCapacityCalculatorWorkload.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// Model Capacity Calculator Workload. + public partial class ModelCapacityCalculatorWorkload + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ModelCapacityCalculatorWorkload() + { + } + + /// Initializes a new instance of . + /// Request per minute. + /// Dictionary, Model Capacity Calculator Workload Parameters. + /// Keeps track of any properties unknown to the library. + internal ModelCapacityCalculatorWorkload(long? requestPerMinute, ModelCapacityCalculatorWorkloadRequestParam requestParameters, IDictionary serializedAdditionalRawData) + { + RequestPerMinute = requestPerMinute; + RequestParameters = requestParameters; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Request per minute. + [WirePath("requestPerMinute")] + public long? RequestPerMinute { get; set; } + /// Dictionary, Model Capacity Calculator Workload Parameters. + [WirePath("requestParameters")] + public ModelCapacityCalculatorWorkloadRequestParam RequestParameters { get; set; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ModelCapacityCalculatorWorkloadRequestParam.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ModelCapacityCalculatorWorkloadRequestParam.Serialization.cs new file mode 100644 index 000000000000..1126b2b2092e --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ModelCapacityCalculatorWorkloadRequestParam.Serialization.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + public partial class ModelCapacityCalculatorWorkloadRequestParam : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ModelCapacityCalculatorWorkloadRequestParam)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(AvgPromptTokens)) + { + writer.WritePropertyName("avgPromptTokens"u8); + writer.WriteNumberValue(AvgPromptTokens.Value); + } + if (Optional.IsDefined(AvgGeneratedTokens)) + { + writer.WritePropertyName("avgGeneratedTokens"u8); + writer.WriteNumberValue(AvgGeneratedTokens.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ModelCapacityCalculatorWorkloadRequestParam IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ModelCapacityCalculatorWorkloadRequestParam)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeModelCapacityCalculatorWorkloadRequestParam(document.RootElement, options); + } + + internal static ModelCapacityCalculatorWorkloadRequestParam DeserializeModelCapacityCalculatorWorkloadRequestParam(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + long? avgPromptTokens = default; + long? avgGeneratedTokens = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("avgPromptTokens"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + avgPromptTokens = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("avgGeneratedTokens"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + avgGeneratedTokens = property.Value.GetInt64(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ModelCapacityCalculatorWorkloadRequestParam(avgPromptTokens, avgGeneratedTokens, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ModelCapacityCalculatorWorkloadRequestParam)} does not support writing '{options.Format}' format."); + } + } + + ModelCapacityCalculatorWorkloadRequestParam IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeModelCapacityCalculatorWorkloadRequestParam(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ModelCapacityCalculatorWorkloadRequestParam)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ModelCapacityCalculatorWorkloadRequestParam.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ModelCapacityCalculatorWorkloadRequestParam.cs new file mode 100644 index 000000000000..6757e99805b6 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ModelCapacityCalculatorWorkloadRequestParam.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// Dictionary, Model Capacity Calculator Workload Parameters. + public partial class ModelCapacityCalculatorWorkloadRequestParam + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ModelCapacityCalculatorWorkloadRequestParam() + { + } + + /// Initializes a new instance of . + /// Average prompt tokens. + /// Average generated tokens. + /// Keeps track of any properties unknown to the library. + internal ModelCapacityCalculatorWorkloadRequestParam(long? avgPromptTokens, long? avgGeneratedTokens, IDictionary serializedAdditionalRawData) + { + AvgPromptTokens = avgPromptTokens; + AvgGeneratedTokens = avgGeneratedTokens; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Average prompt tokens. + [WirePath("avgPromptTokens")] + public long? AvgPromptTokens { get; set; } + /// Average generated tokens. + [WirePath("avgGeneratedTokens")] + public long? AvgGeneratedTokens { get; set; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ModelCapacityListResult.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ModelCapacityListResult.Serialization.cs new file mode 100644 index 000000000000..5edab9a4228c --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ModelCapacityListResult.Serialization.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + internal partial class ModelCapacityListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ModelCapacityListResult)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ModelCapacityListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ModelCapacityListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeModelCapacityListResult(document.RootElement, options); + } + + internal static ModelCapacityListResult DeserializeModelCapacityListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string nextLink = default; + IReadOnlyList value = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + 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(ModelCapacityListResultValueItem.DeserializeModelCapacityListResultValueItem(item, options)); + } + value = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ModelCapacityListResult(nextLink, value ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ModelCapacityListResult)} does not support writing '{options.Format}' format."); + } + } + + ModelCapacityListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeModelCapacityListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ModelCapacityListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ModelCapacityListResult.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ModelCapacityListResult.cs new file mode 100644 index 000000000000..4f10d55dfefd --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ModelCapacityListResult.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// The list of cognitive services accounts operation response. + internal partial class ModelCapacityListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal ModelCapacityListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The link used to get the next page of ModelSkuCapacity. + /// Gets the list of Cognitive Services accounts ModelSkuCapacity. + /// Keeps track of any properties unknown to the library. + internal ModelCapacityListResult(string nextLink, IReadOnlyList value, IDictionary serializedAdditionalRawData) + { + NextLink = nextLink; + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The link used to get the next page of ModelSkuCapacity. + public string NextLink { get; } + /// Gets the list of Cognitive Services accounts ModelSkuCapacity. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ModelCapacityListResultValueItem.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ModelCapacityListResultValueItem.Serialization.cs new file mode 100644 index 000000000000..468a4d08ef67 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ModelCapacityListResultValueItem.Serialization.cs @@ -0,0 +1,271 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + public partial class ModelCapacityListResultValueItem : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ModelCapacityListResultValueItem)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location.Value); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + ModelCapacityListResultValueItem IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ModelCapacityListResultValueItem)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeModelCapacityListResultValueItem(document.RootElement, options); + } + + internal static ModelCapacityListResultValueItem DeserializeModelCapacityListResultValueItem(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AzureLocation? location = default; + ModelSkuCapacityProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("location"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ModelSkuCapacityProperties.DeserializeModelSkuCapacityProperties(property.Value, options); + 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; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ModelCapacityListResultValueItem( + id, + name, + type, + systemData, + location, + properties, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Location), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" location: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Location)) + { + builder.Append(" location: "); + builder.AppendLine($"'{Location.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" properties: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Properties)) + { + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ModelCapacityListResultValueItem)} does not support writing '{options.Format}' format."); + } + } + + ModelCapacityListResultValueItem IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeModelCapacityListResultValueItem(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ModelCapacityListResultValueItem)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ModelCapacityListResultValueItem.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ModelCapacityListResultValueItem.cs new file mode 100644 index 000000000000..7de926ef6159 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ModelCapacityListResultValueItem.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// The ModelCapacityListResultValueItem. + public partial class ModelCapacityListResultValueItem : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ModelCapacityListResultValueItem() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The location of the Model Sku Capacity. + /// Cognitive Services account ModelSkuCapacity. + /// Keeps track of any properties unknown to the library. + internal ModelCapacityListResultValueItem(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, ModelSkuCapacityProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Location = location; + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The location of the Model Sku Capacity. + [WirePath("location")] + public AzureLocation? Location { get; set; } + /// Cognitive Services account ModelSkuCapacity. + [WirePath("properties")] + public ModelSkuCapacityProperties Properties { get; set; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ModelLifecycleStatus.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ModelLifecycleStatus.cs index 356e925d84d9..51a6b072d7a8 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ModelLifecycleStatus.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ModelLifecycleStatus.cs @@ -22,13 +22,22 @@ public ModelLifecycleStatus(string value) _value = value ?? throw new ArgumentNullException(nameof(value)); } - private const string GenerallyAvailableValue = "GenerallyAvailable"; + private const string StableValue = "Stable"; private const string PreviewValue = "Preview"; + private const string GenerallyAvailableValue = "GenerallyAvailable"; + private const string DeprecatingValue = "Deprecating"; + private const string DeprecatedValue = "Deprecated"; - /// GenerallyAvailable. - public static ModelLifecycleStatus GenerallyAvailable { get; } = new ModelLifecycleStatus(GenerallyAvailableValue); + /// Stable. + public static ModelLifecycleStatus Stable { get; } = new ModelLifecycleStatus(StableValue); /// Preview. public static ModelLifecycleStatus Preview { get; } = new ModelLifecycleStatus(PreviewValue); + /// GenerallyAvailable. + public static ModelLifecycleStatus GenerallyAvailable { get; } = new ModelLifecycleStatus(GenerallyAvailableValue); + /// Deprecating. + public static ModelLifecycleStatus Deprecating { get; } = new ModelLifecycleStatus(DeprecatingValue); + /// Deprecated. + public static ModelLifecycleStatus Deprecated { get; } = new ModelLifecycleStatus(DeprecatedValue); /// Determines if two values are the same. public static bool operator ==(ModelLifecycleStatus left, ModelLifecycleStatus right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ModelSkuCapacityProperties.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ModelSkuCapacityProperties.Serialization.cs new file mode 100644 index 000000000000..339886551f39 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ModelSkuCapacityProperties.Serialization.cs @@ -0,0 +1,260 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + public partial class ModelSkuCapacityProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ModelSkuCapacityProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Model)) + { + writer.WritePropertyName("model"u8); + writer.WriteObjectValue(Model, options); + } + if (Optional.IsDefined(SkuName)) + { + writer.WritePropertyName("skuName"u8); + writer.WriteStringValue(SkuName); + } + if (Optional.IsDefined(AvailableCapacity)) + { + writer.WritePropertyName("availableCapacity"u8); + writer.WriteNumberValue(AvailableCapacity.Value); + } + if (Optional.IsDefined(AvailableFinetuneCapacity)) + { + writer.WritePropertyName("availableFinetuneCapacity"u8); + writer.WriteNumberValue(AvailableFinetuneCapacity.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ModelSkuCapacityProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ModelSkuCapacityProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeModelSkuCapacityProperties(document.RootElement, options); + } + + internal static ModelSkuCapacityProperties DeserializeModelSkuCapacityProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CognitiveServicesAccountDeploymentModel model = default; + string skuName = default; + float? availableCapacity = default; + float? availableFinetuneCapacity = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("model"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + model = CognitiveServicesAccountDeploymentModel.DeserializeCognitiveServicesAccountDeploymentModel(property.Value, options); + continue; + } + if (property.NameEquals("skuName"u8)) + { + skuName = property.Value.GetString(); + continue; + } + if (property.NameEquals("availableCapacity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + availableCapacity = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("availableFinetuneCapacity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + availableFinetuneCapacity = property.Value.GetSingle(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ModelSkuCapacityProperties(model, skuName, availableCapacity, availableFinetuneCapacity, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Model), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" model: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Model)) + { + builder.Append(" model: "); + BicepSerializationHelpers.AppendChildObject(builder, Model, options, 2, false, " model: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SkuName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" skuName: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SkuName)) + { + builder.Append(" skuName: "); + if (SkuName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{SkuName}'''"); + } + else + { + builder.AppendLine($"'{SkuName}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AvailableCapacity), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" availableCapacity: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AvailableCapacity)) + { + builder.Append(" availableCapacity: "); + builder.AppendLine($"'{AvailableCapacity.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AvailableFinetuneCapacity), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" availableFinetuneCapacity: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AvailableFinetuneCapacity)) + { + builder.Append(" availableFinetuneCapacity: "); + builder.AppendLine($"'{AvailableFinetuneCapacity.Value.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ModelSkuCapacityProperties)} does not support writing '{options.Format}' format."); + } + } + + ModelSkuCapacityProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeModelSkuCapacityProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ModelSkuCapacityProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ModelSkuCapacityProperties.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ModelSkuCapacityProperties.cs new file mode 100644 index 000000000000..967f3ae750af --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ModelSkuCapacityProperties.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// Cognitive Services account ModelSkuCapacity. + public partial class ModelSkuCapacityProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ModelSkuCapacityProperties() + { + } + + /// Initializes a new instance of . + /// Properties of Cognitive Services account deployment model. + /// + /// The available capacity for deployment with this model and sku. + /// The available capacity for deployment with a fine-tune version of this model and sku. + /// Keeps track of any properties unknown to the library. + internal ModelSkuCapacityProperties(CognitiveServicesAccountDeploymentModel model, string skuName, float? availableCapacity, float? availableFinetuneCapacity, IDictionary serializedAdditionalRawData) + { + Model = model; + SkuName = skuName; + AvailableCapacity = availableCapacity; + AvailableFinetuneCapacity = availableFinetuneCapacity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Properties of Cognitive Services account deployment model. + [WirePath("model")] + public CognitiveServicesAccountDeploymentModel Model { get; set; } + /// Gets or sets the sku name. + [WirePath("skuName")] + public string SkuName { get; set; } + /// The available capacity for deployment with this model and sku. + [WirePath("availableCapacity")] + public float? AvailableCapacity { get; set; } + /// The available capacity for deployment with a fine-tune version of this model and sku. + [WirePath("availableFinetuneCapacity")] + public float? AvailableFinetuneCapacity { get; set; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeter.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeter.Serialization.cs new file mode 100644 index 000000000000..739330c7adc5 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeter.Serialization.cs @@ -0,0 +1,230 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + public partial class NetworkSecurityPerimeter : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NetworkSecurityPerimeter)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (Optional.IsDefined(PerimeterGuid)) + { + writer.WritePropertyName("perimeterGuid"u8); + writer.WriteStringValue(PerimeterGuid); + } + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + NetworkSecurityPerimeter IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NetworkSecurityPerimeter)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNetworkSecurityPerimeter(document.RootElement, options); + } + + internal static NetworkSecurityPerimeter DeserializeNetworkSecurityPerimeter(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string perimeterGuid = default; + AzureLocation? location = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("perimeterGuid"u8)) + { + perimeterGuid = property.Value.GetString(); + continue; + } + if (property.NameEquals("location"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new NetworkSecurityPerimeter(id, perimeterGuid, location, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PerimeterGuid), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" perimeterGuid: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PerimeterGuid)) + { + builder.Append(" perimeterGuid: "); + if (PerimeterGuid.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{PerimeterGuid}'''"); + } + else + { + builder.AppendLine($"'{PerimeterGuid}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Location), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" location: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Location)) + { + builder.Append(" location: "); + builder.AppendLine($"'{Location.Value.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(NetworkSecurityPerimeter)} does not support writing '{options.Format}' format."); + } + } + + NetworkSecurityPerimeter IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeNetworkSecurityPerimeter(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NetworkSecurityPerimeter)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeter.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeter.cs new file mode 100644 index 000000000000..8da9a3ae073c --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeter.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// Information about a linked Network Security Perimeter. + public partial class NetworkSecurityPerimeter + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public NetworkSecurityPerimeter() + { + } + + /// Initializes a new instance of . + /// Fully qualified identifier of the resource. + /// Guid of the resource. + /// Location of the resource. + /// Keeps track of any properties unknown to the library. + internal NetworkSecurityPerimeter(ResourceIdentifier id, string perimeterGuid, AzureLocation? location, IDictionary serializedAdditionalRawData) + { + Id = id; + PerimeterGuid = perimeterGuid; + Location = location; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Fully qualified identifier of the resource. + [WirePath("id")] + public ResourceIdentifier Id { get; set; } + /// Guid of the resource. + [WirePath("perimeterGuid")] + public string PerimeterGuid { get; set; } + /// Location of the resource. + [WirePath("location")] + public AzureLocation? Location { get; set; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeterAccessRule.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeterAccessRule.Serialization.cs new file mode 100644 index 000000000000..54941b8101a4 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeterAccessRule.Serialization.cs @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + public partial class NetworkSecurityPerimeterAccessRule : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NetworkSecurityPerimeterAccessRule)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + NetworkSecurityPerimeterAccessRule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NetworkSecurityPerimeterAccessRule)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNetworkSecurityPerimeterAccessRule(document.RootElement, options); + } + + internal static NetworkSecurityPerimeterAccessRule DeserializeNetworkSecurityPerimeterAccessRule(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + NetworkSecurityPerimeterAccessRuleProperties properties = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = NetworkSecurityPerimeterAccessRuleProperties.DeserializeNetworkSecurityPerimeterAccessRuleProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new NetworkSecurityPerimeterAccessRule(name, properties, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" properties: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Properties)) + { + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(NetworkSecurityPerimeterAccessRule)} does not support writing '{options.Format}' format."); + } + } + + NetworkSecurityPerimeterAccessRule IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeNetworkSecurityPerimeterAccessRule(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NetworkSecurityPerimeterAccessRule)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeterAccessRule.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeterAccessRule.cs new file mode 100644 index 000000000000..dd922fccce93 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeterAccessRule.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// Network Security Perimeter Access Rule. + public partial class NetworkSecurityPerimeterAccessRule + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public NetworkSecurityPerimeterAccessRule() + { + } + + /// Initializes a new instance of . + /// Network Security Perimeter Access Rule Name. + /// Properties of Network Security Perimeter Access Rule. + /// Keeps track of any properties unknown to the library. + internal NetworkSecurityPerimeterAccessRule(string name, NetworkSecurityPerimeterAccessRuleProperties properties, IDictionary serializedAdditionalRawData) + { + Name = name; + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Network Security Perimeter Access Rule Name. + [WirePath("name")] + public string Name { get; set; } + /// Properties of Network Security Perimeter Access Rule. + [WirePath("properties")] + public NetworkSecurityPerimeterAccessRuleProperties Properties { get; set; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeterAccessRuleProperties.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeterAccessRuleProperties.Serialization.cs new file mode 100644 index 000000000000..c54e3214e2a3 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeterAccessRuleProperties.Serialization.cs @@ -0,0 +1,392 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + public partial class NetworkSecurityPerimeterAccessRuleProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NetworkSecurityPerimeterAccessRuleProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Direction)) + { + writer.WritePropertyName("direction"u8); + writer.WriteStringValue(Direction.Value.ToString()); + } + if (Optional.IsCollectionDefined(AddressPrefixes)) + { + writer.WritePropertyName("addressPrefixes"u8); + writer.WriteStartArray(); + foreach (var item in AddressPrefixes) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Subscriptions)) + { + writer.WritePropertyName("subscriptions"u8); + writer.WriteStartArray(); + foreach (var item in Subscriptions) + { + JsonSerializer.Serialize(writer, item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(NetworkSecurityPerimeters)) + { + writer.WritePropertyName("networkSecurityPerimeters"u8); + writer.WriteStartArray(); + foreach (var item in NetworkSecurityPerimeters) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(FullyQualifiedDomainNames)) + { + writer.WritePropertyName("fullyQualifiedDomainNames"u8); + writer.WriteStartArray(); + foreach (var item in FullyQualifiedDomainNames) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + NetworkSecurityPerimeterAccessRuleProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NetworkSecurityPerimeterAccessRuleProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNetworkSecurityPerimeterAccessRuleProperties(document.RootElement, options); + } + + internal static NetworkSecurityPerimeterAccessRuleProperties DeserializeNetworkSecurityPerimeterAccessRuleProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + NspAccessRuleDirection? direction = default; + IList addressPrefixes = default; + IList subscriptions = default; + IList networkSecurityPerimeters = default; + IList fullyQualifiedDomainNames = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("direction"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + direction = new NspAccessRuleDirection(property.Value.GetString()); + continue; + } + if (property.NameEquals("addressPrefixes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + addressPrefixes = array; + continue; + } + if (property.NameEquals("subscriptions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(JsonSerializer.Deserialize(item.GetRawText())); + } + subscriptions = array; + continue; + } + if (property.NameEquals("networkSecurityPerimeters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(NetworkSecurityPerimeter.DeserializeNetworkSecurityPerimeter(item, options)); + } + networkSecurityPerimeters = array; + continue; + } + if (property.NameEquals("fullyQualifiedDomainNames"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + fullyQualifiedDomainNames = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new NetworkSecurityPerimeterAccessRuleProperties( + direction, + addressPrefixes ?? new ChangeTrackingList(), + subscriptions ?? new ChangeTrackingList(), + networkSecurityPerimeters ?? new ChangeTrackingList(), + fullyQualifiedDomainNames ?? new ChangeTrackingList(), + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Direction), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" direction: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Direction)) + { + builder.Append(" direction: "); + builder.AppendLine($"'{Direction.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AddressPrefixes), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" addressPrefixes: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(AddressPrefixes)) + { + if (AddressPrefixes.Any()) + { + builder.Append(" addressPrefixes: "); + builder.AppendLine("["); + foreach (var item in AddressPrefixes) + { + if (item == null) + { + builder.Append("null"); + continue; + } + if (item.Contains(Environment.NewLine)) + { + builder.AppendLine(" '''"); + builder.AppendLine($"{item}'''"); + } + else + { + builder.AppendLine($" '{item}'"); + } + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Subscriptions), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" subscriptions: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Subscriptions)) + { + if (Subscriptions.Any()) + { + builder.Append(" subscriptions: "); + builder.AppendLine("["); + foreach (var item in Subscriptions) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " subscriptions: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NetworkSecurityPerimeters), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" networkSecurityPerimeters: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(NetworkSecurityPerimeters)) + { + if (NetworkSecurityPerimeters.Any()) + { + builder.Append(" networkSecurityPerimeters: "); + builder.AppendLine("["); + foreach (var item in NetworkSecurityPerimeters) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " networkSecurityPerimeters: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(FullyQualifiedDomainNames), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" fullyQualifiedDomainNames: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(FullyQualifiedDomainNames)) + { + if (FullyQualifiedDomainNames.Any()) + { + builder.Append(" fullyQualifiedDomainNames: "); + builder.AppendLine("["); + foreach (var item in FullyQualifiedDomainNames) + { + if (item == null) + { + builder.Append("null"); + continue; + } + if (item.Contains(Environment.NewLine)) + { + builder.AppendLine(" '''"); + builder.AppendLine($"{item}'''"); + } + else + { + builder.AppendLine($" '{item}'"); + } + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(NetworkSecurityPerimeterAccessRuleProperties)} does not support writing '{options.Format}' format."); + } + } + + NetworkSecurityPerimeterAccessRuleProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeNetworkSecurityPerimeterAccessRuleProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NetworkSecurityPerimeterAccessRuleProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeterAccessRuleProperties.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeterAccessRuleProperties.cs new file mode 100644 index 000000000000..2aa10281d949 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeterAccessRuleProperties.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// The Properties of Network Security Perimeter Rule. + public partial class NetworkSecurityPerimeterAccessRuleProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public NetworkSecurityPerimeterAccessRuleProperties() + { + AddressPrefixes = new ChangeTrackingList(); + Subscriptions = new ChangeTrackingList(); + NetworkSecurityPerimeters = new ChangeTrackingList(); + FullyQualifiedDomainNames = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Direction of Access Rule. + /// Address prefixes for inbound rules. + /// Subscriptions for inbound rules. + /// NetworkSecurityPerimeters for inbound rules. + /// Fully qualified domain name for outbound rules. + /// Keeps track of any properties unknown to the library. + internal NetworkSecurityPerimeterAccessRuleProperties(NspAccessRuleDirection? direction, IList addressPrefixes, IList subscriptions, IList networkSecurityPerimeters, IList fullyQualifiedDomainNames, IDictionary serializedAdditionalRawData) + { + Direction = direction; + AddressPrefixes = addressPrefixes; + Subscriptions = subscriptions; + NetworkSecurityPerimeters = networkSecurityPerimeters; + FullyQualifiedDomainNames = fullyQualifiedDomainNames; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Direction of Access Rule. + [WirePath("direction")] + public NspAccessRuleDirection? Direction { get; set; } + /// Address prefixes for inbound rules. + [WirePath("addressPrefixes")] + public IList AddressPrefixes { get; } + /// Subscriptions for inbound rules. + [WirePath("subscriptions")] + public IList Subscriptions { get; } + /// NetworkSecurityPerimeters for inbound rules. + [WirePath("networkSecurityPerimeters")] + public IList NetworkSecurityPerimeters { get; } + /// Fully qualified domain name for outbound rules. + [WirePath("fullyQualifiedDomainNames")] + public IList FullyQualifiedDomainNames { get; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeterConfigurationAssociationInfo.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeterConfigurationAssociationInfo.Serialization.cs new file mode 100644 index 000000000000..b737ec07bd68 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeterConfigurationAssociationInfo.Serialization.cs @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + public partial class NetworkSecurityPerimeterConfigurationAssociationInfo : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NetworkSecurityPerimeterConfigurationAssociationInfo)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(AccessMode)) + { + writer.WritePropertyName("accessMode"u8); + writer.WriteStringValue(AccessMode); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + NetworkSecurityPerimeterConfigurationAssociationInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NetworkSecurityPerimeterConfigurationAssociationInfo)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNetworkSecurityPerimeterConfigurationAssociationInfo(document.RootElement, options); + } + + internal static NetworkSecurityPerimeterConfigurationAssociationInfo DeserializeNetworkSecurityPerimeterConfigurationAssociationInfo(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string accessMode = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("accessMode"u8)) + { + accessMode = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new NetworkSecurityPerimeterConfigurationAssociationInfo(name, accessMode, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AccessMode), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" accessMode: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AccessMode)) + { + builder.Append(" accessMode: "); + if (AccessMode.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{AccessMode}'''"); + } + else + { + builder.AppendLine($"'{AccessMode}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(NetworkSecurityPerimeterConfigurationAssociationInfo)} does not support writing '{options.Format}' format."); + } + } + + NetworkSecurityPerimeterConfigurationAssociationInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeNetworkSecurityPerimeterConfigurationAssociationInfo(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NetworkSecurityPerimeterConfigurationAssociationInfo)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeterConfigurationAssociationInfo.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeterConfigurationAssociationInfo.cs new file mode 100644 index 000000000000..a2280a1569f1 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeterConfigurationAssociationInfo.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// Network Security Perimeter Configuration Association Information. + public partial class NetworkSecurityPerimeterConfigurationAssociationInfo + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public NetworkSecurityPerimeterConfigurationAssociationInfo() + { + } + + /// Initializes a new instance of . + /// Name of the resource association. + /// Access Mode of the resource association. + /// Keeps track of any properties unknown to the library. + internal NetworkSecurityPerimeterConfigurationAssociationInfo(string name, string accessMode, IDictionary serializedAdditionalRawData) + { + Name = name; + AccessMode = accessMode; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Name of the resource association. + [WirePath("name")] + public string Name { get; set; } + /// Access Mode of the resource association. + [WirePath("accessMode")] + public string AccessMode { get; set; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeterConfigurationList.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeterConfigurationList.Serialization.cs new file mode 100644 index 000000000000..bb06d219b949 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeterConfigurationList.Serialization.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + internal partial class NetworkSecurityPerimeterConfigurationList : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NetworkSecurityPerimeterConfigurationList)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + NetworkSecurityPerimeterConfigurationList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NetworkSecurityPerimeterConfigurationList)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNetworkSecurityPerimeterConfigurationList(document.RootElement, options); + } + + internal static NetworkSecurityPerimeterConfigurationList DeserializeNetworkSecurityPerimeterConfigurationList(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + 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(NetworkSecurityPerimeterConfigurationData.DeserializeNetworkSecurityPerimeterConfigurationData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new NetworkSecurityPerimeterConfigurationList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(NetworkSecurityPerimeterConfigurationList)} does not support writing '{options.Format}' format."); + } + } + + NetworkSecurityPerimeterConfigurationList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeNetworkSecurityPerimeterConfigurationList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NetworkSecurityPerimeterConfigurationList)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeterConfigurationList.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeterConfigurationList.cs new file mode 100644 index 000000000000..a8d80cda7b2d --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeterConfigurationList.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// A list of NSP configurations for an Cognitive Services account. + internal partial class NetworkSecurityPerimeterConfigurationList + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal NetworkSecurityPerimeterConfigurationList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Array of NSP configurations List Result for an Cognitive Services account. + /// Link to retrieve next page of results. + /// Keeps track of any properties unknown to the library. + internal NetworkSecurityPerimeterConfigurationList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Array of NSP configurations List Result for an Cognitive Services account. + public IReadOnlyList Value { get; } + /// Link to retrieve next page of results. + public string NextLink { get; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeterConfigurationProperties.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeterConfigurationProperties.Serialization.cs new file mode 100644 index 000000000000..a5f318e1fcc1 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeterConfigurationProperties.Serialization.cs @@ -0,0 +1,315 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + public partial class NetworkSecurityPerimeterConfigurationProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NetworkSecurityPerimeterConfigurationProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState); + } + if (Optional.IsCollectionDefined(ProvisioningIssues)) + { + writer.WritePropertyName("provisioningIssues"u8); + writer.WriteStartArray(); + foreach (var item in ProvisioningIssues) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NetworkSecurityPerimeter)) + { + writer.WritePropertyName("networkSecurityPerimeter"u8); + writer.WriteObjectValue(NetworkSecurityPerimeter, options); + } + if (Optional.IsDefined(ResourceAssociation)) + { + writer.WritePropertyName("resourceAssociation"u8); + writer.WriteObjectValue(ResourceAssociation, options); + } + if (Optional.IsDefined(Profile)) + { + writer.WritePropertyName("profile"u8); + writer.WriteObjectValue(Profile, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + NetworkSecurityPerimeterConfigurationProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NetworkSecurityPerimeterConfigurationProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNetworkSecurityPerimeterConfigurationProperties(document.RootElement, options); + } + + internal static NetworkSecurityPerimeterConfigurationProperties DeserializeNetworkSecurityPerimeterConfigurationProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string provisioningState = default; + IList provisioningIssues = default; + NetworkSecurityPerimeter networkSecurityPerimeter = default; + NetworkSecurityPerimeterConfigurationAssociationInfo resourceAssociation = default; + NetworkSecurityPerimeterProfileInfo profile = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + provisioningState = property.Value.GetString(); + continue; + } + if (property.NameEquals("provisioningIssues"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ProvisioningIssue.DeserializeProvisioningIssue(item, options)); + } + provisioningIssues = array; + continue; + } + if (property.NameEquals("networkSecurityPerimeter"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkSecurityPerimeter = NetworkSecurityPerimeter.DeserializeNetworkSecurityPerimeter(property.Value, options); + continue; + } + if (property.NameEquals("resourceAssociation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceAssociation = NetworkSecurityPerimeterConfigurationAssociationInfo.DeserializeNetworkSecurityPerimeterConfigurationAssociationInfo(property.Value, options); + continue; + } + if (property.NameEquals("profile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + profile = NetworkSecurityPerimeterProfileInfo.DeserializeNetworkSecurityPerimeterProfileInfo(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new NetworkSecurityPerimeterConfigurationProperties( + provisioningState, + provisioningIssues ?? new ChangeTrackingList(), + networkSecurityPerimeter, + resourceAssociation, + profile, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" provisioningState: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ProvisioningState)) + { + builder.Append(" provisioningState: "); + if (ProvisioningState.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ProvisioningState}'''"); + } + else + { + builder.AppendLine($"'{ProvisioningState}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningIssues), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" provisioningIssues: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(ProvisioningIssues)) + { + if (ProvisioningIssues.Any()) + { + builder.Append(" provisioningIssues: "); + builder.AppendLine("["); + foreach (var item in ProvisioningIssues) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " provisioningIssues: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NetworkSecurityPerimeter), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" networkSecurityPerimeter: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NetworkSecurityPerimeter)) + { + builder.Append(" networkSecurityPerimeter: "); + BicepSerializationHelpers.AppendChildObject(builder, NetworkSecurityPerimeter, options, 2, false, " networkSecurityPerimeter: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ResourceAssociation), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" resourceAssociation: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ResourceAssociation)) + { + builder.Append(" resourceAssociation: "); + BicepSerializationHelpers.AppendChildObject(builder, ResourceAssociation, options, 2, false, " resourceAssociation: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Profile), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" profile: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Profile)) + { + builder.Append(" profile: "); + BicepSerializationHelpers.AppendChildObject(builder, Profile, options, 2, false, " profile: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(NetworkSecurityPerimeterConfigurationProperties)} does not support writing '{options.Format}' format."); + } + } + + NetworkSecurityPerimeterConfigurationProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeNetworkSecurityPerimeterConfigurationProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NetworkSecurityPerimeterConfigurationProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeterConfigurationProperties.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeterConfigurationProperties.cs new file mode 100644 index 000000000000..e64c41672058 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeterConfigurationProperties.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// The properties of an NSP Configuration. + public partial class NetworkSecurityPerimeterConfigurationProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public NetworkSecurityPerimeterConfigurationProperties() + { + ProvisioningIssues = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Provisioning state of NetworkSecurityPerimeter configuration. + /// List of Provisioning Issues. + /// Information about a linked Network Security Perimeter. + /// Network Security Perimeter Configuration Association Information. + /// Network Security Perimeter Profile Information. + /// Keeps track of any properties unknown to the library. + internal NetworkSecurityPerimeterConfigurationProperties(string provisioningState, IList provisioningIssues, NetworkSecurityPerimeter networkSecurityPerimeter, NetworkSecurityPerimeterConfigurationAssociationInfo resourceAssociation, NetworkSecurityPerimeterProfileInfo profile, IDictionary serializedAdditionalRawData) + { + ProvisioningState = provisioningState; + ProvisioningIssues = provisioningIssues; + NetworkSecurityPerimeter = networkSecurityPerimeter; + ResourceAssociation = resourceAssociation; + Profile = profile; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Provisioning state of NetworkSecurityPerimeter configuration. + [WirePath("provisioningState")] + public string ProvisioningState { get; } + /// List of Provisioning Issues. + [WirePath("provisioningIssues")] + public IList ProvisioningIssues { get; } + /// Information about a linked Network Security Perimeter. + [WirePath("networkSecurityPerimeter")] + public NetworkSecurityPerimeter NetworkSecurityPerimeter { get; set; } + /// Network Security Perimeter Configuration Association Information. + [WirePath("resourceAssociation")] + public NetworkSecurityPerimeterConfigurationAssociationInfo ResourceAssociation { get; set; } + /// Network Security Perimeter Profile Information. + [WirePath("profile")] + public NetworkSecurityPerimeterProfileInfo Profile { get; set; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeterProfileInfo.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeterProfileInfo.Serialization.cs new file mode 100644 index 000000000000..bf5d33f5118c --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeterProfileInfo.Serialization.cs @@ -0,0 +1,346 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + public partial class NetworkSecurityPerimeterProfileInfo : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NetworkSecurityPerimeterProfileInfo)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(AccessRulesVersion)) + { + writer.WritePropertyName("accessRulesVersion"u8); + writer.WriteNumberValue(AccessRulesVersion.Value); + } + if (Optional.IsCollectionDefined(AccessRules)) + { + writer.WritePropertyName("accessRules"u8); + writer.WriteStartArray(); + foreach (var item in AccessRules) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(DiagnosticSettingsVersion)) + { + writer.WritePropertyName("diagnosticSettingsVersion"u8); + writer.WriteNumberValue(DiagnosticSettingsVersion.Value); + } + if (Optional.IsCollectionDefined(EnabledLogCategories)) + { + writer.WritePropertyName("enabledLogCategories"u8); + writer.WriteStartArray(); + foreach (var item in EnabledLogCategories) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + NetworkSecurityPerimeterProfileInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NetworkSecurityPerimeterProfileInfo)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNetworkSecurityPerimeterProfileInfo(document.RootElement, options); + } + + internal static NetworkSecurityPerimeterProfileInfo DeserializeNetworkSecurityPerimeterProfileInfo(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + long? accessRulesVersion = default; + IList accessRules = default; + long? diagnosticSettingsVersion = default; + IList enabledLogCategories = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("accessRulesVersion"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + accessRulesVersion = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("accessRules"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(NetworkSecurityPerimeterAccessRule.DeserializeNetworkSecurityPerimeterAccessRule(item, options)); + } + accessRules = array; + continue; + } + if (property.NameEquals("diagnosticSettingsVersion"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + diagnosticSettingsVersion = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("enabledLogCategories"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + enabledLogCategories = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new NetworkSecurityPerimeterProfileInfo( + name, + accessRulesVersion, + accessRules ?? new ChangeTrackingList(), + diagnosticSettingsVersion, + enabledLogCategories ?? new ChangeTrackingList(), + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AccessRulesVersion), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" accessRulesVersion: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AccessRulesVersion)) + { + builder.Append(" accessRulesVersion: "); + builder.AppendLine($"'{AccessRulesVersion.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AccessRules), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" accessRules: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(AccessRules)) + { + if (AccessRules.Any()) + { + builder.Append(" accessRules: "); + builder.AppendLine("["); + foreach (var item in AccessRules) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " accessRules: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DiagnosticSettingsVersion), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" diagnosticSettingsVersion: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DiagnosticSettingsVersion)) + { + builder.Append(" diagnosticSettingsVersion: "); + builder.AppendLine($"'{DiagnosticSettingsVersion.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnabledLogCategories), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" enabledLogCategories: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(EnabledLogCategories)) + { + if (EnabledLogCategories.Any()) + { + builder.Append(" enabledLogCategories: "); + builder.AppendLine("["); + foreach (var item in EnabledLogCategories) + { + if (item == null) + { + builder.Append("null"); + continue; + } + if (item.Contains(Environment.NewLine)) + { + builder.AppendLine(" '''"); + builder.AppendLine($"{item}'''"); + } + else + { + builder.AppendLine($" '{item}'"); + } + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(NetworkSecurityPerimeterProfileInfo)} does not support writing '{options.Format}' format."); + } + } + + NetworkSecurityPerimeterProfileInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeNetworkSecurityPerimeterProfileInfo(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NetworkSecurityPerimeterProfileInfo)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeterProfileInfo.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeterProfileInfo.cs new file mode 100644 index 000000000000..3219e4c44351 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NetworkSecurityPerimeterProfileInfo.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// Network Security Perimeter Profile Information. + public partial class NetworkSecurityPerimeterProfileInfo + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public NetworkSecurityPerimeterProfileInfo() + { + AccessRules = new ChangeTrackingList(); + EnabledLogCategories = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Name of the resource profile. + /// Access rules version of the resource profile. + /// + /// Current diagnostic settings version. + /// List of enabled log categories. + /// Keeps track of any properties unknown to the library. + internal NetworkSecurityPerimeterProfileInfo(string name, long? accessRulesVersion, IList accessRules, long? diagnosticSettingsVersion, IList enabledLogCategories, IDictionary serializedAdditionalRawData) + { + Name = name; + AccessRulesVersion = accessRulesVersion; + AccessRules = accessRules; + DiagnosticSettingsVersion = diagnosticSettingsVersion; + EnabledLogCategories = enabledLogCategories; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Name of the resource profile. + [WirePath("name")] + public string Name { get; set; } + /// Access rules version of the resource profile. + [WirePath("accessRulesVersion")] + public long? AccessRulesVersion { get; set; } + /// Gets the access rules. + [WirePath("accessRules")] + public IList AccessRules { get; } + /// Current diagnostic settings version. + [WirePath("diagnosticSettingsVersion")] + public long? DiagnosticSettingsVersion { get; set; } + /// List of enabled log categories. + [WirePath("enabledLogCategories")] + public IList EnabledLogCategories { get; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NspAccessRuleDirection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NspAccessRuleDirection.cs new file mode 100644 index 000000000000..ff8e9d0801da --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/NspAccessRuleDirection.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 +{ + /// Direction of Access Rule. + public readonly partial struct NspAccessRuleDirection : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public NspAccessRuleDirection(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string InboundValue = "Inbound"; + private const string OutboundValue = "Outbound"; + + /// Inbound. + public static NspAccessRuleDirection Inbound { get; } = new NspAccessRuleDirection(InboundValue); + /// Outbound. + public static NspAccessRuleDirection Outbound { get; } = new NspAccessRuleDirection(OutboundValue); + /// Determines if two values are the same. + public static bool operator ==(NspAccessRuleDirection left, NspAccessRuleDirection right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(NspAccessRuleDirection left, NspAccessRuleDirection right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator NspAccessRuleDirection(string value) => new NspAccessRuleDirection(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is NspAccessRuleDirection other && Equals(other); + /// + public bool Equals(NspAccessRuleDirection other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 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 62% 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 1eedfac4c8d4..bcadca7bd21a 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 @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.CognitiveServices.Models { - public partial class CognitiveServicesCommitmentPlanPatch : IUtf8JsonSerializable, IJsonModel + public partial class PatchResourceTagsAndSku : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter write /// The client options for reading and writing models. protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(CognitiveServicesCommitmentPlanPatch)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(PatchResourceTagsAndSku)} does not support writing '{format}' format."); } base.JsonModelWriteCore(writer, options); @@ -42,19 +42,19 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } } - CognitiveServicesCommitmentPlanPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + PatchResourceTagsAndSku IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(CognitiveServicesCommitmentPlanPatch)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(PatchResourceTagsAndSku)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeCognitiveServicesCommitmentPlanPatch(document.RootElement, options); + return DeserializePatchResourceTagsAndSku(document.RootElement, options); } - internal static CognitiveServicesCommitmentPlanPatch DeserializeCognitiveServicesCommitmentPlanPatch(JsonElement element, ModelReaderWriterOptions options = null) + internal static PatchResourceTagsAndSku DeserializePatchResourceTagsAndSku(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -97,38 +97,38 @@ internal static CognitiveServicesCommitmentPlanPatch DeserializeCognitiveService } } serializedAdditionalRawData = rawDataDictionary; - return new CognitiveServicesCommitmentPlanPatch(tags ?? new ChangeTrackingDictionary(), serializedAdditionalRawData, sku); + return new PatchResourceTagsAndSku(tags ?? new ChangeTrackingDictionary(), serializedAdditionalRawData, sku); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(CognitiveServicesCommitmentPlanPatch)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(PatchResourceTagsAndSku)} does not support writing '{options.Format}' format."); } } - CognitiveServicesCommitmentPlanPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + PatchResourceTagsAndSku IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data); - return DeserializeCognitiveServicesCommitmentPlanPatch(document.RootElement, options); + return DeserializePatchResourceTagsAndSku(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(CognitiveServicesCommitmentPlanPatch)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(PatchResourceTagsAndSku)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } 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 59% 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 42b7b1575d75..c0949ff93a5a 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/CognitiveServicesCommitmentPlanPatch.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/PatchResourceTagsAndSku.cs @@ -11,18 +11,18 @@ 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() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Resource tags. /// Keeps track of any properties unknown to the library. /// The resource model definition representing SKU. - internal CognitiveServicesCommitmentPlanPatch(IDictionary tags, IDictionary serializedAdditionalRawData, CognitiveServicesSku sku) : base(tags, serializedAdditionalRawData) + internal PatchResourceTagsAndSku(IDictionary tags, IDictionary serializedAdditionalRawData, CognitiveServicesSku sku) : base(tags, serializedAdditionalRawData) { Sku = sku; } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ProvisioningIssue.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ProvisioningIssue.Serialization.cs new file mode 100644 index 000000000000..4d5641bb4dc3 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ProvisioningIssue.Serialization.cs @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + public partial class ProvisioningIssue : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ProvisioningIssue)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ProvisioningIssue IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ProvisioningIssue)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeProvisioningIssue(document.RootElement, options); + } + + internal static ProvisioningIssue DeserializeProvisioningIssue(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + ProvisioningIssueProperties properties = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ProvisioningIssueProperties.DeserializeProvisioningIssueProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ProvisioningIssue(name, properties, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" properties: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Properties)) + { + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ProvisioningIssue)} does not support writing '{options.Format}' format."); + } + } + + ProvisioningIssue IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeProvisioningIssue(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ProvisioningIssue)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ProvisioningIssue.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ProvisioningIssue.cs new file mode 100644 index 000000000000..fd5cb98f8bd5 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ProvisioningIssue.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// The ProvisioningIssue. + public partial class ProvisioningIssue + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ProvisioningIssue() + { + } + + /// Initializes a new instance of . + /// Name of the NSP provisioning issue. + /// Properties of Provisioning Issue. + /// Keeps track of any properties unknown to the library. + internal ProvisioningIssue(string name, ProvisioningIssueProperties properties, IDictionary serializedAdditionalRawData) + { + Name = name; + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Name of the NSP provisioning issue. + [WirePath("name")] + public string Name { get; set; } + /// Properties of Provisioning Issue. + [WirePath("properties")] + public ProvisioningIssueProperties Properties { get; set; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ProvisioningIssueProperties.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ProvisioningIssueProperties.Serialization.cs new file mode 100644 index 000000000000..7dc27d2a23a5 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ProvisioningIssueProperties.Serialization.cs @@ -0,0 +1,358 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + public partial class ProvisioningIssueProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ProvisioningIssueProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(IssueType)) + { + writer.WritePropertyName("issueType"u8); + writer.WriteStringValue(IssueType); + } + if (Optional.IsDefined(Severity)) + { + writer.WritePropertyName("severity"u8); + writer.WriteStringValue(Severity); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsCollectionDefined(SuggestedResourceIds)) + { + writer.WritePropertyName("suggestedResourceIds"u8); + writer.WriteStartArray(); + foreach (var item in SuggestedResourceIds) + { + if (item == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(SuggestedAccessRules)) + { + writer.WritePropertyName("suggestedAccessRules"u8); + writer.WriteStartArray(); + foreach (var item in SuggestedAccessRules) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ProvisioningIssueProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ProvisioningIssueProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeProvisioningIssueProperties(document.RootElement, options); + } + + internal static ProvisioningIssueProperties DeserializeProvisioningIssueProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string issueType = default; + string severity = default; + string description = default; + IList suggestedResourceIds = default; + IList suggestedAccessRules = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("issueType"u8)) + { + issueType = property.Value.GetString(); + continue; + } + if (property.NameEquals("severity"u8)) + { + severity = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("suggestedResourceIds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + if (item.ValueKind == JsonValueKind.Null) + { + array.Add(null); + } + else + { + array.Add(new ResourceIdentifier(item.GetString())); + } + } + suggestedResourceIds = array; + continue; + } + if (property.NameEquals("suggestedAccessRules"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(NetworkSecurityPerimeterAccessRule.DeserializeNetworkSecurityPerimeterAccessRule(item, options)); + } + suggestedAccessRules = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ProvisioningIssueProperties( + issueType, + severity, + description, + suggestedResourceIds ?? new ChangeTrackingList(), + suggestedAccessRules ?? new ChangeTrackingList(), + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IssueType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" issueType: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(IssueType)) + { + builder.Append(" issueType: "); + if (IssueType.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{IssueType}'''"); + } + else + { + builder.AppendLine($"'{IssueType}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Severity), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" severity: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Severity)) + { + builder.Append(" severity: "); + if (Severity.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Severity}'''"); + } + else + { + builder.AppendLine($"'{Severity}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Description), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" description: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Description)) + { + builder.Append(" description: "); + if (Description.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Description}'''"); + } + else + { + builder.AppendLine($"'{Description}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SuggestedResourceIds), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" suggestedResourceIds: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(SuggestedResourceIds)) + { + if (SuggestedResourceIds.Any()) + { + builder.Append(" suggestedResourceIds: "); + builder.AppendLine("["); + foreach (var item in SuggestedResourceIds) + { + if (item == null) + { + builder.Append("null"); + continue; + } + builder.AppendLine($" '{item.ToString()}'"); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SuggestedAccessRules), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" suggestedAccessRules: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(SuggestedAccessRules)) + { + if (SuggestedAccessRules.Any()) + { + builder.Append(" suggestedAccessRules: "); + builder.AppendLine("["); + foreach (var item in SuggestedAccessRules) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " suggestedAccessRules: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ProvisioningIssueProperties)} does not support writing '{options.Format}' format."); + } + } + + ProvisioningIssueProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeProvisioningIssueProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ProvisioningIssueProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ProvisioningIssueProperties.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ProvisioningIssueProperties.cs new file mode 100644 index 000000000000..c571c2eec7f8 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ProvisioningIssueProperties.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// Properties of Provisioning Issue. + public partial class ProvisioningIssueProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ProvisioningIssueProperties() + { + SuggestedResourceIds = new ChangeTrackingList(); + SuggestedAccessRules = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Type of Issue. + /// Severity of the issue. + /// Description of the issue. + /// IDs of resources that can be associated to the same perimeter to remediate the issue. + /// Optional array, suggested access rules. + /// Keeps track of any properties unknown to the library. + internal ProvisioningIssueProperties(string issueType, string severity, string description, IList suggestedResourceIds, IList suggestedAccessRules, IDictionary serializedAdditionalRawData) + { + IssueType = issueType; + Severity = severity; + Description = description; + SuggestedResourceIds = suggestedResourceIds; + SuggestedAccessRules = suggestedAccessRules; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Type of Issue. + [WirePath("issueType")] + public string IssueType { get; set; } + /// Severity of the issue. + [WirePath("severity")] + public string Severity { get; set; } + /// Description of the issue. + [WirePath("description")] + public string Description { get; set; } + /// IDs of resources that can be associated to the same perimeter to remediate the issue. + [WirePath("suggestedResourceIds")] + public IList SuggestedResourceIds { get; } + /// Optional array, suggested access rules. + [WirePath("suggestedAccessRules")] + public IList SuggestedAccessRules { get; } + } +} 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 000000000000..cfb7a9c0f93c --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlockListItemsResult.Serialization.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + internal partial class RaiBlockListItemsResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RaiBlockListItemsResult)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RaiBlockListItemsResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RaiBlockListItemsResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRaiBlockListItemsResult(document.RootElement, options); + } + + internal static RaiBlockListItemsResult DeserializeRaiBlockListItemsResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string nextLink = default; + IReadOnlyList value = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + 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, options)); + } + value = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RaiBlockListItemsResult(nextLink, value ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(RaiBlockListItemsResult)} does not support writing '{options.Format}' format."); + } + } + + RaiBlockListItemsResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeRaiBlockListItemsResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RaiBlockListItemsResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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 000000000000..e69ceb530a39 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlockListItemsResult.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// The list of cognitive services RAI Blocklist Items. + internal partial class RaiBlockListItemsResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// 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. + /// Keeps track of any properties unknown to the library. + internal RaiBlockListItemsResult(string nextLink, IReadOnlyList value, IDictionary serializedAdditionalRawData) + { + NextLink = nextLink; + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// 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 000000000000..e26f89bcd190 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlockListResult.Serialization.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + internal partial class RaiBlockListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RaiBlockListResult)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RaiBlockListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RaiBlockListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRaiBlockListResult(document.RootElement, options); + } + + internal static RaiBlockListResult DeserializeRaiBlockListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string nextLink = default; + IReadOnlyList value = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + 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, options)); + } + value = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RaiBlockListResult(nextLink, value ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(RaiBlockListResult)} does not support writing '{options.Format}' format."); + } + } + + RaiBlockListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeRaiBlockListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RaiBlockListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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 000000000000..50339400f62d --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlockListResult.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// The list of cognitive services RAI Blocklists. + internal partial class RaiBlockListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// 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. + /// Keeps track of any properties unknown to the library. + internal RaiBlockListResult(string nextLink, IReadOnlyList value, IDictionary serializedAdditionalRawData) + { + NextLink = nextLink; + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// 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 000000000000..4d0dff8c48ca --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlocklistConfig.Serialization.cs @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + public partial class RaiBlocklistConfig : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RaiBlocklistConfig)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(BlocklistName)) + { + writer.WritePropertyName("blocklistName"u8); + writer.WriteStringValue(BlocklistName); + } + if (Optional.IsDefined(Blocking)) + { + writer.WritePropertyName("blocking"u8); + writer.WriteBooleanValue(Blocking.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RaiBlocklistConfig IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RaiBlocklistConfig)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRaiBlocklistConfig(document.RootElement, options); + } + + internal static RaiBlocklistConfig DeserializeRaiBlocklistConfig(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string blocklistName = default; + bool? blocking = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + 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; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RaiBlocklistConfig(blocklistName, blocking, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(BlocklistName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" blocklistName: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(BlocklistName)) + { + builder.Append(" blocklistName: "); + if (BlocklistName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{BlocklistName}'''"); + } + else + { + builder.AppendLine($"'{BlocklistName}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Blocking), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" blocking: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Blocking)) + { + builder.Append(" blocking: "); + var boolValue = Blocking.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(RaiBlocklistConfig)} does not support writing '{options.Format}' format."); + } + } + + RaiBlocklistConfig IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeRaiBlocklistConfig(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RaiBlocklistConfig)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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 000000000000..3aa06b7c3095 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlocklistConfig.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// Azure OpenAI blocklist config. + public partial class RaiBlocklistConfig + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public RaiBlocklistConfig() + { + } + + /// Initializes a new instance of . + /// Name of ContentFilter. + /// If blocking would occur. + /// Keeps track of any properties unknown to the library. + internal RaiBlocklistConfig(string blocklistName, bool? blocking, IDictionary serializedAdditionalRawData) + { + BlocklistName = blocklistName; + Blocking = blocking; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Name of ContentFilter. + [WirePath("blocklistName")] + public string BlocklistName { get; set; } + /// If blocking would occur. + [WirePath("blocking")] + public bool? Blocking { get; set; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlocklistItemBulkRequest.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlocklistItemBulkRequest.Serialization.cs new file mode 100644 index 000000000000..7cc40b1857d3 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlocklistItemBulkRequest.Serialization.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + public partial class RaiBlocklistItemBulkRequest : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RaiBlocklistItemBulkRequest)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RaiBlocklistItemBulkRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RaiBlocklistItemBulkRequest)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRaiBlocklistItemBulkRequest(document.RootElement, options); + } + + internal static RaiBlocklistItemBulkRequest DeserializeRaiBlocklistItemBulkRequest(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + RaiBlocklistItemProperties properties = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = RaiBlocklistItemProperties.DeserializeRaiBlocklistItemProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RaiBlocklistItemBulkRequest(name, properties, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RaiBlocklistItemBulkRequest)} does not support writing '{options.Format}' format."); + } + } + + RaiBlocklistItemBulkRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeRaiBlocklistItemBulkRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RaiBlocklistItemBulkRequest)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlocklistItemBulkRequest.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlocklistItemBulkRequest.cs new file mode 100644 index 000000000000..32f8b1d29c1e --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlocklistItemBulkRequest.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// The Cognitive Services RaiBlocklist Item request body. + public partial class RaiBlocklistItemBulkRequest + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public RaiBlocklistItemBulkRequest() + { + } + + /// Initializes a new instance of . + /// + /// Properties of Cognitive Services RaiBlocklist Item. + /// Keeps track of any properties unknown to the library. + internal RaiBlocklistItemBulkRequest(string name, RaiBlocklistItemProperties properties, IDictionary serializedAdditionalRawData) + { + Name = name; + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Gets or sets the name. + [WirePath("name")] + public string Name { get; set; } + /// Properties of Cognitive Services RaiBlocklist Item. + [WirePath("properties")] + public RaiBlocklistItemProperties Properties { get; set; } + } +} 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 000000000000..22d6f0981fda --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlocklistItemProperties.Serialization.cs @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + public partial class RaiBlocklistItemProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RaiBlocklistItemProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Pattern)) + { + writer.WritePropertyName("pattern"u8); + writer.WriteStringValue(Pattern); + } + if (Optional.IsDefined(IsRegex)) + { + writer.WritePropertyName("isRegex"u8); + writer.WriteBooleanValue(IsRegex.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RaiBlocklistItemProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RaiBlocklistItemProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRaiBlocklistItemProperties(document.RootElement, options); + } + + internal static RaiBlocklistItemProperties DeserializeRaiBlocklistItemProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string pattern = default; + bool? isRegex = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + 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; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RaiBlocklistItemProperties(pattern, isRegex, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Pattern), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" pattern: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Pattern)) + { + builder.Append(" pattern: "); + if (Pattern.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Pattern}'''"); + } + else + { + builder.AppendLine($"'{Pattern}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsRegex), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" isRegex: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(IsRegex)) + { + builder.Append(" isRegex: "); + var boolValue = IsRegex.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(RaiBlocklistItemProperties)} does not support writing '{options.Format}' format."); + } + } + + RaiBlocklistItemProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeRaiBlocklistItemProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RaiBlocklistItemProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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 000000000000..a6b112600d50 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlocklistItemProperties.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// RAI Custom Blocklist Item properties. + public partial class RaiBlocklistItemProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public RaiBlocklistItemProperties() + { + } + + /// Initializes a new instance of . + /// Pattern to match against. + /// If the pattern is a regex pattern. + /// Keeps track of any properties unknown to the library. + internal RaiBlocklistItemProperties(string pattern, bool? isRegex, IDictionary serializedAdditionalRawData) + { + Pattern = pattern; + IsRegex = isRegex; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Pattern to match against. + [WirePath("pattern")] + public string Pattern { get; set; } + /// If the pattern is a regex pattern. + [WirePath("isRegex")] + 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 000000000000..59fd87bd3a46 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlocklistProperties.Serialization.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + internal partial class RaiBlocklistProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RaiBlocklistProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RaiBlocklistProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RaiBlocklistProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRaiBlocklistProperties(document.RootElement, options); + } + + internal static RaiBlocklistProperties DeserializeRaiBlocklistProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string description = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RaiBlocklistProperties(description, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Description), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" description: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Description)) + { + builder.Append(" description: "); + if (Description.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Description}'''"); + } + else + { + builder.AppendLine($"'{Description}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(RaiBlocklistProperties)} does not support writing '{options.Format}' format."); + } + } + + RaiBlocklistProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeRaiBlocklistProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RaiBlocklistProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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 000000000000..8a6fab4435c6 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiBlocklistProperties.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// RAI Custom Blocklist properties. + internal partial class RaiBlocklistProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public RaiBlocklistProperties() + { + } + + /// Initializes a new instance of . + /// Description of the block list. + /// Keeps track of any properties unknown to the library. + internal RaiBlocklistProperties(string description, IDictionary serializedAdditionalRawData) + { + Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Description of the block list. + [WirePath("description")] + public string Description { get; set; } + } +} 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 000000000000..2c03c76feb3f --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiContentFilterListResult.Serialization.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + internal partial class RaiContentFilterListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RaiContentFilterListResult)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RaiContentFilterListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RaiContentFilterListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRaiContentFilterListResult(document.RootElement, options); + } + + internal static RaiContentFilterListResult DeserializeRaiContentFilterListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string nextLink = default; + IReadOnlyList value = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + 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(RaiContentFilterData.DeserializeRaiContentFilterData(item, options)); + } + value = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RaiContentFilterListResult(nextLink, value ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(RaiContentFilterListResult)} does not support writing '{options.Format}' format."); + } + } + + RaiContentFilterListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeRaiContentFilterListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RaiContentFilterListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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 000000000000..bd1ceadc594f --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiContentFilterListResult.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// The list of Content Filters. + internal partial class RaiContentFilterListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// 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. + /// Keeps track of any properties unknown to the library. + internal RaiContentFilterListResult(string nextLink, IReadOnlyList value, IDictionary serializedAdditionalRawData) + { + NextLink = nextLink; + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// 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/RaiContentFilterProperties.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiContentFilterProperties.Serialization.cs new file mode 100644 index 000000000000..bc22bb49dc20 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiContentFilterProperties.Serialization.cs @@ -0,0 +1,231 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + public partial class RaiContentFilterProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RaiContentFilterProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(IsMultiLevelFilter)) + { + writer.WritePropertyName("isMultiLevelFilter"u8); + writer.WriteBooleanValue(IsMultiLevelFilter.Value); + } + if (Optional.IsDefined(Source)) + { + writer.WritePropertyName("source"u8); + writer.WriteStringValue(Source.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RaiContentFilterProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RaiContentFilterProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRaiContentFilterProperties(document.RootElement, options); + } + + internal static RaiContentFilterProperties DeserializeRaiContentFilterProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + bool? isMultiLevelFilter = default; + RaiPolicyContentSource? source = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("isMultiLevelFilter"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isMultiLevelFilter = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("source"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + source = new RaiPolicyContentSource(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RaiContentFilterProperties(name, isMultiLevelFilter, source, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsMultiLevelFilter), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" isMultiLevelFilter: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(IsMultiLevelFilter)) + { + builder.Append(" isMultiLevelFilter: "); + var boolValue = IsMultiLevelFilter.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Source), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" source: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Source)) + { + builder.Append(" source: "); + builder.AppendLine($"'{Source.Value.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(RaiContentFilterProperties)} does not support writing '{options.Format}' format."); + } + } + + RaiContentFilterProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeRaiContentFilterProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RaiContentFilterProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiContentFilterProperties.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiContentFilterProperties.cs new file mode 100644 index 000000000000..91ac0ee712f0 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiContentFilterProperties.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// Azure OpenAI Content Filter Properties. + public partial class RaiContentFilterProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public RaiContentFilterProperties() + { + } + + /// Initializes a new instance of . + /// Name of Content Filter. + /// If the Content Filter has multi severity levels(Low, Medium, or High). + /// Content source to apply the Content Filters. + /// Keeps track of any properties unknown to the library. + internal RaiContentFilterProperties(string name, bool? isMultiLevelFilter, RaiPolicyContentSource? source, IDictionary serializedAdditionalRawData) + { + Name = name; + IsMultiLevelFilter = isMultiLevelFilter; + Source = source; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Name of Content Filter. + [WirePath("name")] + public string Name { get; set; } + /// If the Content Filter has multi severity levels(Low, Medium, or High). + [WirePath("isMultiLevelFilter")] + public bool? IsMultiLevelFilter { get; set; } + /// Content source to apply the Content Filters. + [WirePath("source")] + public RaiPolicyContentSource? Source { get; set; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiMonitorConfig.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiMonitorConfig.Serialization.cs new file mode 100644 index 000000000000..1ba520cf0e69 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiMonitorConfig.Serialization.cs @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + public partial class RaiMonitorConfig : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RaiMonitorConfig)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(AdxStorageResourceId)) + { + writer.WritePropertyName("adxStorageResourceId"u8); + writer.WriteStringValue(AdxStorageResourceId); + } + if (Optional.IsDefined(IdentityClientId)) + { + writer.WritePropertyName("identityClientId"u8); + writer.WriteStringValue(IdentityClientId.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RaiMonitorConfig IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RaiMonitorConfig)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRaiMonitorConfig(document.RootElement, options); + } + + internal static RaiMonitorConfig DeserializeRaiMonitorConfig(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string adxStorageResourceId = default; + Guid? identityClientId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("adxStorageResourceId"u8)) + { + adxStorageResourceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("identityClientId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identityClientId = property.Value.GetGuid(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RaiMonitorConfig(adxStorageResourceId, identityClientId, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AdxStorageResourceId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" adxStorageResourceId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AdxStorageResourceId)) + { + builder.Append(" adxStorageResourceId: "); + if (AdxStorageResourceId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{AdxStorageResourceId}'''"); + } + else + { + builder.AppendLine($"'{AdxStorageResourceId}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IdentityClientId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" identityClientId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(IdentityClientId)) + { + builder.Append(" identityClientId: "); + builder.AppendLine($"'{IdentityClientId.Value.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(RaiMonitorConfig)} does not support writing '{options.Format}' format."); + } + } + + RaiMonitorConfig IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeRaiMonitorConfig(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RaiMonitorConfig)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiMonitorConfig.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiMonitorConfig.cs new file mode 100644 index 000000000000..273f2bbb3446 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiMonitorConfig.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// Cognitive Services Rai Monitor Config. + public partial class RaiMonitorConfig + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public RaiMonitorConfig() + { + } + + /// Initializes a new instance of . + /// The storage resource Id. + /// The identity client Id to access the storage. + /// Keeps track of any properties unknown to the library. + internal RaiMonitorConfig(string adxStorageResourceId, Guid? identityClientId, IDictionary serializedAdditionalRawData) + { + AdxStorageResourceId = adxStorageResourceId; + IdentityClientId = identityClientId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The storage resource Id. + [WirePath("adxStorageResourceId")] + public string AdxStorageResourceId { get; set; } + /// The identity client Id to access the storage. + [WirePath("identityClientId")] + public Guid? IdentityClientId { get; set; } + } +} 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 000000000000..ab03c5533971 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiPolicyContentFilter.Serialization.cs @@ -0,0 +1,298 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + public partial class RaiPolicyContentFilter : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RaiPolicyContentFilter)} does not support writing '{format}' format."); + } + + 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(SeverityThreshold)) + { + writer.WritePropertyName("severityThreshold"u8); + writer.WriteStringValue(SeverityThreshold.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()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RaiPolicyContentFilter IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RaiPolicyContentFilter)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRaiPolicyContentFilter(document.RootElement, options); + } + + internal static RaiPolicyContentFilter DeserializeRaiPolicyContentFilter(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + bool? enabled = default; + ContentLevel? severityThreshold = default; + bool? blocking = default; + RaiPolicyContentSource? source = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + 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("severityThreshold"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + severityThreshold = new ContentLevel(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; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RaiPolicyContentFilter( + name, + enabled, + severityThreshold, + blocking, + source, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Enabled), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Enabled)) + { + builder.Append(" enabled: "); + var boolValue = Enabled.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SeverityThreshold), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" severityThreshold: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SeverityThreshold)) + { + builder.Append(" severityThreshold: "); + builder.AppendLine($"'{SeverityThreshold.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Blocking), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" blocking: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Blocking)) + { + builder.Append(" blocking: "); + var boolValue = Blocking.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Source), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" source: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Source)) + { + builder.Append(" source: "); + builder.AppendLine($"'{Source.Value.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(RaiPolicyContentFilter)} does not support writing '{options.Format}' format."); + } + } + + RaiPolicyContentFilter IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeRaiPolicyContentFilter(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RaiPolicyContentFilter)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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 000000000000..5a91784da482 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiPolicyContentFilter.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// Azure OpenAI Content Filter. + public partial class RaiPolicyContentFilter + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// 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. + /// Keeps track of any properties unknown to the library. + internal RaiPolicyContentFilter(string name, bool? enabled, ContentLevel? severityThreshold, bool? blocking, RaiPolicyContentSource? source, IDictionary serializedAdditionalRawData) + { + Name = name; + Enabled = enabled; + SeverityThreshold = severityThreshold; + Blocking = blocking; + Source = source; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Name of ContentFilter. + [WirePath("name")] + public string Name { get; set; } + /// If the ContentFilter is enabled. + [WirePath("enabled")] + public bool? Enabled { get; set; } + /// Level at which content is filtered. + [WirePath("severityThreshold")] + public ContentLevel? SeverityThreshold { get; set; } + /// If blocking would occur. + [WirePath("blocking")] + public bool? Blocking { get; set; } + /// Content source to apply the Content Filters. + [WirePath("source")] + 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 000000000000..ea3f5d776dbd --- /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 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 != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _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 000000000000..c18e37f68225 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiPolicyListResult.Serialization.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + internal partial class RaiPolicyListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RaiPolicyListResult)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RaiPolicyListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RaiPolicyListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRaiPolicyListResult(document.RootElement, options); + } + + internal static RaiPolicyListResult DeserializeRaiPolicyListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string nextLink = default; + IReadOnlyList value = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + 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, options)); + } + value = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RaiPolicyListResult(nextLink, value ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(RaiPolicyListResult)} does not support writing '{options.Format}' format."); + } + } + + RaiPolicyListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeRaiPolicyListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RaiPolicyListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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 000000000000..8f64a202e64b --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiPolicyListResult.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// The list of cognitive services RaiPolicies. + internal partial class RaiPolicyListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// 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. + /// Keeps track of any properties unknown to the library. + internal RaiPolicyListResult(string nextLink, IReadOnlyList value, IDictionary serializedAdditionalRawData) + { + NextLink = nextLink; + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// 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 000000000000..42e0a82802e4 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiPolicyMode.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// Rai policy mode. The enum value mapping is as below: Default = 0, Deferred=1, Blocking=2, Asynchronous_filter =3. Please use 'Asynchronous_filter' after 2024-10-01. It is the same as 'Deferred' in previous version. + 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"; + private const string AsynchronousFilterValue = "Asynchronous_filter"; + + /// 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); + /// Asynchronous_filter. + public static RaiPolicyMode AsynchronousFilter { get; } = new RaiPolicyMode(AsynchronousFilterValue); + /// 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 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 != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 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 000000000000..63b65498e147 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiPolicyProperties.Serialization.cs @@ -0,0 +1,333 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + public partial class RaiPolicyProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RaiPolicyProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(PolicyType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(PolicyType.Value.ToString()); + } + 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(ContentFilters)) + { + writer.WritePropertyName("contentFilters"u8); + writer.WriteStartArray(); + foreach (var item in ContentFilters) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(CustomBlocklists)) + { + writer.WritePropertyName("customBlocklists"u8); + writer.WriteStartArray(); + foreach (var item in CustomBlocklists) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RaiPolicyProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RaiPolicyProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRaiPolicyProperties(document.RootElement, options); + } + + internal static RaiPolicyProperties DeserializeRaiPolicyProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + RaiPolicyType? type = default; + RaiPolicyMode? mode = default; + string basePolicyName = default; + IList contentFilters = default; + IList customBlocklists = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = 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("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, options)); + } + contentFilters = array; + continue; + } + if (property.NameEquals("customBlocklists"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(CustomBlocklistConfig.DeserializeCustomBlocklistConfig(item, options)); + } + customBlocklists = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RaiPolicyProperties( + type, + mode, + basePolicyName, + contentFilters ?? new ChangeTrackingList(), + customBlocklists ?? new ChangeTrackingList(), + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PolicyType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" type: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PolicyType)) + { + builder.Append(" type: "); + builder.AppendLine($"'{PolicyType.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Mode), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" mode: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Mode)) + { + builder.Append(" mode: "); + builder.AppendLine($"'{Mode.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(BasePolicyName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" basePolicyName: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(BasePolicyName)) + { + builder.Append(" basePolicyName: "); + if (BasePolicyName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{BasePolicyName}'''"); + } + else + { + builder.AppendLine($"'{BasePolicyName}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ContentFilters), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" contentFilters: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(ContentFilters)) + { + if (ContentFilters.Any()) + { + builder.Append(" contentFilters: "); + builder.AppendLine("["); + foreach (var item in ContentFilters) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " contentFilters: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CustomBlocklists), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" customBlocklists: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(CustomBlocklists)) + { + if (CustomBlocklists.Any()) + { + builder.Append(" customBlocklists: "); + builder.AppendLine("["); + foreach (var item in CustomBlocklists) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " customBlocklists: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(RaiPolicyProperties)} does not support writing '{options.Format}' format."); + } + } + + RaiPolicyProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeRaiPolicyProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RaiPolicyProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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 000000000000..3efc70b72022 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/RaiPolicyProperties.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// Azure OpenAI Content Filters properties. + public partial class RaiPolicyProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public RaiPolicyProperties() + { + ContentFilters = new ChangeTrackingList(); + CustomBlocklists = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Content Filters policy type. + /// Rai policy mode. The enum value mapping is as below: Default = 0, Deferred=1, Blocking=2, Asynchronous_filter =3. Please use 'Asynchronous_filter' after 2024-10-01. It is the same as 'Deferred' in previous version. + /// Name of Rai policy. + /// The list of Content Filters. + /// The list of custom Blocklist. + /// Keeps track of any properties unknown to the library. + internal RaiPolicyProperties(RaiPolicyType? policyType, RaiPolicyMode? mode, string basePolicyName, IList contentFilters, IList customBlocklists, IDictionary serializedAdditionalRawData) + { + PolicyType = policyType; + Mode = mode; + BasePolicyName = basePolicyName; + ContentFilters = contentFilters; + CustomBlocklists = customBlocklists; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Content Filters policy type. + [WirePath("type")] + public RaiPolicyType? PolicyType { get; } + /// Rai policy mode. The enum value mapping is as below: Default = 0, Deferred=1, Blocking=2, Asynchronous_filter =3. Please use 'Asynchronous_filter' after 2024-10-01. It is the same as 'Deferred' in previous version. + [WirePath("mode")] + public RaiPolicyMode? Mode { get; set; } + /// Name of Rai policy. + [WirePath("basePolicyName")] + public string BasePolicyName { get; set; } + /// The list of Content Filters. + [WirePath("contentFilters")] + public IList ContentFilters { get; } + /// The list of custom Blocklist. + [WirePath("customBlocklists")] + public IList CustomBlocklists { 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 000000000000..609d646756be --- /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 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 != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountEncryptionProperties.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountEncryptionProperties.cs index f1d51270bd68..311472300f7b 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountEncryptionProperties.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/ServiceAccountEncryptionProperties.cs @@ -43,7 +43,7 @@ public partial class ServiceAccountEncryptionProperties /// /// /// - private IDictionary _serializedAdditionalRawData; + private protected IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . public ServiceAccountEncryptionProperties() 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 000000000000..09bf904fe752 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/SkuResource.Serialization.cs @@ -0,0 +1,230 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + public partial class SkuResource : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SkuResource)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ResourceType)) + { + writer.WritePropertyName("resourceType"u8); + writer.WriteStringValue(ResourceType); + } + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + writer.WriteObjectValue(Sku, options); + } + if (Optional.IsDefined(Capacity)) + { + writer.WritePropertyName("capacity"u8); + writer.WriteObjectValue(Capacity, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SkuResource IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SkuResource)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSkuResource(document.RootElement, options); + } + + internal static SkuResource DeserializeSkuResource(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string resourceType = default; + CognitiveServicesSku sku = default; + CognitiveServicesCapacityConfig capacity = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + 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, options); + continue; + } + if (property.NameEquals("capacity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + capacity = CognitiveServicesCapacityConfig.DeserializeCognitiveServicesCapacityConfig(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SkuResource(resourceType, sku, capacity, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ResourceType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" resourceType: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ResourceType)) + { + builder.Append(" resourceType: "); + if (ResourceType.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ResourceType}'''"); + } + else + { + builder.AppendLine($"'{ResourceType}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Sku), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" sku: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Sku)) + { + builder.Append(" sku: "); + BicepSerializationHelpers.AppendChildObject(builder, Sku, options, 2, false, " sku: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Capacity), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" capacity: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Capacity)) + { + builder.Append(" capacity: "); + BicepSerializationHelpers.AppendChildObject(builder, Capacity, options, 2, false, " capacity: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(SkuResource)} does not support writing '{options.Format}' format."); + } + } + + SkuResource IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSkuResource(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SkuResource)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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 000000000000..6c921c00b608 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/SkuResource.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// Properties of Cognitive Services account resource sku resource properties. + public partial class SkuResource + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// 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. + /// Keeps track of any properties unknown to the library. + internal SkuResource(string resourceType, CognitiveServicesSku sku, CognitiveServicesCapacityConfig capacity, IDictionary serializedAdditionalRawData) + { + ResourceType = resourceType; + Sku = sku; + Capacity = capacity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource type name. + [WirePath("resourceType")] + public string ResourceType { get; } + /// The resource model definition representing SKU. + [WirePath("sku")] + public CognitiveServicesSku Sku { get; } + /// The capacity configuration. + [WirePath("capacity")] + 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 000000000000..9647df7b7465 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/UserOwnedAmlWorkspace.Serialization.cs @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + public partial class UserOwnedAmlWorkspace : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(UserOwnedAmlWorkspace)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ResourceId)) + { + writer.WritePropertyName("resourceId"u8); + writer.WriteStringValue(ResourceId); + } + if (Optional.IsDefined(IdentityClientId)) + { + writer.WritePropertyName("identityClientId"u8); + writer.WriteStringValue(IdentityClientId.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + UserOwnedAmlWorkspace IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(UserOwnedAmlWorkspace)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeUserOwnedAmlWorkspace(document.RootElement, options); + } + + internal static UserOwnedAmlWorkspace DeserializeUserOwnedAmlWorkspace(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string resourceId = default; + Guid? identityClientId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + 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; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UserOwnedAmlWorkspace(resourceId, identityClientId, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ResourceId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" resourceId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ResourceId)) + { + builder.Append(" resourceId: "); + if (ResourceId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ResourceId}'''"); + } + else + { + builder.AppendLine($"'{ResourceId}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IdentityClientId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" identityClientId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(IdentityClientId)) + { + builder.Append(" identityClientId: "); + builder.AppendLine($"'{IdentityClientId.Value.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(UserOwnedAmlWorkspace)} does not support writing '{options.Format}' format."); + } + } + + UserOwnedAmlWorkspace IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeUserOwnedAmlWorkspace(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(UserOwnedAmlWorkspace)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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 000000000000..6f557760b25a --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Models/UserOwnedAmlWorkspace.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.CognitiveServices.Models +{ + /// The user owned AML workspace for Cognitive Services account. + public partial class UserOwnedAmlWorkspace + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// 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. + /// Keeps track of any properties unknown to the library. + internal UserOwnedAmlWorkspace(string resourceId, Guid? identityClientId, IDictionary serializedAdditionalRawData) + { + ResourceId = resourceId; + IdentityClientId = identityClientId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Full resource id of a AML workspace resource. + [WirePath("resourceId")] + public string ResourceId { get; set; } + /// Identity Client id of a AML workspace resource. + [WirePath("identityClientId")] + public Guid? IdentityClientId { get; set; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/NetworkSecurityPerimeterConfigurationCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/NetworkSecurityPerimeterConfigurationCollection.cs new file mode 100644 index 000000000000..54da989ec490 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/NetworkSecurityPerimeterConfigurationCollection.cs @@ -0,0 +1,395 @@ +// 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.Core; +using Azure.Core.Pipeline; + +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 GetNetworkSecurityPerimeterConfigurations method from an instance of . + /// + public partial class NetworkSecurityPerimeterConfigurationCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _networkSecurityPerimeterConfigurationClientDiagnostics; + private readonly NetworkSecurityPerimeterConfigurationsRestOperations _networkSecurityPerimeterConfigurationRestClient; + + /// Initializes a new instance of the class for mocking. + protected NetworkSecurityPerimeterConfigurationCollection() + { + } + + /// 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 NetworkSecurityPerimeterConfigurationCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _networkSecurityPerimeterConfigurationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.CognitiveServices", NetworkSecurityPerimeterConfigurationResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(NetworkSecurityPerimeterConfigurationResource.ResourceType, out string networkSecurityPerimeterConfigurationApiVersion); + _networkSecurityPerimeterConfigurationRestClient = new NetworkSecurityPerimeterConfigurationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, networkSecurityPerimeterConfigurationApiVersion); +#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)); + } + + /// + /// Gets the specified NSP configurations for an account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/networkSecurityPerimeterConfigurations/{nspConfigurationName} + /// + /// + /// Operation Id + /// NetworkSecurityPerimeterConfigurations_Get + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the NSP Configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string nspConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(nspConfigurationName, nameof(nspConfigurationName)); + + using var scope = _networkSecurityPerimeterConfigurationClientDiagnostics.CreateScope("NetworkSecurityPerimeterConfigurationCollection.Get"); + scope.Start(); + try + { + var response = await _networkSecurityPerimeterConfigurationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, nspConfigurationName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkSecurityPerimeterConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the specified NSP configurations for an account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/networkSecurityPerimeterConfigurations/{nspConfigurationName} + /// + /// + /// Operation Id + /// NetworkSecurityPerimeterConfigurations_Get + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the NSP Configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string nspConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(nspConfigurationName, nameof(nspConfigurationName)); + + using var scope = _networkSecurityPerimeterConfigurationClientDiagnostics.CreateScope("NetworkSecurityPerimeterConfigurationCollection.Get"); + scope.Start(); + try + { + var response = _networkSecurityPerimeterConfigurationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, nspConfigurationName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkSecurityPerimeterConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a list of NSP configurations for an account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/networkSecurityPerimeterConfigurations + /// + /// + /// Operation Id + /// NetworkSecurityPerimeterConfigurations_List + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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) => _networkSecurityPerimeterConfigurationRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _networkSecurityPerimeterConfigurationRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NetworkSecurityPerimeterConfigurationResource(Client, NetworkSecurityPerimeterConfigurationData.DeserializeNetworkSecurityPerimeterConfigurationData(e)), _networkSecurityPerimeterConfigurationClientDiagnostics, Pipeline, "NetworkSecurityPerimeterConfigurationCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of NSP configurations for an account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/networkSecurityPerimeterConfigurations + /// + /// + /// Operation Id + /// NetworkSecurityPerimeterConfigurations_List + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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) => _networkSecurityPerimeterConfigurationRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _networkSecurityPerimeterConfigurationRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NetworkSecurityPerimeterConfigurationResource(Client, NetworkSecurityPerimeterConfigurationData.DeserializeNetworkSecurityPerimeterConfigurationData(e)), _networkSecurityPerimeterConfigurationClientDiagnostics, Pipeline, "NetworkSecurityPerimeterConfigurationCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/networkSecurityPerimeterConfigurations/{nspConfigurationName} + /// + /// + /// Operation Id + /// NetworkSecurityPerimeterConfigurations_Get + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the NSP Configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string nspConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(nspConfigurationName, nameof(nspConfigurationName)); + + using var scope = _networkSecurityPerimeterConfigurationClientDiagnostics.CreateScope("NetworkSecurityPerimeterConfigurationCollection.Exists"); + scope.Start(); + try + { + var response = await _networkSecurityPerimeterConfigurationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, nspConfigurationName, 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}/networkSecurityPerimeterConfigurations/{nspConfigurationName} + /// + /// + /// Operation Id + /// NetworkSecurityPerimeterConfigurations_Get + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the NSP Configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string nspConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(nspConfigurationName, nameof(nspConfigurationName)); + + using var scope = _networkSecurityPerimeterConfigurationClientDiagnostics.CreateScope("NetworkSecurityPerimeterConfigurationCollection.Exists"); + scope.Start(); + try + { + var response = _networkSecurityPerimeterConfigurationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, nspConfigurationName, 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}/networkSecurityPerimeterConfigurations/{nspConfigurationName} + /// + /// + /// Operation Id + /// NetworkSecurityPerimeterConfigurations_Get + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the NSP Configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string nspConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(nspConfigurationName, nameof(nspConfigurationName)); + + using var scope = _networkSecurityPerimeterConfigurationClientDiagnostics.CreateScope("NetworkSecurityPerimeterConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _networkSecurityPerimeterConfigurationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, nspConfigurationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkSecurityPerimeterConfigurationResource(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}/networkSecurityPerimeterConfigurations/{nspConfigurationName} + /// + /// + /// Operation Id + /// NetworkSecurityPerimeterConfigurations_Get + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the NSP Configuration. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string nspConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(nspConfigurationName, nameof(nspConfigurationName)); + + using var scope = _networkSecurityPerimeterConfigurationClientDiagnostics.CreateScope("NetworkSecurityPerimeterConfigurationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _networkSecurityPerimeterConfigurationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, nspConfigurationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NetworkSecurityPerimeterConfigurationResource(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/NetworkSecurityPerimeterConfigurationData.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/NetworkSecurityPerimeterConfigurationData.Serialization.cs new file mode 100644 index 000000000000..763042540df9 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/NetworkSecurityPerimeterConfigurationData.Serialization.cs @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.CognitiveServices.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.CognitiveServices +{ + public partial class NetworkSecurityPerimeterConfigurationData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NetworkSecurityPerimeterConfigurationData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + NetworkSecurityPerimeterConfigurationData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NetworkSecurityPerimeterConfigurationData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNetworkSecurityPerimeterConfigurationData(document.RootElement, options); + } + + internal static NetworkSecurityPerimeterConfigurationData DeserializeNetworkSecurityPerimeterConfigurationData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + NetworkSecurityPerimeterConfigurationProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = NetworkSecurityPerimeterConfigurationProperties.DeserializeNetworkSecurityPerimeterConfigurationProperties(property.Value, options); + 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; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new NetworkSecurityPerimeterConfigurationData( + id, + name, + type, + systemData, + properties, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" properties: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Properties)) + { + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(NetworkSecurityPerimeterConfigurationData)} does not support writing '{options.Format}' format."); + } + } + + NetworkSecurityPerimeterConfigurationData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeNetworkSecurityPerimeterConfigurationData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NetworkSecurityPerimeterConfigurationData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/NetworkSecurityPerimeterConfigurationData.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/NetworkSecurityPerimeterConfigurationData.cs new file mode 100644 index 000000000000..f9bd30b4903e --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/NetworkSecurityPerimeterConfigurationData.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.CognitiveServices.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.CognitiveServices +{ + /// + /// A class representing the NetworkSecurityPerimeterConfiguration data model. + /// NSP Configuration for an Cognitive Services account. + /// + public partial class NetworkSecurityPerimeterConfigurationData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public NetworkSecurityPerimeterConfigurationData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// NSP Configuration properties. + /// Keeps track of any properties unknown to the library. + internal NetworkSecurityPerimeterConfigurationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, NetworkSecurityPerimeterConfigurationProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// NSP Configuration properties. + [WirePath("properties")] + public NetworkSecurityPerimeterConfigurationProperties Properties { get; set; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/NetworkSecurityPerimeterConfigurationResource.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/NetworkSecurityPerimeterConfigurationResource.Serialization.cs new file mode 100644 index 000000000000..023b5154ab3a --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/NetworkSecurityPerimeterConfigurationResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.CognitiveServices +{ + public partial class NetworkSecurityPerimeterConfigurationResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + NetworkSecurityPerimeterConfigurationData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + NetworkSecurityPerimeterConfigurationData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/NetworkSecurityPerimeterConfigurationResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/NetworkSecurityPerimeterConfigurationResource.cs new file mode 100644 index 000000000000..24d4e3e82a90 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/NetworkSecurityPerimeterConfigurationResource.cs @@ -0,0 +1,255 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.CognitiveServices +{ + /// + /// A Class representing a NetworkSecurityPerimeterConfiguration 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 GetNetworkSecurityPerimeterConfigurationResource method. + /// Otherwise you can get one from its parent resource using the GetNetworkSecurityPerimeterConfiguration method. + /// + public partial class NetworkSecurityPerimeterConfigurationResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The accountName. + /// The nspConfigurationName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string accountName, string nspConfigurationName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/networkSecurityPerimeterConfigurations/{nspConfigurationName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _networkSecurityPerimeterConfigurationClientDiagnostics; + private readonly NetworkSecurityPerimeterConfigurationsRestOperations _networkSecurityPerimeterConfigurationRestClient; + private readonly NetworkSecurityPerimeterConfigurationData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.CognitiveServices/accounts/networkSecurityPerimeterConfigurations"; + + /// Initializes a new instance of the class for mocking. + protected NetworkSecurityPerimeterConfigurationResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal NetworkSecurityPerimeterConfigurationResource(ArmClient client, NetworkSecurityPerimeterConfigurationData 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 NetworkSecurityPerimeterConfigurationResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _networkSecurityPerimeterConfigurationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.CognitiveServices", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string networkSecurityPerimeterConfigurationApiVersion); + _networkSecurityPerimeterConfigurationRestClient = new NetworkSecurityPerimeterConfigurationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, networkSecurityPerimeterConfigurationApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// 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 NetworkSecurityPerimeterConfigurationData 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 NSP configurations for an account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/networkSecurityPerimeterConfigurations/{nspConfigurationName} + /// + /// + /// Operation Id + /// NetworkSecurityPerimeterConfigurations_Get + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _networkSecurityPerimeterConfigurationClientDiagnostics.CreateScope("NetworkSecurityPerimeterConfigurationResource.Get"); + scope.Start(); + try + { + var response = await _networkSecurityPerimeterConfigurationRestClient.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 NetworkSecurityPerimeterConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the specified NSP configurations for an account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/networkSecurityPerimeterConfigurations/{nspConfigurationName} + /// + /// + /// Operation Id + /// NetworkSecurityPerimeterConfigurations_Get + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _networkSecurityPerimeterConfigurationClientDiagnostics.CreateScope("NetworkSecurityPerimeterConfigurationResource.Get"); + scope.Start(); + try + { + var response = _networkSecurityPerimeterConfigurationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NetworkSecurityPerimeterConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Reconcile the NSP configuration for an account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/networkSecurityPerimeterConfigurations/{nspConfigurationName}/reconcile + /// + /// + /// Operation Id + /// NetworkSecurityPerimeterConfigurations_Reconcile + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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> ReconcileAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _networkSecurityPerimeterConfigurationClientDiagnostics.CreateScope("NetworkSecurityPerimeterConfigurationResource.Reconcile"); + scope.Start(); + try + { + var response = await _networkSecurityPerimeterConfigurationRestClient.ReconcileAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new CognitiveServicesArmOperation(new NetworkSecurityPerimeterConfigurationOperationSource(Client), _networkSecurityPerimeterConfigurationClientDiagnostics, Pipeline, _networkSecurityPerimeterConfigurationRestClient.CreateReconcileRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Reconcile the NSP configuration for an account. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/networkSecurityPerimeterConfigurations/{nspConfigurationName}/reconcile + /// + /// + /// Operation Id + /// NetworkSecurityPerimeterConfigurations_Reconcile + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 Reconcile(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _networkSecurityPerimeterConfigurationClientDiagnostics.CreateScope("NetworkSecurityPerimeterConfigurationResource.Reconcile"); + scope.Start(); + try + { + var response = _networkSecurityPerimeterConfigurationRestClient.Reconcile(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new CognitiveServicesArmOperation(new NetworkSecurityPerimeterConfigurationOperationSource(Client), _networkSecurityPerimeterConfigurationClientDiagnostics, Pipeline, _networkSecurityPerimeterConfigurationRestClient.CreateReconcileRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} 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 000000000000..9a5853bc4d6a --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiBlocklistCollection.cs @@ -0,0 +1,497 @@ +// 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.Core; +using Azure.Core.Pipeline; + +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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 uri = _raiBlocklistRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, raiBlocklistName, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new CognitiveServicesArmOperation(Response.FromValue(new RaiBlocklistResource(Client, response), response.GetRawResponse()), rehydrationToken); + 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 uri = _raiBlocklistRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, raiBlocklistName, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new CognitiveServicesArmOperation(Response.FromValue(new RaiBlocklistResource(Client, response), response.GetRawResponse()), rehydrationToken); + 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiBlocklistData.Serialization.cs new file mode 100644 index 000000000000..693e2b0fb795 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiBlocklistData.Serialization.cs @@ -0,0 +1,340 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.CognitiveServices.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.CognitiveServices +{ + public partial class RaiBlocklistData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RaiBlocklistData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (options.Format != "W" && Optional.IsDefined(ETag)) + { + writer.WritePropertyName("etag"u8); + writer.WriteStringValue(ETag.Value.ToString()); + } + 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, options); + } + } + + RaiBlocklistData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RaiBlocklistData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRaiBlocklistData(document.RootElement, options); + } + + internal static RaiBlocklistData DeserializeRaiBlocklistData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ETag? etag = default; + IDictionary tags = default; + RaiBlocklistProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + 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, options); + 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; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RaiBlocklistData( + id, + name, + type, + systemData, + etag, + tags ?? new ChangeTrackingDictionary(), + properties, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Tags), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" tags: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Tags)) + { + if (Tags.Any()) + { + builder.Append(" tags: "); + builder.AppendLine("{"); + foreach (var item in Tags) + { + builder.Append($" '{item.Key}': "); + if (item.Value == null) + { + builder.Append("null"); + continue; + } + if (item.Value.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{item.Value}'''"); + } + else + { + builder.AppendLine($"'{item.Value}'"); + } + } + builder.AppendLine(" }"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ETag), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" etag: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ETag)) + { + builder.Append(" etag: "); + builder.AppendLine($"'{ETag.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("RaiBlocklistDescription", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" properties: "); + builder.AppendLine("{"); + builder.Append(" description: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(Properties)) + { + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(RaiBlocklistData)} does not support writing '{options.Format}' format."); + } + } + + RaiBlocklistData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeRaiBlocklistData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RaiBlocklistData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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 000000000000..e4da2f0a5893 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiBlocklistData.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +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 + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// 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. + /// Keeps track of any properties unknown to the library. + internal RaiBlocklistData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ETag? etag, IDictionary tags, RaiBlocklistProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + ETag = etag; + Tags = tags; + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Resource Etag. + [WirePath("etag")] + public ETag? ETag { get; } + /// Resource tags. + [WirePath("tags")] + public IDictionary Tags { get; } + /// Properties of Cognitive Services RaiBlocklist. + internal RaiBlocklistProperties Properties { get; set; } + /// Description of the block list. + [WirePath("properties.description")] + 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 000000000000..d55603084eb8 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiBlocklistItemCollection.cs @@ -0,0 +1,497 @@ +// 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.Core; +using Azure.Core.Pipeline; + +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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 uri = _raiBlocklistItemRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, raiBlocklistItemName, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new CognitiveServicesArmOperation(Response.FromValue(new RaiBlocklistItemResource(Client, response), response.GetRawResponse()), rehydrationToken); + 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 uri = _raiBlocklistItemRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, raiBlocklistItemName, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new CognitiveServicesArmOperation(Response.FromValue(new RaiBlocklistItemResource(Client, response), response.GetRawResponse()), rehydrationToken); + 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiBlocklistItemData.Serialization.cs new file mode 100644 index 000000000000..9a97cb74f703 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiBlocklistItemData.Serialization.cs @@ -0,0 +1,337 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.CognitiveServices.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.CognitiveServices +{ + public partial class RaiBlocklistItemData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RaiBlocklistItemData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (options.Format != "W" && Optional.IsDefined(ETag)) + { + writer.WritePropertyName("etag"u8); + writer.WriteStringValue(ETag.Value.ToString()); + } + 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, options); + } + } + + RaiBlocklistItemData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RaiBlocklistItemData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRaiBlocklistItemData(document.RootElement, options); + } + + internal static RaiBlocklistItemData DeserializeRaiBlocklistItemData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ETag? etag = default; + IDictionary tags = default; + RaiBlocklistItemProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + 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, options); + 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; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RaiBlocklistItemData( + id, + name, + type, + systemData, + etag, + tags ?? new ChangeTrackingDictionary(), + properties, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Tags), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" tags: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Tags)) + { + if (Tags.Any()) + { + builder.Append(" tags: "); + builder.AppendLine("{"); + foreach (var item in Tags) + { + builder.Append($" '{item.Key}': "); + if (item.Value == null) + { + builder.Append("null"); + continue; + } + if (item.Value.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{item.Value}'''"); + } + else + { + builder.AppendLine($"'{item.Value}'"); + } + } + builder.AppendLine(" }"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ETag), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" etag: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ETag)) + { + builder.Append(" etag: "); + builder.AppendLine($"'{ETag.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" properties: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Properties)) + { + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(RaiBlocklistItemData)} does not support writing '{options.Format}' format."); + } + } + + RaiBlocklistItemData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeRaiBlocklistItemData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RaiBlocklistItemData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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 000000000000..07ac6f1562cb --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiBlocklistItemData.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +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 + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// 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. + /// Keeps track of any properties unknown to the library. + internal RaiBlocklistItemData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ETag? etag, IDictionary tags, RaiBlocklistItemProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + ETag = etag; + Tags = tags; + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Resource Etag. + [WirePath("etag")] + public ETag? ETag { get; } + /// Resource tags. + [WirePath("tags")] + public IDictionary Tags { get; } + /// Properties of Cognitive Services RaiBlocklist Item. + [WirePath("properties")] + public RaiBlocklistItemProperties Properties { get; set; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiBlocklistItemResource.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiBlocklistItemResource.Serialization.cs new file mode 100644 index 000000000000..20880f8ec4ab --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiBlocklistItemResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.CognitiveServices +{ + public partial class RaiBlocklistItemResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + RaiBlocklistItemData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + RaiBlocklistItemData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} 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 000000000000..93ad2f2e091b --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiBlocklistItemResource.cs @@ -0,0 +1,689 @@ +// 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.Core; +using Azure.Core.Pipeline; + +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; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.CognitiveServices/accounts/raiBlocklists/raiBlocklistItems"; + + /// 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 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 uri = _raiBlocklistItemRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new CognitiveServicesArmOperation(Response.FromValue(new RaiBlocklistItemResource(Client, response), response.GetRawResponse()), rehydrationToken); + 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 uri = _raiBlocklistItemRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new CognitiveServicesArmOperation(Response.FromValue(new RaiBlocklistItemResource(Client, response), response.GetRawResponse()), rehydrationToken); + 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiBlocklistResource.Serialization.cs new file mode 100644 index 000000000000..611eb8c88b48 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiBlocklistResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.CognitiveServices +{ + public partial class RaiBlocklistResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + RaiBlocklistData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + RaiBlocklistData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} 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 000000000000..84bf354dfadd --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiBlocklistResource.cs @@ -0,0 +1,931 @@ +// 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.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CognitiveServices.Models; + +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 ClientDiagnostics _raiBlocklistItemClientDiagnostics; + private readonly RaiBlocklistItemsRestOperations _raiBlocklistItemRestClient; + private readonly RaiBlocklistData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.CognitiveServices/accounts/raiBlocklists"; + + /// 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); + _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 + } + + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 uri = _raiBlocklistRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new CognitiveServicesArmOperation(Response.FromValue(new RaiBlocklistResource(Client, response), response.GetRawResponse()), rehydrationToken); + 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 uri = _raiBlocklistRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new CognitiveServicesArmOperation(Response.FromValue(new RaiBlocklistResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Batch operation to add blocklist items. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/addRaiBlocklistItems + /// + /// + /// Operation Id + /// RaiBlocklistItems_BatchAdd + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Properties describing the custom blocklist items. + /// The cancellation token to use. + /// is null. + public virtual async Task> BatchAddRaiBlocklistItemAsync(IEnumerable content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _raiBlocklistItemClientDiagnostics.CreateScope("RaiBlocklistResource.BatchAddRaiBlocklistItem"); + scope.Start(); + try + { + var response = await _raiBlocklistItemRestClient.BatchAddAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new RaiBlocklistResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Batch operation to add blocklist items. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/addRaiBlocklistItems + /// + /// + /// Operation Id + /// RaiBlocklistItems_BatchAdd + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Properties describing the custom blocklist items. + /// The cancellation token to use. + /// is null. + public virtual Response BatchAddRaiBlocklistItem(IEnumerable content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _raiBlocklistItemClientDiagnostics.CreateScope("RaiBlocklistResource.BatchAddRaiBlocklistItem"); + scope.Start(); + try + { + var response = _raiBlocklistItemRestClient.BatchAdd(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content, cancellationToken); + return Response.FromValue(new RaiBlocklistResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Batch operation to delete blocklist items. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/deleteRaiBlocklistItems + /// + /// + /// Operation Id + /// RaiBlocklistItems_BatchDelete + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// List of RAI Blocklist Items Names. + /// The cancellation token to use. + /// is null. + public virtual async Task BatchDeleteRaiBlocklistItemAsync(BinaryData raiBlocklistItemsNames, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(raiBlocklistItemsNames, nameof(raiBlocklistItemsNames)); + + using var scope = _raiBlocklistItemClientDiagnostics.CreateScope("RaiBlocklistResource.BatchDeleteRaiBlocklistItem"); + scope.Start(); + try + { + var response = await _raiBlocklistItemRestClient.BatchDeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, raiBlocklistItemsNames, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Batch operation to delete blocklist items. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/deleteRaiBlocklistItems + /// + /// + /// Operation Id + /// RaiBlocklistItems_BatchDelete + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// List of RAI Blocklist Items Names. + /// The cancellation token to use. + /// is null. + public virtual Response BatchDeleteRaiBlocklistItem(BinaryData raiBlocklistItemsNames, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(raiBlocklistItemsNames, nameof(raiBlocklistItemsNames)); + + using var scope = _raiBlocklistItemClientDiagnostics.CreateScope("RaiBlocklistResource.BatchDeleteRaiBlocklistItem"); + scope.Start(); + try + { + var response = _raiBlocklistItemRestClient.BatchDelete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, raiBlocklistItemsNames, cancellationToken); + return response; + } + 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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/RaiContentFilterCollection.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiContentFilterCollection.cs new file mode 100644 index 000000000000..947b30d1ece9 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiContentFilterCollection.cs @@ -0,0 +1,399 @@ +// 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.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +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 GetRaiContentFilters method from an instance of . + /// + public partial class RaiContentFilterCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _raiContentFilterClientDiagnostics; + private readonly RaiContentFiltersRestOperations _raiContentFilterRestClient; + private readonly AzureLocation _location; + + /// Initializes a new instance of the class for mocking. + protected RaiContentFilterCollection() + { + } + + /// 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. + /// Resource location. + internal RaiContentFilterCollection(ArmClient client, ResourceIdentifier id, AzureLocation location) : base(client, id) + { + _location = location; + _raiContentFilterClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.CognitiveServices", RaiContentFilterResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(RaiContentFilterResource.ResourceType, out string raiContentFilterApiVersion); + _raiContentFilterRestClient = new RaiContentFiltersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, raiContentFilterApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != SubscriptionResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, SubscriptionResource.ResourceType), nameof(id)); + } + + /// + /// Get Content Filters by Name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/raiContentFilters/{filterName} + /// + /// + /// Operation Id + /// RaiContentFilters_Get + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the RAI Content Filter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string filterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); + + using var scope = _raiContentFilterClientDiagnostics.CreateScope("RaiContentFilterCollection.Get"); + scope.Start(); + try + { + var response = await _raiContentFilterRestClient.GetAsync(Id.SubscriptionId, new AzureLocation(_location), filterName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new RaiContentFilterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get Content Filters by Name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/raiContentFilters/{filterName} + /// + /// + /// Operation Id + /// RaiContentFilters_Get + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the RAI Content Filter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string filterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); + + using var scope = _raiContentFilterClientDiagnostics.CreateScope("RaiContentFilterCollection.Get"); + scope.Start(); + try + { + var response = _raiContentFilterRestClient.Get(Id.SubscriptionId, new AzureLocation(_location), filterName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new RaiContentFilterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List Content Filters types. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/raiContentFilters + /// + /// + /// Operation Id + /// RaiContentFilters_List + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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) => _raiContentFilterRestClient.CreateListRequest(Id.SubscriptionId, new AzureLocation(_location)); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _raiContentFilterRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, new AzureLocation(_location)); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RaiContentFilterResource(Client, RaiContentFilterData.DeserializeRaiContentFilterData(e)), _raiContentFilterClientDiagnostics, Pipeline, "RaiContentFilterCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List Content Filters types. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/raiContentFilters + /// + /// + /// Operation Id + /// RaiContentFilters_List + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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) => _raiContentFilterRestClient.CreateListRequest(Id.SubscriptionId, new AzureLocation(_location)); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _raiContentFilterRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, new AzureLocation(_location)); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RaiContentFilterResource(Client, RaiContentFilterData.DeserializeRaiContentFilterData(e)), _raiContentFilterClientDiagnostics, Pipeline, "RaiContentFilterCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/raiContentFilters/{filterName} + /// + /// + /// Operation Id + /// RaiContentFilters_Get + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the RAI Content Filter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string filterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); + + using var scope = _raiContentFilterClientDiagnostics.CreateScope("RaiContentFilterCollection.Exists"); + scope.Start(); + try + { + var response = await _raiContentFilterRestClient.GetAsync(Id.SubscriptionId, new AzureLocation(_location), filterName, 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}/providers/Microsoft.CognitiveServices/locations/{location}/raiContentFilters/{filterName} + /// + /// + /// Operation Id + /// RaiContentFilters_Get + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the RAI Content Filter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string filterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); + + using var scope = _raiContentFilterClientDiagnostics.CreateScope("RaiContentFilterCollection.Exists"); + scope.Start(); + try + { + var response = _raiContentFilterRestClient.Get(Id.SubscriptionId, new AzureLocation(_location), filterName, 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}/providers/Microsoft.CognitiveServices/locations/{location}/raiContentFilters/{filterName} + /// + /// + /// Operation Id + /// RaiContentFilters_Get + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the RAI Content Filter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string filterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); + + using var scope = _raiContentFilterClientDiagnostics.CreateScope("RaiContentFilterCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _raiContentFilterRestClient.GetAsync(Id.SubscriptionId, new AzureLocation(_location), filterName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RaiContentFilterResource(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}/providers/Microsoft.CognitiveServices/locations/{location}/raiContentFilters/{filterName} + /// + /// + /// Operation Id + /// RaiContentFilters_Get + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the RAI Content Filter. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string filterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); + + using var scope = _raiContentFilterClientDiagnostics.CreateScope("RaiContentFilterCollection.GetIfExists"); + scope.Start(); + try + { + var response = _raiContentFilterRestClient.Get(Id.SubscriptionId, new AzureLocation(_location), filterName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RaiContentFilterResource(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/RaiContentFilterData.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiContentFilterData.Serialization.cs new file mode 100644 index 000000000000..610e2db72f34 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiContentFilterData.Serialization.cs @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.CognitiveServices.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.CognitiveServices +{ + public partial class RaiContentFilterData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RaiContentFilterData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + RaiContentFilterData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RaiContentFilterData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRaiContentFilterData(document.RootElement, options); + } + + internal static RaiContentFilterData DeserializeRaiContentFilterData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + RaiContentFilterProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = RaiContentFilterProperties.DeserializeRaiContentFilterProperties(property.Value, options); + 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; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RaiContentFilterData( + id, + name, + type, + systemData, + properties, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" properties: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Properties)) + { + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(RaiContentFilterData)} does not support writing '{options.Format}' format."); + } + } + + RaiContentFilterData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeRaiContentFilterData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RaiContentFilterData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiContentFilterData.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiContentFilterData.cs new file mode 100644 index 000000000000..e6a5c1b04310 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiContentFilterData.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.CognitiveServices.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.CognitiveServices +{ + /// + /// A class representing the RaiContentFilter data model. + /// Azure OpenAI Content Filter. + /// + public partial class RaiContentFilterData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public RaiContentFilterData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Azure OpenAI Content Filter Properties. + /// Keeps track of any properties unknown to the library. + internal RaiContentFilterData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, RaiContentFilterProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Azure OpenAI Content Filter Properties. + [WirePath("properties")] + public RaiContentFilterProperties Properties { get; set; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiContentFilterResource.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiContentFilterResource.Serialization.cs new file mode 100644 index 000000000000..b49ec54dc3f6 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiContentFilterResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.CognitiveServices +{ + public partial class RaiContentFilterResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + RaiContentFilterData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + RaiContentFilterData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiContentFilterResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiContentFilterResource.cs new file mode 100644 index 000000000000..978bcbe227c1 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiContentFilterResource.cs @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.CognitiveServices +{ + /// + /// A Class representing a RaiContentFilter 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 GetRaiContentFilterResource method. + /// Otherwise you can get one from its parent resource using the GetRaiContentFilter method. + /// + public partial class RaiContentFilterResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The location. + /// The filterName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation location, string filterName) + { + var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/raiContentFilters/{filterName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _raiContentFilterClientDiagnostics; + private readonly RaiContentFiltersRestOperations _raiContentFilterRestClient; + private readonly RaiContentFilterData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.CognitiveServices/locations/raiContentFilters"; + + /// Initializes a new instance of the class for mocking. + protected RaiContentFilterResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal RaiContentFilterResource(ArmClient client, RaiContentFilterData 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 RaiContentFilterResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _raiContentFilterClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.CognitiveServices", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string raiContentFilterApiVersion); + _raiContentFilterRestClient = new RaiContentFiltersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, raiContentFilterApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// 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 RaiContentFilterData 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)); + } + + /// + /// Get Content Filters by Name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/raiContentFilters/{filterName} + /// + /// + /// Operation Id + /// RaiContentFilters_Get + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _raiContentFilterClientDiagnostics.CreateScope("RaiContentFilterResource.Get"); + scope.Start(); + try + { + var response = await _raiContentFilterRestClient.GetAsync(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new RaiContentFilterResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get Content Filters by Name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/raiContentFilters/{filterName} + /// + /// + /// Operation Id + /// RaiContentFilters_Get + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _raiContentFilterClientDiagnostics.CreateScope("RaiContentFilterResource.Get"); + scope.Start(); + try + { + var response = _raiContentFilterRestClient.Get(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new RaiContentFilterResource(Client, response.Value), response.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 000000000000..7d09da46693d --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiPolicyCollection.cs @@ -0,0 +1,497 @@ +// 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.Core; +using Azure.Core.Pipeline; + +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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 uri = _raiPolicyRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, raiPolicyName, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new CognitiveServicesArmOperation(Response.FromValue(new RaiPolicyResource(Client, response), response.GetRawResponse()), rehydrationToken); + 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 uri = _raiPolicyRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, raiPolicyName, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new CognitiveServicesArmOperation(Response.FromValue(new RaiPolicyResource(Client, response), response.GetRawResponse()), rehydrationToken); + 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiPolicyData.Serialization.cs new file mode 100644 index 000000000000..02eaf542aa30 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiPolicyData.Serialization.cs @@ -0,0 +1,337 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.CognitiveServices.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.CognitiveServices +{ + public partial class RaiPolicyData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RaiPolicyData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (options.Format != "W" && Optional.IsDefined(ETag)) + { + writer.WritePropertyName("etag"u8); + writer.WriteStringValue(ETag.Value.ToString()); + } + 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, options); + } + } + + RaiPolicyData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RaiPolicyData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRaiPolicyData(document.RootElement, options); + } + + internal static RaiPolicyData DeserializeRaiPolicyData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ETag? etag = default; + IDictionary tags = default; + RaiPolicyProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + 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, options); + 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; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RaiPolicyData( + id, + name, + type, + systemData, + etag, + tags ?? new ChangeTrackingDictionary(), + properties, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Tags), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" tags: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Tags)) + { + if (Tags.Any()) + { + builder.Append(" tags: "); + builder.AppendLine("{"); + foreach (var item in Tags) + { + builder.Append($" '{item.Key}': "); + if (item.Value == null) + { + builder.Append("null"); + continue; + } + if (item.Value.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{item.Value}'''"); + } + else + { + builder.AppendLine($"'{item.Value}'"); + } + } + builder.AppendLine(" }"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ETag), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" etag: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ETag)) + { + builder.Append(" etag: "); + builder.AppendLine($"'{ETag.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" properties: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Properties)) + { + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(RaiPolicyData)} does not support writing '{options.Format}' format."); + } + } + + RaiPolicyData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeRaiPolicyData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RaiPolicyData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} 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 000000000000..a8c48d9f079b --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiPolicyData.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +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 + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// 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. + /// Keeps track of any properties unknown to the library. + internal RaiPolicyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ETag? etag, IDictionary tags, RaiPolicyProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + ETag = etag; + Tags = tags; + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Resource Etag. + [WirePath("etag")] + public ETag? ETag { get; } + /// Resource tags. + [WirePath("tags")] + public IDictionary Tags { get; } + /// Properties of Cognitive Services RaiPolicy. + [WirePath("properties")] + public RaiPolicyProperties Properties { get; set; } + } +} diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiPolicyResource.Serialization.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiPolicyResource.Serialization.cs new file mode 100644 index 000000000000..fa4d81a4cc3f --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiPolicyResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.CognitiveServices +{ + public partial class RaiPolicyResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + RaiPolicyData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + RaiPolicyData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} 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 000000000000..1efd777e2ebe --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RaiPolicyResource.cs @@ -0,0 +1,688 @@ +// 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.Core; +using Azure.Core.Pipeline; + +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; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.CognitiveServices/accounts/raiPolicies"; + + /// 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 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 uri = _raiPolicyRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new CognitiveServicesArmOperation(Response.FromValue(new RaiPolicyResource(Client, response), response.GetRawResponse()), rehydrationToken); + 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 uri = _raiPolicyRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new CognitiveServicesArmOperation(Response.FromValue(new RaiPolicyResource(Client, response), response.GetRawResponse()), rehydrationToken); + 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 + /// + /// + /// Default Api Version + /// 2024-10-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// 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 5ac809f181e1..808817db4aa9 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/AccountsRestOperations.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/AccountsRestOperations.cs @@ -32,7 +32,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 ?? "2024-10-01"; _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 fd0704d753e1..0144ac0f7a6a 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/CognitiveServicesManagementRestOperations.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/CognitiveServicesManagementRestOperations.cs @@ -32,7 +32,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 ?? "2024-10-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -213,5 +213,91 @@ public Response CheckDomainAvailability throw new RequestFailedException(message.Response); } } + + internal RequestUriBuilder CreateCalculateModelCapacityRequestUri(string subscriptionId, CalculateModelCapacityParameter calculateModelCapacityParameter) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.CognitiveServices/calculateModelCapacity", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCalculateModelCapacityRequest(string subscriptionId, CalculateModelCapacityParameter calculateModelCapacityParameter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.CognitiveServices/calculateModelCapacity", false); + 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(calculateModelCapacityParameter, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Model capacity calculator. + /// The ID of the target subscription. + /// Check Domain Availability parameter. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> CalculateModelCapacityAsync(string subscriptionId, CalculateModelCapacityParameter calculateModelCapacityParameter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(calculateModelCapacityParameter, nameof(calculateModelCapacityParameter)); + + using var message = CreateCalculateModelCapacityRequest(subscriptionId, calculateModelCapacityParameter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + CalculateModelCapacityResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = CalculateModelCapacityResult.DeserializeCalculateModelCapacityResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Model capacity calculator. + /// The ID of the target subscription. + /// Check Domain Availability parameter. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response CalculateModelCapacity(string subscriptionId, CalculateModelCapacityParameter calculateModelCapacityParameter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(calculateModelCapacityParameter, nameof(calculateModelCapacityParameter)); + + using var message = CreateCalculateModelCapacityRequest(subscriptionId, calculateModelCapacityParameter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + CalculateModelCapacityResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = CalculateModelCapacityResult.DeserializeCalculateModelCapacityResult(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/CommitmentPlansRestOperations.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/CommitmentPlansRestOperations.cs index 04f396355561..220d352a8b57 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/CommitmentPlansRestOperations.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/CommitmentPlansRestOperations.cs @@ -32,7 +32,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 ?? "2024-10-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -530,7 +530,7 @@ public Response CreateOrUpdatePlan(string subscriptionId, string resourceGroupNa } } - internal RequestUriBuilder CreateUpdatePlanRequestUri(string subscriptionId, string resourceGroupName, string commitmentPlanName, CognitiveServicesCommitmentPlanPatch patch) + internal RequestUriBuilder CreateUpdatePlanRequestUri(string subscriptionId, string resourceGroupName, string commitmentPlanName, PatchResourceTagsAndSku commitmentPlan) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -544,7 +544,7 @@ internal RequestUriBuilder CreateUpdatePlanRequestUri(string subscriptionId, str return uri; } - 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; @@ -562,7 +562,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, ModelSerializationExtensions.WireOptions); + content.JsonWriter.WriteObjectValue(commitmentPlan, ModelSerializationExtensions.WireOptions); request.Content = content; _userAgent.Apply(message); return message; @@ -572,18 +572,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) { @@ -599,18 +599,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 4c2f96e45375..2d4d956d24d1 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/CommitmentTiersRestOperations.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/CommitmentTiersRestOperations.cs @@ -32,7 +32,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 ?? "2024-10-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/DefenderForAISettingsRestOperations.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/DefenderForAISettingsRestOperations.cs new file mode 100644 index 000000000000..f47b3a5c8d8e --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/DefenderForAISettingsRestOperations.cs @@ -0,0 +1,539 @@ +// 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.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CognitiveServices.Models; + +namespace Azure.ResourceManager.CognitiveServices +{ + internal partial class DefenderForAISettingsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of DefenderForAISettingsRestOperations. + /// 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 DefenderForAISettingsRestOperations(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 ?? "2024-10-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string accountName) + { + 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("/defenderForAISettings", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + 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("/defenderForAISettings", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists the Defender for AI settings. + /// 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: + { + DefenderForAISettingResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DefenderForAISettingResult.DeserializeDefenderForAISettingResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists the Defender for AI settings. + /// 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: + { + DefenderForAISettingResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DefenderForAISettingResult.DeserializeDefenderForAISettingResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string accountName, string defenderForAISettingName) + { + 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("/defenderForAISettings/", false); + uri.AppendPath(defenderForAISettingName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string accountName, string defenderForAISettingName) + { + 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("/defenderForAISettings/", false); + uri.AppendPath(defenderForAISettingName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the specified Defender for AI setting by name. + /// 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 defender for AI setting. + /// 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 defenderForAISettingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(defenderForAISettingName, nameof(defenderForAISettingName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName, defenderForAISettingName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DefenderForAISettingData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DefenderForAISettingData.DeserializeDefenderForAISettingData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DefenderForAISettingData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the specified Defender for AI setting by name. + /// 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 defender for AI setting. + /// 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 defenderForAISettingName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(defenderForAISettingName, nameof(defenderForAISettingName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName, defenderForAISettingName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DefenderForAISettingData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DefenderForAISettingData.DeserializeDefenderForAISettingData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DefenderForAISettingData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string accountName, string defenderForAISettingName, DefenderForAISettingData data) + { + 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("/defenderForAISettings/", false); + uri.AppendPath(defenderForAISettingName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string accountName, string defenderForAISettingName, DefenderForAISettingData 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("/defenderForAISettings/", false); + uri.AppendPath(defenderForAISettingName, 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, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or Updates the specified Defender for AI setting. + /// 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 defender for AI setting. + /// Properties describing the Defender for AI setting. + /// 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 defenderForAISettingName, DefenderForAISettingData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(defenderForAISettingName, nameof(defenderForAISettingName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, accountName, defenderForAISettingName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + DefenderForAISettingData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DefenderForAISettingData.DeserializeDefenderForAISettingData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or Updates the specified Defender for AI setting. + /// 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 defender for AI setting. + /// Properties describing the Defender for AI setting. + /// 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 defenderForAISettingName, DefenderForAISettingData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(defenderForAISettingName, nameof(defenderForAISettingName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, accountName, defenderForAISettingName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + DefenderForAISettingData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DefenderForAISettingData.DeserializeDefenderForAISettingData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string accountName, string defenderForAISettingName, DefenderForAISettingData data) + { + 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("/defenderForAISettings/", false); + uri.AppendPath(defenderForAISettingName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string accountName, string defenderForAISettingName, DefenderForAISettingData data) + { + 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("/defenderForAISettings/", false); + uri.AppendPath(defenderForAISettingName, 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, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates the specified Defender for AI setting. + /// 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 defender for AI setting. + /// Properties describing the Defender for AI setting. + /// 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 defenderForAISettingName, DefenderForAISettingData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(defenderForAISettingName, nameof(defenderForAISettingName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, accountName, defenderForAISettingName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DefenderForAISettingData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DefenderForAISettingData.DeserializeDefenderForAISettingData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates the specified Defender for AI setting. + /// 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 defender for AI setting. + /// Properties describing the Defender for AI setting. + /// 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 defenderForAISettingName, DefenderForAISettingData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(defenderForAISettingName, nameof(defenderForAISettingName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, accountName, defenderForAISettingName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DefenderForAISettingData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DefenderForAISettingData.DeserializeDefenderForAISettingData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string accountName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + 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; + } + + /// Lists the Defender for AI settings. + /// 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: + { + DefenderForAISettingResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DefenderForAISettingResult.DeserializeDefenderForAISettingResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists the Defender for AI settings. + /// 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: + { + DefenderForAISettingResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DefenderForAISettingResult.DeserializeDefenderForAISettingResult(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/DeletedAccountsRestOperations.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/DeletedAccountsRestOperations.cs index edd732fd8582..776187e74cb6 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/DeletedAccountsRestOperations.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/DeletedAccountsRestOperations.cs @@ -32,7 +32,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 ?? "2024-10-01"; _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 0ca0846b627d..1b10e6dfe1a0 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/DeploymentsRestOperations.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/DeploymentsRestOperations.cs @@ -32,7 +32,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 ?? "2024-10-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -334,6 +334,106 @@ public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, } } + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string accountName, string deploymentName, PatchResourceTagsAndSku deployment) + { + 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); + return uri; + } + + 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, ModelSerializationExtensions.WireOptions); + 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 RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string accountName, string deploymentName) { var uri = new RawRequestUriBuilder(); @@ -428,6 +528,108 @@ public Response Delete(string subscriptionId, string resourceGroupName, string a } } + internal RequestUriBuilder CreateListSkusRequestUri(string subscriptionId, string resourceGroupName, string accountName, string deploymentName) + { + 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); + return uri; + } + + 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 RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string accountName) { var uri = new RawRequestUriBuilder(); @@ -511,5 +713,93 @@ public Response ListNextPage(strin throw new RequestFailedException(message.Response); } } + + internal RequestUriBuilder CreateListSkusNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string accountName, string deploymentName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + 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 000000000000..6ccff6e30311 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/EncryptionScopesRestOperations.cs @@ -0,0 +1,523 @@ +// 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.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 ?? "2024-10-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string accountName) + { + 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); + return uri; + } + + 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 RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string accountName, string encryptionScopeName) + { + 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); + return uri; + } + + 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 RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string accountName, string encryptionScopeName, EncryptionScopeData data) + { + 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); + return uri; + } + + 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, ModelSerializationExtensions.WireOptions); + 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 RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string accountName, string encryptionScopeName) + { + 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); + return uri; + } + + 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 RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string accountName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + 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/LocationBasedModelCapacitiesRestOperations.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/LocationBasedModelCapacitiesRestOperations.cs new file mode 100644 index 000000000000..238ce9d9fd99 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/LocationBasedModelCapacitiesRestOperations.cs @@ -0,0 +1,231 @@ +// 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.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CognitiveServices.Models; + +namespace Azure.ResourceManager.CognitiveServices +{ + internal partial class LocationBasedModelCapacitiesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of LocationBasedModelCapacitiesRestOperations. + /// 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 LocationBasedModelCapacitiesRestOperations(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 ?? "2024-10-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, AzureLocation location, string modelFormat, string modelName, string modelVersion) + { + 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("/modelCapacities", false); + uri.AppendQuery("api-version", _apiVersion, true); + uri.AppendQuery("modelFormat", modelFormat, true); + uri.AppendQuery("modelName", modelName, true); + uri.AppendQuery("modelVersion", modelVersion, true); + return uri; + } + + internal HttpMessage CreateListRequest(string subscriptionId, AzureLocation location, string modelFormat, string modelName, string modelVersion) + { + 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("/modelCapacities", false); + uri.AppendQuery("api-version", _apiVersion, true); + uri.AppendQuery("modelFormat", modelFormat, true); + uri.AppendQuery("modelName", modelName, true); + uri.AppendQuery("modelVersion", modelVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List Location Based ModelCapacities. + /// The ID of the target subscription. + /// Resource location. + /// The format of the Model. + /// The name of the Model. + /// The version of the Model. + /// The cancellation token to use. + /// , , or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, AzureLocation location, string modelFormat, string modelName, string modelVersion, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(modelFormat, nameof(modelFormat)); + Argument.AssertNotNull(modelName, nameof(modelName)); + Argument.AssertNotNull(modelVersion, nameof(modelVersion)); + + using var message = CreateListRequest(subscriptionId, location, modelFormat, modelName, modelVersion); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ModelCapacityListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ModelCapacityListResult.DeserializeModelCapacityListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Location Based ModelCapacities. + /// The ID of the target subscription. + /// Resource location. + /// The format of the Model. + /// The name of the Model. + /// The version of the Model. + /// The cancellation token to use. + /// , , or is null. + /// is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, AzureLocation location, string modelFormat, string modelName, string modelVersion, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(modelFormat, nameof(modelFormat)); + Argument.AssertNotNull(modelName, nameof(modelName)); + Argument.AssertNotNull(modelVersion, nameof(modelVersion)); + + using var message = CreateListRequest(subscriptionId, location, modelFormat, modelName, modelVersion); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ModelCapacityListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ModelCapacityListResult.DeserializeModelCapacityListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, AzureLocation location, string modelFormat, string modelName, string modelVersion) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, AzureLocation location, string modelFormat, string modelName, string modelVersion) + { + 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; + } + + /// List Location Based ModelCapacities. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// Resource location. + /// The format of the Model. + /// The name of the Model. + /// The version of the Model. + /// The cancellation token to use. + /// , , , or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, AzureLocation location, string modelFormat, string modelName, string modelVersion, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(modelFormat, nameof(modelFormat)); + Argument.AssertNotNull(modelName, nameof(modelName)); + Argument.AssertNotNull(modelVersion, nameof(modelVersion)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, location, modelFormat, modelName, modelVersion); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ModelCapacityListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ModelCapacityListResult.DeserializeModelCapacityListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Location Based ModelCapacities. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// Resource location. + /// The format of the Model. + /// The name of the Model. + /// The version of the Model. + /// The cancellation token to use. + /// , , , or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, AzureLocation location, string modelFormat, string modelName, string modelVersion, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(modelFormat, nameof(modelFormat)); + Argument.AssertNotNull(modelName, nameof(modelName)); + Argument.AssertNotNull(modelVersion, nameof(modelVersion)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, location, modelFormat, modelName, modelVersion); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ModelCapacityListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ModelCapacityListResult.DeserializeModelCapacityListResult(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/ModelCapacitiesRestOperations.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/ModelCapacitiesRestOperations.cs new file mode 100644 index 000000000000..caa94c57de1f --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/ModelCapacitiesRestOperations.cs @@ -0,0 +1,223 @@ +// 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.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CognitiveServices.Models; + +namespace Azure.ResourceManager.CognitiveServices +{ + internal partial class ModelCapacitiesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ModelCapacitiesRestOperations. + /// 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 ModelCapacitiesRestOperations(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 ?? "2024-10-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string modelFormat, string modelName, string modelVersion) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.CognitiveServices/modelCapacities", false); + uri.AppendQuery("api-version", _apiVersion, true); + uri.AppendQuery("modelFormat", modelFormat, true); + uri.AppendQuery("modelName", modelName, true); + uri.AppendQuery("modelVersion", modelVersion, true); + return uri; + } + + internal HttpMessage CreateListRequest(string subscriptionId, string modelFormat, string modelName, string modelVersion) + { + 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/modelCapacities", false); + uri.AppendQuery("api-version", _apiVersion, true); + uri.AppendQuery("modelFormat", modelFormat, true); + uri.AppendQuery("modelName", modelName, true); + uri.AppendQuery("modelVersion", modelVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List ModelCapacities. + /// The ID of the target subscription. + /// The format of the Model. + /// The name of the Model. + /// The version of the Model. + /// The cancellation token to use. + /// , , or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string modelFormat, string modelName, string modelVersion, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(modelFormat, nameof(modelFormat)); + Argument.AssertNotNull(modelName, nameof(modelName)); + Argument.AssertNotNull(modelVersion, nameof(modelVersion)); + + using var message = CreateListRequest(subscriptionId, modelFormat, modelName, modelVersion); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ModelCapacityListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ModelCapacityListResult.DeserializeModelCapacityListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List ModelCapacities. + /// The ID of the target subscription. + /// The format of the Model. + /// The name of the Model. + /// The version of the Model. + /// The cancellation token to use. + /// , , or is null. + /// is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string modelFormat, string modelName, string modelVersion, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(modelFormat, nameof(modelFormat)); + Argument.AssertNotNull(modelName, nameof(modelName)); + Argument.AssertNotNull(modelVersion, nameof(modelVersion)); + + using var message = CreateListRequest(subscriptionId, modelFormat, modelName, modelVersion); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ModelCapacityListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ModelCapacityListResult.DeserializeModelCapacityListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string modelFormat, string modelName, string modelVersion) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string modelFormat, string modelName, string modelVersion) + { + 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; + } + + /// List ModelCapacities. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The format of the Model. + /// The name of the Model. + /// The version of the Model. + /// The cancellation token to use. + /// , , , or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string modelFormat, string modelName, string modelVersion, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(modelFormat, nameof(modelFormat)); + Argument.AssertNotNull(modelName, nameof(modelName)); + Argument.AssertNotNull(modelVersion, nameof(modelVersion)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, modelFormat, modelName, modelVersion); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ModelCapacityListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ModelCapacityListResult.DeserializeModelCapacityListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List ModelCapacities. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The format of the Model. + /// The name of the Model. + /// The version of the Model. + /// The cancellation token to use. + /// , , , or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string modelFormat, string modelName, string modelVersion, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(modelFormat, nameof(modelFormat)); + Argument.AssertNotNull(modelName, nameof(modelName)); + Argument.AssertNotNull(modelVersion, nameof(modelVersion)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, modelFormat, modelName, modelVersion); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ModelCapacityListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ModelCapacityListResult.DeserializeModelCapacityListResult(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 4cfcc8c7eaee..50c9930e37e0 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/ModelsRestOperations.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/ModelsRestOperations.cs @@ -32,7 +32,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 ?? "2024-10-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/NetworkSecurityPerimeterConfigurationsRestOperations.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/NetworkSecurityPerimeterConfigurationsRestOperations.cs new file mode 100644 index 000000000000..be6b48a9d43e --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/NetworkSecurityPerimeterConfigurationsRestOperations.cs @@ -0,0 +1,415 @@ +// 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.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.CognitiveServices.Models; + +namespace Azure.ResourceManager.CognitiveServices +{ + internal partial class NetworkSecurityPerimeterConfigurationsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of NetworkSecurityPerimeterConfigurationsRestOperations. + /// 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 NetworkSecurityPerimeterConfigurationsRestOperations(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 ?? "2024-10-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string accountName) + { + 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("/networkSecurityPerimeterConfigurations", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + 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("/networkSecurityPerimeterConfigurations", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a list of NSP configurations for an 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: + { + NetworkSecurityPerimeterConfigurationList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkSecurityPerimeterConfigurationList.DeserializeNetworkSecurityPerimeterConfigurationList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a list of NSP configurations for an 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: + { + NetworkSecurityPerimeterConfigurationList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkSecurityPerimeterConfigurationList.DeserializeNetworkSecurityPerimeterConfigurationList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string accountName, string nspConfigurationName) + { + 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("/networkSecurityPerimeterConfigurations/", false); + uri.AppendPath(nspConfigurationName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string accountName, string nspConfigurationName) + { + 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("/networkSecurityPerimeterConfigurations/", false); + uri.AppendPath(nspConfigurationName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the specified NSP configurations for an 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 NSP Configuration. + /// 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 nspConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(nspConfigurationName, nameof(nspConfigurationName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName, nspConfigurationName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NetworkSecurityPerimeterConfigurationData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkSecurityPerimeterConfigurationData.DeserializeNetworkSecurityPerimeterConfigurationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((NetworkSecurityPerimeterConfigurationData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the specified NSP configurations for an 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 NSP Configuration. + /// 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 nspConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(nspConfigurationName, nameof(nspConfigurationName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, accountName, nspConfigurationName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NetworkSecurityPerimeterConfigurationData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkSecurityPerimeterConfigurationData.DeserializeNetworkSecurityPerimeterConfigurationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((NetworkSecurityPerimeterConfigurationData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateReconcileRequestUri(string subscriptionId, string resourceGroupName, string accountName, string nspConfigurationName) + { + 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("/networkSecurityPerimeterConfigurations/", false); + uri.AppendPath(nspConfigurationName, true); + uri.AppendPath("/reconcile", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateReconcileRequest(string subscriptionId, string resourceGroupName, string accountName, string nspConfigurationName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + 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("/networkSecurityPerimeterConfigurations/", false); + uri.AppendPath(nspConfigurationName, true); + uri.AppendPath("/reconcile", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Reconcile the NSP configuration for an 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 NSP Configuration. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task ReconcileAsync(string subscriptionId, string resourceGroupName, string accountName, string nspConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(nspConfigurationName, nameof(nspConfigurationName)); + + using var message = CreateReconcileRequest(subscriptionId, resourceGroupName, accountName, nspConfigurationName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Reconcile the NSP configuration for an 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 NSP Configuration. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Reconcile(string subscriptionId, string resourceGroupName, string accountName, string nspConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(accountName, nameof(accountName)); + Argument.AssertNotNullOrEmpty(nspConfigurationName, nameof(nspConfigurationName)); + + using var message = CreateReconcileRequest(subscriptionId, resourceGroupName, accountName, nspConfigurationName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string accountName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + 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 a list of NSP configurations for an 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: + { + NetworkSecurityPerimeterConfigurationList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NetworkSecurityPerimeterConfigurationList.DeserializeNetworkSecurityPerimeterConfigurationList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a list of NSP configurations for an 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: + { + NetworkSecurityPerimeterConfigurationList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NetworkSecurityPerimeterConfigurationList.DeserializeNetworkSecurityPerimeterConfigurationList(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/PrivateEndpointConnectionsRestOperations.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs index 355fb789c38e..722d95c5d663 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs @@ -32,7 +32,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 ?? "2024-10-01"; _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 e03e51f8409c..fdb41fd25e03 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs @@ -32,7 +32,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 ?? "2024-10-01"; _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 000000000000..821cdc0847a7 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/RaiBlocklistItemsRestOperations.cs @@ -0,0 +1,782 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +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 ?? "2024-10-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName) + { + 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); + return uri; + } + + 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 RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName, string raiBlocklistItemName) + { + 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); + return uri; + } + + 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 RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName, string raiBlocklistItemName, RaiBlocklistItemData data) + { + 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); + return uri; + } + + 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, ModelSerializationExtensions.WireOptions); + 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 RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName, string raiBlocklistItemName) + { + 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); + return uri; + } + + 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 RequestUriBuilder CreateBatchAddRequestUri(string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName, IEnumerable content) + { + 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("/addRaiBlocklistItems", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateBatchAddRequest(string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName, IEnumerable content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + 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("/addRaiBlocklistItems", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteStartArray(); + foreach (var item in content) + { + content0.JsonWriter.WriteObjectValue(item, ModelSerializationExtensions.WireOptions); + } + content0.JsonWriter.WriteEndArray(); + request.Content = content0; + _userAgent.Apply(message); + return message; + } + + /// Batch operation to add blocklist items. + /// 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 items. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> BatchAddAsync(string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName, IEnumerable content, 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(content, nameof(content)); + + using var message = CreateBatchAddRequest(subscriptionId, resourceGroupName, accountName, raiBlocklistName, content); + 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); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Batch operation to add blocklist items. + /// 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 items. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response BatchAdd(string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName, IEnumerable content, 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(content, nameof(content)); + + using var message = CreateBatchAddRequest(subscriptionId, resourceGroupName, accountName, raiBlocklistName, content); + _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); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateBatchDeleteRequestUri(string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName, BinaryData raiBlocklistItemsNames) + { + 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("/deleteRaiBlocklistItems", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateBatchDeleteRequest(string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName, BinaryData raiBlocklistItemsNames) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + 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("/deleteRaiBlocklistItems", false); + 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(); +#if NET6_0_OR_GREATER + content.JsonWriter.WriteRawValue(raiBlocklistItemsNames); +#else + using (JsonDocument document = JsonDocument.Parse(raiBlocklistItemsNames)) + { + JsonSerializer.Serialize(content.JsonWriter, document.RootElement); + } +#endif + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Batch operation to delete blocklist items. + /// 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. + /// List of RAI Blocklist Items Names. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task BatchDeleteAsync(string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName, BinaryData raiBlocklistItemsNames, 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(raiBlocklistItemsNames, nameof(raiBlocklistItemsNames)); + + using var message = CreateBatchDeleteRequest(subscriptionId, resourceGroupName, accountName, raiBlocklistName, raiBlocklistItemsNames); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Batch operation to delete blocklist items. + /// 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. + /// List of RAI Blocklist Items Names. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response BatchDelete(string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName, BinaryData raiBlocklistItemsNames, 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(raiBlocklistItemsNames, nameof(raiBlocklistItemsNames)); + + using var message = CreateBatchDeleteRequest(subscriptionId, resourceGroupName, accountName, raiBlocklistName, raiBlocklistItemsNames); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + 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 000000000000..cc20b511d0d7 --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/RaiBlocklistsRestOperations.cs @@ -0,0 +1,523 @@ +// 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.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 ?? "2024-10-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string accountName) + { + 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); + return uri; + } + + 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 RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName) + { + 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); + return uri; + } + + 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 RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName, RaiBlocklistData data) + { + 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); + return uri; + } + + 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, ModelSerializationExtensions.WireOptions); + 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 RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string accountName, string raiBlocklistName) + { + 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); + return uri; + } + + 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 RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string accountName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + 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 000000000000..7b09ab5d834b --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/RaiContentFiltersRestOperations.cs @@ -0,0 +1,295 @@ +// 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.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 ?? "2024-10-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, AzureLocation location) + { + 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); + return uri; + } + + 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); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, AzureLocation location, string filterName) + { + 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.AppendPath(filterName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, AzureLocation location, string filterName) + { + 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.AppendPath(filterName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get Content Filters by Name. + /// The ID of the target subscription. + /// Resource location. + /// The name of the RAI Content Filter. + /// 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, AzureLocation location, string filterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); + + using var message = CreateGetRequest(subscriptionId, location, filterName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + RaiContentFilterData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RaiContentFilterData.DeserializeRaiContentFilterData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((RaiContentFilterData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get Content Filters by Name. + /// The ID of the target subscription. + /// Resource location. + /// The name of the RAI Content Filter. + /// 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, AzureLocation location, string filterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); + + using var message = CreateGetRequest(subscriptionId, location, filterName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + RaiContentFilterData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RaiContentFilterData.DeserializeRaiContentFilterData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((RaiContentFilterData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, AzureLocation location) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, AzureLocation location) + { + 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; + } + + /// List Content Filters types. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// Resource location. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListNextPageRequest(nextLink, 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 URL to the next page of results. + /// The ID of the target subscription. + /// Resource location. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListNextPageRequest(nextLink, 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 000000000000..5028cfb9d1dd --- /dev/null +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/RaiPoliciesRestOperations.cs @@ -0,0 +1,523 @@ +// 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.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 ?? "2024-10-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string accountName) + { + 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); + return uri; + } + + 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 RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string accountName, string raiPolicyName) + { + 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); + return uri; + } + + 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 RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string accountName, string raiPolicyName, RaiPolicyData data) + { + 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); + return uri; + } + + 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, ModelSerializationExtensions.WireOptions); + 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 RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string accountName, string raiPolicyName) + { + 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); + return uri; + } + + 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 RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string accountName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + 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 3f7f074d2f6d..30ef1b2fb110 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/ResourceSkusRestOperations.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/ResourceSkusRestOperations.cs @@ -32,7 +32,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 ?? "2024-10-01"; _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 632e3c0630a9..8b0d64deeafc 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/UsagesRestOperations.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/RestOperations/UsagesRestOperations.cs @@ -32,7 +32,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 ?? "2024-10-01"; _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 f284b103ac21..97564b1cb641 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: diff --git a/sdk/cognitiveservices/ci.mgmt.yml b/sdk/cognitiveservices/ci.mgmt.yml index ddeb32b868ce..79dda70912e2 100644 --- a/sdk/cognitiveservices/ci.mgmt.yml +++ b/sdk/cognitiveservices/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/cognitiveservices/ci.mgmt.yml - sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/cognitiveservices/ci.mgmt.yml + - sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/communication/ci.mgmt.yml b/sdk/communication/ci.mgmt.yml index 8fc73e107745..be0c8b4b5903 100644 --- a/sdk/communication/ci.mgmt.yml +++ b/sdk/communication/ci.mgmt.yml @@ -1,5 +1,6 @@ trigger: none + pr: branches: include: @@ -12,6 +13,18 @@ pr: - sdk/communication/ci.mgmt.yml - sdk/communication/Azure.ResourceManager.Communication/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/communication/ci.mgmt.yml + - sdk/communication/Azure.ResourceManager.Communication/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/compute/ci.mgmt.yml b/sdk/compute/ci.mgmt.yml index d9520f58d12c..9736fea82d63 100644 --- a/sdk/compute/ci.mgmt.yml +++ b/sdk/compute/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/compute/ci.mgmt.yml - sdk/compute/Azure.ResourceManager.Compute/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/compute/ci.mgmt.yml + - sdk/compute/Azure.ResourceManager.Compute/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/computefleet/ci.mgmt.yml b/sdk/computefleet/ci.mgmt.yml index de169e18c599..58fc15347c98 100644 --- a/sdk/computefleet/ci.mgmt.yml +++ b/sdk/computefleet/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/computefleet/ci.mgmt.yml - sdk/computefleet/Azure.ResourceManager.ComputeFleet/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/computefleet/ci.mgmt.yml + - sdk/computefleet/Azure.ResourceManager.ComputeFleet/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/computeschedule/ci.mgmt.yml b/sdk/computeschedule/ci.mgmt.yml index d3a367f82551..01d026ef37ea 100644 --- a/sdk/computeschedule/ci.mgmt.yml +++ b/sdk/computeschedule/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/computeschedule/ci.mgmt.yml - sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/computeschedule/ci.mgmt.yml + - sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/confidentialledger/ci.mgmt.yml b/sdk/confidentialledger/ci.mgmt.yml index 7343d843f2ee..b61c498ed14a 100644 --- a/sdk/confidentialledger/ci.mgmt.yml +++ b/sdk/confidentialledger/ci.mgmt.yml @@ -1,5 +1,6 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -12,6 +13,18 @@ pr: - sdk/confidentialledger/ci.mgmt.yml - sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/confidentialledger/ci.mgmt.yml + - sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/confluent/ci.mgmt.yml b/sdk/confluent/ci.mgmt.yml index 12d37aa41bd2..757508d306f9 100644 --- a/sdk/confluent/ci.mgmt.yml +++ b/sdk/confluent/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/confluent/ci.mgmt.yml - sdk/confluent/Azure.ResourceManager.Confluent/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/confluent/ci.mgmt.yml + - sdk/confluent/Azure.ResourceManager.Confluent/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/connectedvmwarevsphere/ci.mgmt.yml b/sdk/connectedvmwarevsphere/ci.mgmt.yml index a9d0db85cf82..f8990a206c45 100644 --- a/sdk/connectedvmwarevsphere/ci.mgmt.yml +++ b/sdk/connectedvmwarevsphere/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/connectedvmwarevsphere/ci.mgmt.yml - sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/connectedvmwarevsphere/ci.mgmt.yml + - sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/consumption/ci.mgmt.yml b/sdk/consumption/ci.mgmt.yml index 6b0ebe2b2fa7..ccda85ce5789 100644 --- a/sdk/consumption/ci.mgmt.yml +++ b/sdk/consumption/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/consumption/ci.mgmt.yml - sdk/consumption/Azure.ResourceManager.Consumption/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/consumption/ci.mgmt.yml + - sdk/consumption/Azure.ResourceManager.Consumption/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/containerapps/ci.mgmt.yml b/sdk/containerapps/ci.mgmt.yml index 7715d499fa59..69564e2f1920 100644 --- a/sdk/containerapps/ci.mgmt.yml +++ b/sdk/containerapps/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/containerapps/ci.mgmt.yml - sdk/containerapps/Azure.ResourceManager.AppContainers/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/containerapps/ci.mgmt.yml + - sdk/containerapps/Azure.ResourceManager.AppContainers/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/containerinstance/ci.mgmt.yml b/sdk/containerinstance/ci.mgmt.yml index 0b4d90bf6d1c..865705313c2c 100644 --- a/sdk/containerinstance/ci.mgmt.yml +++ b/sdk/containerinstance/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/containerinstance/ci.mgmt.yml - sdk/containerinstance/Azure.ResourceManager.ContainerInstance/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/containerinstance/ci.mgmt.yml + - sdk/containerinstance/Azure.ResourceManager.ContainerInstance/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/containerorchestratorruntime/ci.mgmt.yml b/sdk/containerorchestratorruntime/ci.mgmt.yml index 0a036386143b..98ade1bcf8c6 100644 --- a/sdk/containerorchestratorruntime/ci.mgmt.yml +++ b/sdk/containerorchestratorruntime/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/containerorchestratorruntime/ci.mgmt.yml - sdk/containerorchestratorruntime/Azure.ResourceManager.ContainerOrchestratorRuntime/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/containerorchestratorruntime/ci.mgmt.yml + - sdk/containerorchestratorruntime/Azure.ResourceManager.ContainerOrchestratorRuntime/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/containerregistry/ci.mgmt.yml b/sdk/containerregistry/ci.mgmt.yml index e3f0cfb5bfa5..5fa9fce02790 100644 --- a/sdk/containerregistry/ci.mgmt.yml +++ b/sdk/containerregistry/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/containerregistry/ci.mgmt.yml - sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/containerregistry/ci.mgmt.yml + - sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/containerservice/ci.mgmt.yml b/sdk/containerservice/ci.mgmt.yml index 9eb58047b02e..8eb615e701f7 100644 --- a/sdk/containerservice/ci.mgmt.yml +++ b/sdk/containerservice/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/containerservice/ci.mgmt.yml - sdk/containerservice/Azure.ResourceManager.ContainerService/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/containerservice/ci.mgmt.yml + - sdk/containerservice/Azure.ResourceManager.ContainerService/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/cosmosdb/ci.mgmt.yml b/sdk/cosmosdb/ci.mgmt.yml index 1eab24b3bbf9..ac1fce954c2a 100644 --- a/sdk/cosmosdb/ci.mgmt.yml +++ b/sdk/cosmosdb/ci.mgmt.yml @@ -2,6 +2,7 @@ # This file is generated automatically and any changes will be lost. trigger: none + pr: branches: include: @@ -14,6 +15,18 @@ pr: - sdk/cosmosdb/ci.mgmt.yml - sdk/cosmosdb/Azure.ResourceManager.CosmosDB/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/cosmosdb/ci.mgmt.yml + - sdk/cosmosdb/Azure.ResourceManager.CosmosDB/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/cosmosdbforpostgresql/ci.mgmt.yml b/sdk/cosmosdbforpostgresql/ci.mgmt.yml index ef6098c3999f..bfe2761181a8 100644 --- a/sdk/cosmosdbforpostgresql/ci.mgmt.yml +++ b/sdk/cosmosdbforpostgresql/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/cosmosdbforpostgresql/ci.mgmt.yml - sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/cosmosdbforpostgresql/ci.mgmt.yml + - sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/costmanagement/ci.mgmt.yml b/sdk/costmanagement/ci.mgmt.yml index e59280ba6be2..cee9459831fb 100644 --- a/sdk/costmanagement/ci.mgmt.yml +++ b/sdk/costmanagement/ci.mgmt.yml @@ -2,6 +2,7 @@ # This file is generated automatically and any changes will be lost. trigger: none + pr: branches: include: @@ -14,6 +15,18 @@ pr: - sdk/costmanagement/ci.mgmt.yml - sdk/costmanagement/Azure.ResourceManager.CostManagement/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/costmanagement/ci.mgmt.yml + - sdk/costmanagement/Azure.ResourceManager.CostManagement/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/customer-insights/ci.mgmt.yml b/sdk/customer-insights/ci.mgmt.yml index 124af418dcfa..a5d4f1a60cb5 100644 --- a/sdk/customer-insights/ci.mgmt.yml +++ b/sdk/customer-insights/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/customer-insights/ci.mgmt.yml - sdk/customer-insights/Azure.ResourceManager.CustomerInsights/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/customer-insights/ci.mgmt.yml + - sdk/customer-insights/Azure.ResourceManager.CustomerInsights/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/databox/ci.mgmt.yml b/sdk/databox/ci.mgmt.yml index edd63a701700..6525b0b436cc 100644 --- a/sdk/databox/ci.mgmt.yml +++ b/sdk/databox/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/databox/ci.mgmt.yml - sdk/databox/Azure.ResourceManager.DataBox/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/databox/ci.mgmt.yml + - sdk/databox/Azure.ResourceManager.DataBox/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/databoxedge/ci.mgmt.yml b/sdk/databoxedge/ci.mgmt.yml index 29e3b1537c78..3cf952bd82f3 100644 --- a/sdk/databoxedge/ci.mgmt.yml +++ b/sdk/databoxedge/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/databoxedge/ci.mgmt.yml - sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/databoxedge/ci.mgmt.yml + - sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/datadog/ci.mgmt.yml b/sdk/datadog/ci.mgmt.yml index 9e9d6825d8b0..c1b66f6edb09 100644 --- a/sdk/datadog/ci.mgmt.yml +++ b/sdk/datadog/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/datadog/ci.mgmt.yml - sdk/datadog/Azure.ResourceManager.Datadog/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/datadog/ci.mgmt.yml + - sdk/datadog/Azure.ResourceManager.Datadog/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/datafactory/ci.mgmt.yml b/sdk/datafactory/ci.mgmt.yml index 85d246a5d4e7..1f1a4ba295cd 100644 --- a/sdk/datafactory/ci.mgmt.yml +++ b/sdk/datafactory/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/datafactory/ci.mgmt.yml - sdk/datafactory/Azure.ResourceManager.DataFactory/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/datafactory/ci.mgmt.yml + - sdk/datafactory/Azure.ResourceManager.DataFactory/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/datalake-analytics/ci.mgmt.yml b/sdk/datalake-analytics/ci.mgmt.yml index b8794cd18f9e..44823b2f9444 100644 --- a/sdk/datalake-analytics/ci.mgmt.yml +++ b/sdk/datalake-analytics/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/datalake-analytics/ci.mgmt.yml - sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/datalake-analytics/ci.mgmt.yml + - sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/datalake-store/ci.mgmt.yml b/sdk/datalake-store/ci.mgmt.yml index 469839fd3024..27295ad1c28c 100644 --- a/sdk/datalake-store/ci.mgmt.yml +++ b/sdk/datalake-store/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/datalake-store/ci.mgmt.yml - sdk/datalake-store/Azure.ResourceManager.DataLakeStore/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/datalake-store/ci.mgmt.yml + - sdk/datalake-store/Azure.ResourceManager.DataLakeStore/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/datamigration/ci.mgmt.yml b/sdk/datamigration/ci.mgmt.yml index 1e64024fed17..f26452e1de48 100644 --- a/sdk/datamigration/ci.mgmt.yml +++ b/sdk/datamigration/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/datamigration/ci.mgmt.yml - sdk/datamigration/Azure.ResourceManager.DataMigration/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/datamigration/ci.mgmt.yml + - sdk/datamigration/Azure.ResourceManager.DataMigration/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/dataprotection/ci.mgmt.yml b/sdk/dataprotection/ci.mgmt.yml index 25637090aedb..0b74e9436cc7 100644 --- a/sdk/dataprotection/ci.mgmt.yml +++ b/sdk/dataprotection/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/dataprotection/ci.mgmt.yml - sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/dataprotection/ci.mgmt.yml + - sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/datashare/ci.mgmt.yml b/sdk/datashare/ci.mgmt.yml index f6dd41e0f37f..dcb3801e3f58 100644 --- a/sdk/datashare/ci.mgmt.yml +++ b/sdk/datashare/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/datashare/ci.mgmt.yml - sdk/datashare/Azure.ResourceManager.DataShare/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/datashare/ci.mgmt.yml + - sdk/datashare/Azure.ResourceManager.DataShare/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/defendereasm/ci.mgmt.yml b/sdk/defendereasm/ci.mgmt.yml index dd90e5a46690..2dc5c04ec007 100644 --- a/sdk/defendereasm/ci.mgmt.yml +++ b/sdk/defendereasm/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/defendereasm/ci.mgmt.yml - sdk/defendereasm/Azure.ResourceManager.DefenderEasm/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/defendereasm/ci.mgmt.yml + - sdk/defendereasm/Azure.ResourceManager.DefenderEasm/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/desktopvirtualization/ci.mgmt.yml b/sdk/desktopvirtualization/ci.mgmt.yml index 3d6f40025c77..b6af32cc15c3 100644 --- a/sdk/desktopvirtualization/ci.mgmt.yml +++ b/sdk/desktopvirtualization/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/desktopvirtualization/ci.mgmt.yml - sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/desktopvirtualization/ci.mgmt.yml + - sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/devcenter/ci.mgmt.yml b/sdk/devcenter/ci.mgmt.yml index 136d77bbba6d..cfa8320239dd 100644 --- a/sdk/devcenter/ci.mgmt.yml +++ b/sdk/devcenter/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/devcenter/ci.mgmt.yml - sdk/devcenter/Azure.ResourceManager.DevCenter/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/devcenter/ci.mgmt.yml + - sdk/devcenter/Azure.ResourceManager.DevCenter/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/deviceprovisioningservices/ci.mgmt.yml b/sdk/deviceprovisioningservices/ci.mgmt.yml index f9c94973a324..733989d927dc 100644 --- a/sdk/deviceprovisioningservices/ci.mgmt.yml +++ b/sdk/deviceprovisioningservices/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/deviceprovisioningservices/ci.mgmt.yml - sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/deviceprovisioningservices/ci.mgmt.yml + - sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/deviceregistry/ci.mgmt.yml b/sdk/deviceregistry/ci.mgmt.yml index 05fffe301114..271e718d8676 100644 --- a/sdk/deviceregistry/ci.mgmt.yml +++ b/sdk/deviceregistry/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/deviceregistry/ci.mgmt.yml - sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/deviceregistry/ci.mgmt.yml + - sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/deviceupdate/ci.mgmt.yml b/sdk/deviceupdate/ci.mgmt.yml index c1315e462bb9..d8abd00a2256 100644 --- a/sdk/deviceupdate/ci.mgmt.yml +++ b/sdk/deviceupdate/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/deviceupdate/ci.mgmt.yml - sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/deviceupdate/ci.mgmt.yml + - sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/devopsinfrastructure/ci.mgmt.yml b/sdk/devopsinfrastructure/ci.mgmt.yml index 0f2db1225cf0..8e463b9f3794 100644 --- a/sdk/devopsinfrastructure/ci.mgmt.yml +++ b/sdk/devopsinfrastructure/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/devopsinfrastructure/ci.mgmt.yml - sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/devopsinfrastructure/ci.mgmt.yml + - sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/devspaces/ci.mgmt.yml b/sdk/devspaces/ci.mgmt.yml index b63234a64555..248d3c3143f0 100644 --- a/sdk/devspaces/ci.mgmt.yml +++ b/sdk/devspaces/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/devspaces/ci.mgmt.yml - sdk/devspaces/Azure.ResourceManager.DevSpaces/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/devspaces/ci.mgmt.yml + - sdk/devspaces/Azure.ResourceManager.DevSpaces/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/devtestlabs/ci.mgmt.yml b/sdk/devtestlabs/ci.mgmt.yml index 1946409a6b75..7ee994de378b 100644 --- a/sdk/devtestlabs/ci.mgmt.yml +++ b/sdk/devtestlabs/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/devtestlabs/ci.mgmt.yml - sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/devtestlabs/ci.mgmt.yml + - sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/digitaltwins/ci.mgmt.yml b/sdk/digitaltwins/ci.mgmt.yml index a0e8233a36cf..a8766e215b7c 100644 --- a/sdk/digitaltwins/ci.mgmt.yml +++ b/sdk/digitaltwins/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/digitaltwins/ci.mgmt.yml - sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/digitaltwins/ci.mgmt.yml + - sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/dns/ci.mgmt.yml b/sdk/dns/ci.mgmt.yml index 8357809b4e6f..ec6edfb21775 100644 --- a/sdk/dns/ci.mgmt.yml +++ b/sdk/dns/ci.mgmt.yml @@ -2,6 +2,7 @@ # This file is generated automatically and any changes will be lost. trigger: none + pr: branches: include: @@ -14,6 +15,18 @@ pr: - sdk/dns/ci.mgmt.yml - sdk/dns/Azure.ResourceManager.Dns/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/dns/ci.mgmt.yml + - sdk/dns/Azure.ResourceManager.Dns/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/dnsresolver/ci.mgmt.yml b/sdk/dnsresolver/ci.mgmt.yml index afa270cdc600..6b2569c11c49 100644 --- a/sdk/dnsresolver/ci.mgmt.yml +++ b/sdk/dnsresolver/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/dnsresolver/ci.mgmt.yml - sdk/dnsresolver/Azure.ResourceManager.DnsResolver/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/dnsresolver/ci.mgmt.yml + - sdk/dnsresolver/Azure.ResourceManager.DnsResolver/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/dynatrace/ci.mgmt.yml b/sdk/dynatrace/ci.mgmt.yml index f76bf3a316af..fe97a3c1f612 100644 --- a/sdk/dynatrace/ci.mgmt.yml +++ b/sdk/dynatrace/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/dynatrace/ci.mgmt.yml - sdk/dynatrace/Azure.ResourceManager.Dynatrace/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/dynatrace/ci.mgmt.yml + - sdk/dynatrace/Azure.ResourceManager.Dynatrace/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/edgeorder/ci.mgmt.yml b/sdk/edgeorder/ci.mgmt.yml index 4d1fbaa121f9..cb4d87c29a1b 100644 --- a/sdk/edgeorder/ci.mgmt.yml +++ b/sdk/edgeorder/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/edgeorder/ci.mgmt.yml - sdk/edgeorder/Azure.ResourceManager.EdgeOrder/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/edgeorder/ci.mgmt.yml + - sdk/edgeorder/Azure.ResourceManager.EdgeOrder/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/edgezones/ci.mgmt.yml b/sdk/edgezones/ci.mgmt.yml index 9dc8d79aab30..ebed00842581 100644 --- a/sdk/edgezones/ci.mgmt.yml +++ b/sdk/edgezones/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/edgezones/ci.mgmt.yml - sdk/edgezones/Azure.ResourceManager.EdgeZones/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/edgezones/ci.mgmt.yml + - sdk/edgezones/Azure.ResourceManager.EdgeZones/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/elastic/ci.mgmt.yml b/sdk/elastic/ci.mgmt.yml index 76ecd8b3923d..2e29070fce4a 100644 --- a/sdk/elastic/ci.mgmt.yml +++ b/sdk/elastic/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/elastic/ci.mgmt.yml - sdk/elastic/Azure.ResourceManager.Elastic/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/elastic/ci.mgmt.yml + - sdk/elastic/Azure.ResourceManager.Elastic/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/elasticsan/ci.mgmt.yml b/sdk/elasticsan/ci.mgmt.yml index 7e2bb35dde21..dba4416415e9 100644 --- a/sdk/elasticsan/ci.mgmt.yml +++ b/sdk/elasticsan/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/elasticsan/ci.mgmt.yml - sdk/elasticsan/Azure.ResourceManager.ElasticSan/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/elasticsan/ci.mgmt.yml + - sdk/elasticsan/Azure.ResourceManager.ElasticSan/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/eventgrid/ci.mgmt.yml b/sdk/eventgrid/ci.mgmt.yml index cb02a1b84e8b..1b2eaffc0fdd 100644 --- a/sdk/eventgrid/ci.mgmt.yml +++ b/sdk/eventgrid/ci.mgmt.yml @@ -2,6 +2,7 @@ # This is for Track 2 managment plane SDK trigger: none + pr: branches: include: @@ -14,6 +15,18 @@ pr: - sdk/eventgrid/ci.mgmt.yml - sdk/eventgrid/Azure.ResourceManager.EventGrid/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/eventgrid/ci.mgmt.yml + - sdk/eventgrid/Azure.ResourceManager.EventGrid/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/eventhub/ci.mgmt.yml b/sdk/eventhub/ci.mgmt.yml index b7c0045fffb3..dadda2db6dc5 100644 --- a/sdk/eventhub/ci.mgmt.yml +++ b/sdk/eventhub/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/eventhub/ci.mgmt.yml - sdk/eventhub/Azure.ResourceManager.EventHubs/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/eventhub/ci.mgmt.yml + - sdk/eventhub/Azure.ResourceManager.EventHubs/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/extendedlocation/ci.mgmt.yml b/sdk/extendedlocation/ci.mgmt.yml index 4fb53374be74..e9c6939e2b1d 100644 --- a/sdk/extendedlocation/ci.mgmt.yml +++ b/sdk/extendedlocation/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/extendedlocation/ci.mgmt.yml - sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/extendedlocation/ci.mgmt.yml + - sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/fabric/ci.mgmt.yml b/sdk/fabric/ci.mgmt.yml index d0bc6cea6eb9..5cc91d0c8722 100644 --- a/sdk/fabric/ci.mgmt.yml +++ b/sdk/fabric/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/fabric/ci.mgmt.yml - sdk/fabric/Azure.ResourceManager.Fabric/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/fabric/ci.mgmt.yml + - sdk/fabric/Azure.ResourceManager.Fabric/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/fleet/ci.mgmt.yml b/sdk/fleet/ci.mgmt.yml index 09a225882401..469d40cad619 100644 --- a/sdk/fleet/ci.mgmt.yml +++ b/sdk/fleet/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/fleet/ci.mgmt.yml - sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/fleet/ci.mgmt.yml + - sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/fluidrelay/ci.mgmt.yml b/sdk/fluidrelay/ci.mgmt.yml index d43dfe94d729..1673db3a9f26 100644 --- a/sdk/fluidrelay/ci.mgmt.yml +++ b/sdk/fluidrelay/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/fluidrelay/ci.mgmt.yml - sdk/fluidrelay/Azure.ResourceManager.FluidRelay/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/fluidrelay/ci.mgmt.yml + - sdk/fluidrelay/Azure.ResourceManager.FluidRelay/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/frontdoor/ci.mgmt.yml b/sdk/frontdoor/ci.mgmt.yml index bff9dbcae78c..f19923a1b43d 100644 --- a/sdk/frontdoor/ci.mgmt.yml +++ b/sdk/frontdoor/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/frontdoor/ci.mgmt.yml - sdk/frontdoor/Azure.ResourceManager.FrontDoor/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/frontdoor/ci.mgmt.yml + - sdk/frontdoor/Azure.ResourceManager.FrontDoor/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/grafana/ci.mgmt.yml b/sdk/grafana/ci.mgmt.yml index a2f22e6ee33b..848173351b4d 100644 --- a/sdk/grafana/ci.mgmt.yml +++ b/sdk/grafana/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/grafana/ci.mgmt.yml - sdk/grafana/Azure.ResourceManager.Grafana/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/grafana/ci.mgmt.yml + - sdk/grafana/Azure.ResourceManager.Grafana/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/graphservices/ci.mgmt.yml b/sdk/graphservices/ci.mgmt.yml index 717a9a4a1963..ccd14b614b43 100644 --- a/sdk/graphservices/ci.mgmt.yml +++ b/sdk/graphservices/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/graphservices/ci.mgmt.yml - sdk/graphservices/Azure.ResourceManager.GraphServices/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/graphservices/ci.mgmt.yml + - sdk/graphservices/Azure.ResourceManager.GraphServices/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/guestconfiguration/ci.mgmt.yml b/sdk/guestconfiguration/ci.mgmt.yml index 5ebc59550f58..c2d2526d488b 100644 --- a/sdk/guestconfiguration/ci.mgmt.yml +++ b/sdk/guestconfiguration/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/guestconfiguration/ci.mgmt.yml - sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/guestconfiguration/ci.mgmt.yml + - sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/hardwaresecuritymodules/ci.mgmt.yml b/sdk/hardwaresecuritymodules/ci.mgmt.yml index 21778711f99e..d94eea966253 100644 --- a/sdk/hardwaresecuritymodules/ci.mgmt.yml +++ b/sdk/hardwaresecuritymodules/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/hardwaresecuritymodules/ci.mgmt.yml - sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/hardwaresecuritymodules/ci.mgmt.yml + - sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/hdinsight/ci.mgmt.yml b/sdk/hdinsight/ci.mgmt.yml index 4df0a02f5c80..29d3b404c76a 100644 --- a/sdk/hdinsight/ci.mgmt.yml +++ b/sdk/hdinsight/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/hdinsight/ci.mgmt.yml - sdk/hdinsight/Azure.ResourceManager.HDInsight/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/hdinsight/ci.mgmt.yml + - sdk/hdinsight/Azure.ResourceManager.HDInsight/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/hdinsightcontainers/ci.mgmt.yml b/sdk/hdinsightcontainers/ci.mgmt.yml index 69a7566e0caa..66a879d8fbcd 100644 --- a/sdk/hdinsightcontainers/ci.mgmt.yml +++ b/sdk/hdinsightcontainers/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/hdinsightcontainers/ci.mgmt.yml - sdk/hdinsightcontainers/Azure.ResourceManager.HDInsight.Containers/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/hdinsightcontainers/ci.mgmt.yml + - sdk/hdinsightcontainers/Azure.ResourceManager.HDInsight.Containers/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/healthbot/ci.mgmt.yml b/sdk/healthbot/ci.mgmt.yml index 14bfc7f855e6..4c2698659502 100644 --- a/sdk/healthbot/ci.mgmt.yml +++ b/sdk/healthbot/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/healthbot/ci.mgmt.yml - sdk/healthbot/Azure.ResourceManager.HealthBot/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/healthbot/ci.mgmt.yml + - sdk/healthbot/Azure.ResourceManager.HealthBot/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/healthcareapis/ci.mgmt.yml b/sdk/healthcareapis/ci.mgmt.yml index 57030df35e56..6f02ac8fd023 100644 --- a/sdk/healthcareapis/ci.mgmt.yml +++ b/sdk/healthcareapis/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/healthcareapis/ci.mgmt.yml - sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/healthcareapis/ci.mgmt.yml + - sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/healthdataaiservices/ci.mgmt.yml b/sdk/healthdataaiservices/ci.mgmt.yml index 016a917c1e19..45857afa5722 100644 --- a/sdk/healthdataaiservices/ci.mgmt.yml +++ b/sdk/healthdataaiservices/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/healthdataaiservices/ci.mgmt.yml - sdk/healthdataaiservices/Azure.ResourceManager.HealthDataAIServices/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/healthdataaiservices/ci.mgmt.yml + - sdk/healthdataaiservices/Azure.ResourceManager.HealthDataAIServices/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/hybridaks/ci.mgmt.yml b/sdk/hybridaks/ci.mgmt.yml index 552eb3298d3a..af3d82703d11 100644 --- a/sdk/hybridaks/ci.mgmt.yml +++ b/sdk/hybridaks/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/hybridaks/ci.mgmt.yml - sdk/hybridaks/Azure.ResourceManager.HybridContainerService/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/hybridaks/ci.mgmt.yml + - sdk/hybridaks/Azure.ResourceManager.HybridContainerService/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/hybridcompute/ci.mgmt.yml b/sdk/hybridcompute/ci.mgmt.yml index d163a966512d..15f8656c399e 100644 --- a/sdk/hybridcompute/ci.mgmt.yml +++ b/sdk/hybridcompute/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/hybridcompute/ci.mgmt.yml - sdk/hybridcompute/Azure.ResourceManager.HybridCompute/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/hybridcompute/ci.mgmt.yml + - sdk/hybridcompute/Azure.ResourceManager.HybridCompute/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/hybridconnectivity/ci.mgmt.yml b/sdk/hybridconnectivity/ci.mgmt.yml index 9ccca42ef557..8d809d4d9633 100644 --- a/sdk/hybridconnectivity/ci.mgmt.yml +++ b/sdk/hybridconnectivity/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/hybridconnectivity/ci.mgmt.yml - sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/hybridconnectivity/ci.mgmt.yml + - sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/hybridkubernetes/ci.mgmt.yml b/sdk/hybridkubernetes/ci.mgmt.yml index fff768430c9d..bb98635a8e1c 100644 --- a/sdk/hybridkubernetes/ci.mgmt.yml +++ b/sdk/hybridkubernetes/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/hybridkubernetes/ci.mgmt.yml - sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/hybridkubernetes/ci.mgmt.yml + - sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/hybridnetwork/ci.mgmt.yml b/sdk/hybridnetwork/ci.mgmt.yml index 35f71f8ae870..39412ff81f05 100644 --- a/sdk/hybridnetwork/ci.mgmt.yml +++ b/sdk/hybridnetwork/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/hybridnetwork/ci.mgmt.yml - sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/hybridnetwork/ci.mgmt.yml + - sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/informaticadatamanagement/ci.mgmt.yml b/sdk/informaticadatamanagement/ci.mgmt.yml index 03013cc9c90b..82d3bafd3f7f 100644 --- a/sdk/informaticadatamanagement/ci.mgmt.yml +++ b/sdk/informaticadatamanagement/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/informaticadatamanagement/ci.mgmt.yml - sdk/informaticadatamanagement/Azure.ResourceManager.InformaticaDataManagement/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/informaticadatamanagement/ci.mgmt.yml + - sdk/informaticadatamanagement/Azure.ResourceManager.InformaticaDataManagement/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/iot/ci.mgmt.yml b/sdk/iot/ci.mgmt.yml index 6260cd0d71f2..199578b03331 100644 --- a/sdk/iot/ci.mgmt.yml +++ b/sdk/iot/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/iot/ci.mgmt.yml - sdk/iot/Azure.ResourceManager.IotFirmwareDefense/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/iot/ci.mgmt.yml + - sdk/iot/Azure.ResourceManager.IotFirmwareDefense/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/iotcentral/ci.mgmt.yml b/sdk/iotcentral/ci.mgmt.yml index 1702fd71c6dd..1225f99c37fd 100644 --- a/sdk/iotcentral/ci.mgmt.yml +++ b/sdk/iotcentral/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/iotcentral/ci.mgmt.yml - sdk/iotcentral/Azure.ResourceManager.IotCentral/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/iotcentral/ci.mgmt.yml + - sdk/iotcentral/Azure.ResourceManager.IotCentral/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/iothub/ci.mgmt.yml b/sdk/iothub/ci.mgmt.yml index 5eb9e999a89c..63fb10994eac 100644 --- a/sdk/iothub/ci.mgmt.yml +++ b/sdk/iothub/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/iothub/ci.mgmt.yml - sdk/iothub/Azure.ResourceManager.IotHub/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/iothub/ci.mgmt.yml + - sdk/iothub/Azure.ResourceManager.IotHub/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/keyvault/ci.mgmt.yml b/sdk/keyvault/ci.mgmt.yml index b48c2f8d4ff4..8ad905079a0a 100644 --- a/sdk/keyvault/ci.mgmt.yml +++ b/sdk/keyvault/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/keyvault/ci.mgmt.yml - sdk/keyvault/Azure.ResourceManager.KeyVault/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/keyvault/ci.mgmt.yml + - sdk/keyvault/Azure.ResourceManager.KeyVault/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/kubernetesconfiguration/ci.mgmt.yml b/sdk/kubernetesconfiguration/ci.mgmt.yml index 4249ef57fa6e..d3fb470a7b6e 100644 --- a/sdk/kubernetesconfiguration/ci.mgmt.yml +++ b/sdk/kubernetesconfiguration/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/kubernetesconfiguration/ci.mgmt.yml - sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/kubernetesconfiguration/ci.mgmt.yml + - sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/kusto/ci.mgmt.yml b/sdk/kusto/ci.mgmt.yml index 374cf1f0cb81..c410d1487d18 100644 --- a/sdk/kusto/ci.mgmt.yml +++ b/sdk/kusto/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/kusto/ci.mgmt.yml - sdk/kusto/Azure.ResourceManager.Kusto/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/kusto/ci.mgmt.yml + - sdk/kusto/Azure.ResourceManager.Kusto/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/labservices/ci.mgmt.yml b/sdk/labservices/ci.mgmt.yml index 48f80379ab14..f8a982072965 100644 --- a/sdk/labservices/ci.mgmt.yml +++ b/sdk/labservices/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/labservices/ci.mgmt.yml - sdk/labservices/Azure.ResourceManager.LabServices/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/labservices/ci.mgmt.yml + - sdk/labservices/Azure.ResourceManager.LabServices/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/loadtestservice/ci.mgmt.yml b/sdk/loadtestservice/ci.mgmt.yml index 4e3d99d42979..dfc32939e497 100644 --- a/sdk/loadtestservice/ci.mgmt.yml +++ b/sdk/loadtestservice/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/loadtestservice/ci.mgmt.yml - sdk/loadtestservice/Azure.ResourceManager.LoadTesting/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/loadtestservice/ci.mgmt.yml + - sdk/loadtestservice/Azure.ResourceManager.LoadTesting/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/logic/ci.mgmt.yml b/sdk/logic/ci.mgmt.yml index b89b224082ee..5bed51facd34 100644 --- a/sdk/logic/ci.mgmt.yml +++ b/sdk/logic/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/logic/ci.mgmt.yml - sdk/logic/Azure.ResourceManager.Logic/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/logic/ci.mgmt.yml + - sdk/logic/Azure.ResourceManager.Logic/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/machinelearningcompute/ci.mgmt.yml b/sdk/machinelearningcompute/ci.mgmt.yml index 9ea84fdf4d15..5ea619231191 100644 --- a/sdk/machinelearningcompute/ci.mgmt.yml +++ b/sdk/machinelearningcompute/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/machinelearningcompute/ci.mgmt.yml - sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/machinelearningcompute/ci.mgmt.yml + - sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/machinelearningservices/ci.mgmt.yml b/sdk/machinelearningservices/ci.mgmt.yml index 457299ab20b9..3a99ed224fc2 100644 --- a/sdk/machinelearningservices/ci.mgmt.yml +++ b/sdk/machinelearningservices/ci.mgmt.yml @@ -1,5 +1,6 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -12,6 +13,18 @@ pr: - sdk/machinelearningservices/ci.mgmt.yml - sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/machinelearningservices/ci.mgmt.yml + - sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/maintenance/ci.mgmt.yml b/sdk/maintenance/ci.mgmt.yml index c49cc1565d6d..94c552b69f26 100644 --- a/sdk/maintenance/ci.mgmt.yml +++ b/sdk/maintenance/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/maintenance/ci.mgmt.yml - sdk/maintenance/Azure.ResourceManager.Maintenance/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/maintenance/ci.mgmt.yml + - sdk/maintenance/Azure.ResourceManager.Maintenance/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/managednetwork/ci.mgmt.yml b/sdk/managednetwork/ci.mgmt.yml index 431d66d1245b..08c9f3d0ce55 100644 --- a/sdk/managednetwork/ci.mgmt.yml +++ b/sdk/managednetwork/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/managednetwork/ci.mgmt.yml - sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/managednetwork/ci.mgmt.yml + - sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/managednetworkfabric/ci.mgmt.yml b/sdk/managednetworkfabric/ci.mgmt.yml index aa6b571b04e2..3212ad45bbde 100644 --- a/sdk/managednetworkfabric/ci.mgmt.yml +++ b/sdk/managednetworkfabric/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/managednetworkfabric/ci.mgmt.yml - sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/managednetworkfabric/ci.mgmt.yml + - sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/managedserviceidentity/ci.mgmt.yml b/sdk/managedserviceidentity/ci.mgmt.yml index c8f3a187f918..c9cd4b0f235a 100644 --- a/sdk/managedserviceidentity/ci.mgmt.yml +++ b/sdk/managedserviceidentity/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/managedserviceidentity/ci.mgmt.yml - sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/managedserviceidentity/ci.mgmt.yml + - sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/ + extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/managedservices/ci.mgmt.yml b/sdk/managedservices/ci.mgmt.yml index d6c0ccd16eef..88360bb2defa 100644 --- a/sdk/managedservices/ci.mgmt.yml +++ b/sdk/managedservices/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/managedservices/ci.mgmt.yml - sdk/managedservices/Azure.ResourceManager.ManagedServices/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/managedservices/ci.mgmt.yml + - sdk/managedservices/Azure.ResourceManager.ManagedServices/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/managementpartner/ci.mgmt.yml b/sdk/managementpartner/ci.mgmt.yml index 52c8e762088e..6fdd0118e1b9 100644 --- a/sdk/managementpartner/ci.mgmt.yml +++ b/sdk/managementpartner/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/managementpartner/ci.mgmt.yml - sdk/managementpartner/Azure.ResourceManager.ManagementPartner/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/managementpartner/ci.mgmt.yml + - sdk/managementpartner/Azure.ResourceManager.ManagementPartner/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/maps/ci.mgmt.yml b/sdk/maps/ci.mgmt.yml index 2f16079cab2e..7ee4f1ddad3c 100644 --- a/sdk/maps/ci.mgmt.yml +++ b/sdk/maps/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/maps/ci.mgmt.yml - sdk/maps/Azure.ResourceManager.Maps/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/maps/ci.mgmt.yml + - sdk/maps/Azure.ResourceManager.Maps/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/marketplace/ci.mgmt.yml b/sdk/marketplace/ci.mgmt.yml index e6574bdb3039..42bc8a147b30 100644 --- a/sdk/marketplace/ci.mgmt.yml +++ b/sdk/marketplace/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/marketplace/ci.mgmt.yml - sdk/marketplace/Azure.ResourceManager.Marketplace/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/marketplace/ci.mgmt.yml + - sdk/marketplace/Azure.ResourceManager.Marketplace/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/marketplaceordering/ci.mgmt.yml b/sdk/marketplaceordering/ci.mgmt.yml index 2b1f8721902e..c602647fb32d 100644 --- a/sdk/marketplaceordering/ci.mgmt.yml +++ b/sdk/marketplaceordering/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/marketplaceordering/ci.mgmt.yml - sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/marketplaceordering/ci.mgmt.yml + - sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/mediaservices/ci.mgmt.yml b/sdk/mediaservices/ci.mgmt.yml index 55656f3ae48b..201ecc9d995d 100644 --- a/sdk/mediaservices/ci.mgmt.yml +++ b/sdk/mediaservices/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/mediaservices/ci.mgmt.yml - sdk/mediaservices/Azure.ResourceManager.Media/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/mediaservices/ci.mgmt.yml + - sdk/mediaservices/Azure.ResourceManager.Media/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/migrationdiscoverysap/ci.mgmt.yml b/sdk/migrationdiscoverysap/ci.mgmt.yml index f5eb354d28e7..26c079f3d6f5 100644 --- a/sdk/migrationdiscoverysap/ci.mgmt.yml +++ b/sdk/migrationdiscoverysap/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/migrationdiscoverysap/ci.mgmt.yml - sdk/migrationdiscoverysap/Azure.ResourceManager.MigrationDiscoverySap/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/migrationdiscoverysap/ci.mgmt.yml + - sdk/migrationdiscoverysap/Azure.ResourceManager.MigrationDiscoverySap/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/mixedreality/ci.mgmt.yml b/sdk/mixedreality/ci.mgmt.yml index 81c0c2744232..d342a10a32e0 100644 --- a/sdk/mixedreality/ci.mgmt.yml +++ b/sdk/mixedreality/ci.mgmt.yml @@ -1,5 +1,6 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -12,6 +13,18 @@ pr: - sdk/mixedreality/ci.mgmt.yml - sdk/mixedreality/Azure.ResourceManager.MixedReality/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/mixedreality/ci.mgmt.yml + - sdk/mixedreality/Azure.ResourceManager.MixedReality/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/mobilenetwork/ci.mgmt.yml b/sdk/mobilenetwork/ci.mgmt.yml index 8a68e6749ba7..325154bfbfb7 100644 --- a/sdk/mobilenetwork/ci.mgmt.yml +++ b/sdk/mobilenetwork/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/mobilenetwork/ci.mgmt.yml - sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/mobilenetwork/ci.mgmt.yml + - sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/ + extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/mongocluster/ci.mgmt.yml b/sdk/mongocluster/ci.mgmt.yml index d2eafe7877dd..10f6e93db8bc 100644 --- a/sdk/mongocluster/ci.mgmt.yml +++ b/sdk/mongocluster/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/mongocluster/ci.mgmt.yml - sdk/mongocluster/Azure.ResourceManager.MongoCluster/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/mongocluster/ci.mgmt.yml + - sdk/mongocluster/Azure.ResourceManager.MongoCluster/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/monitor/ci.mgmt.yml b/sdk/monitor/ci.mgmt.yml index 8beeded4e3b9..5933fd35d9e5 100644 --- a/sdk/monitor/ci.mgmt.yml +++ b/sdk/monitor/ci.mgmt.yml @@ -2,6 +2,7 @@ # This file is generated automatically and any changes will be lost. trigger: none + pr: branches: include: @@ -14,6 +15,18 @@ pr: - sdk/monitor/ci.mgmt.yml - sdk/monitor/Azure.ResourceManager.Monitor/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/monitor/ci.mgmt.yml + - sdk/monitor/Azure.ResourceManager.Monitor/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/mysql/ci.mgmt.yml b/sdk/mysql/ci.mgmt.yml index e1521b4ed568..2ba5627ae3fc 100644 --- a/sdk/mysql/ci.mgmt.yml +++ b/sdk/mysql/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/mysql/ci.mgmt.yml - sdk/mysql/Azure.ResourceManager.MySql/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/mysql/ci.mgmt.yml + - sdk/mysql/Azure.ResourceManager.MySql/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/netapp/ci.mgmt.yml b/sdk/netapp/ci.mgmt.yml index 05a683e910f5..5d0a3e741513 100644 --- a/sdk/netapp/ci.mgmt.yml +++ b/sdk/netapp/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/netapp/ci.mgmt.yml - sdk/netapp/Azure.ResourceManager.NetApp/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/netapp/ci.mgmt.yml + - sdk/netapp/Azure.ResourceManager.NetApp/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/network/ci.mgmt.yml b/sdk/network/ci.mgmt.yml index edf77de02a49..f69378e6c236 100644 --- a/sdk/network/ci.mgmt.yml +++ b/sdk/network/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/network/ci.mgmt.yml - sdk/network/Azure.ResourceManager.Network/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/network/ci.mgmt.yml + - sdk/network/Azure.ResourceManager.Network/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/networkanalytics/ci.mgmt.yml b/sdk/networkanalytics/ci.mgmt.yml index 9ece072ce867..52934a1bad24 100644 --- a/sdk/networkanalytics/ci.mgmt.yml +++ b/sdk/networkanalytics/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/networkanalytics/ci.mgmt.yml - sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/networkanalytics/ci.mgmt.yml + - sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/networkcloud/ci.mgmt.yml b/sdk/networkcloud/ci.mgmt.yml index f6c281af22a9..940f908b8c75 100644 --- a/sdk/networkcloud/ci.mgmt.yml +++ b/sdk/networkcloud/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/networkcloud/ci.mgmt.yml - sdk/networkcloud/Azure.ResourceManager.NetworkCloud/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/networkcloud/ci.mgmt.yml + - sdk/networkcloud/Azure.ResourceManager.NetworkCloud/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/networkfunction/ci.mgmt.yml b/sdk/networkfunction/ci.mgmt.yml index a3c743ef532a..b05cf6e5e1cc 100644 --- a/sdk/networkfunction/ci.mgmt.yml +++ b/sdk/networkfunction/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/networkfunction/ci.mgmt.yml - sdk/networkfunction/Azure.ResourceManager.NetworkFunction/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/networkfunction/ci.mgmt.yml + - sdk/networkfunction/Azure.ResourceManager.NetworkFunction/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/newrelicobservability/ci.mgmt.yml b/sdk/newrelicobservability/ci.mgmt.yml index d01ef74cd749..599cfd845f2c 100644 --- a/sdk/newrelicobservability/ci.mgmt.yml +++ b/sdk/newrelicobservability/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/newrelicobservability/ci.mgmt.yml - sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/newrelicobservability/ci.mgmt.yml + - sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/nginx/ci.mgmt.yml b/sdk/nginx/ci.mgmt.yml index f701b26a561a..39e047ce0015 100644 --- a/sdk/nginx/ci.mgmt.yml +++ b/sdk/nginx/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/nginx/ci.mgmt.yml - sdk/nginx/Azure.ResourceManager.Nginx/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/nginx/ci.mgmt.yml + - sdk/nginx/Azure.ResourceManager.Nginx/ + extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/notificationhubs/ci.mgmt.yml b/sdk/notificationhubs/ci.mgmt.yml index ba5a26631dd4..8d9f15f7758b 100644 --- a/sdk/notificationhubs/ci.mgmt.yml +++ b/sdk/notificationhubs/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/notificationhubs/ci.mgmt.yml - sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/notificationhubs/ci.mgmt.yml + - sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/openenergyplatform/ci.mgmt.yml b/sdk/openenergyplatform/ci.mgmt.yml index 1ab74128b4db..f2394b80f6b9 100644 --- a/sdk/openenergyplatform/ci.mgmt.yml +++ b/sdk/openenergyplatform/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/openenergyplatform/ci.mgmt.yml - sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/openenergyplatform/ci.mgmt.yml + - sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/ + extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/operationalinsights/ci.mgmt.yml b/sdk/operationalinsights/ci.mgmt.yml index d4c3b61dac40..9e588305c901 100644 --- a/sdk/operationalinsights/ci.mgmt.yml +++ b/sdk/operationalinsights/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/operationalinsights/ci.mgmt.yml - sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/operationalinsights/ci.mgmt.yml + - sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/oracle/ci.mgmt.yml b/sdk/oracle/ci.mgmt.yml index ccbd7c096ecf..760950dbd58a 100644 --- a/sdk/oracle/ci.mgmt.yml +++ b/sdk/oracle/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/oracle/ci.mgmt.yml - sdk/oracle/Azure.ResourceManager.OracleDatabase/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/oracle/ci.mgmt.yml + - sdk/oracle/Azure.ResourceManager.OracleDatabase/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/orbital/ci.mgmt.yml b/sdk/orbital/ci.mgmt.yml index 701576d2fa62..2b2102df1da3 100644 --- a/sdk/orbital/ci.mgmt.yml +++ b/sdk/orbital/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/orbital/ci.mgmt.yml - sdk/orbital/Azure.ResourceManager.Orbital/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/orbital/ci.mgmt.yml + - sdk/orbital/Azure.ResourceManager.Orbital/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/paloaltonetworks.ngfw/ci.mgmt.yml b/sdk/paloaltonetworks.ngfw/ci.mgmt.yml index 77dca48de9ef..6348d3109683 100644 --- a/sdk/paloaltonetworks.ngfw/ci.mgmt.yml +++ b/sdk/paloaltonetworks.ngfw/ci.mgmt.yml @@ -1,4 +1,5 @@ trigger: none + pr: branches: include: @@ -11,6 +12,18 @@ pr: - sdk/paloaltonetworks.ngfw/ci.mgmt.yml - sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/paloaltonetworks.ngfw/ci.mgmt.yml + - sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/peering/ci.mgmt.yml b/sdk/peering/ci.mgmt.yml index 4d3d67e73949..cfef409531ee 100644 --- a/sdk/peering/ci.mgmt.yml +++ b/sdk/peering/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/peering/ci.mgmt.yml - sdk/peering/Azure.ResourceManager.Peering/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/peering/ci.mgmt.yml + - sdk/peering/Azure.ResourceManager.Peering/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/playwrighttesting/ci.mgmt.yml b/sdk/playwrighttesting/ci.mgmt.yml index 79addf69162c..b6422b373563 100644 --- a/sdk/playwrighttesting/ci.mgmt.yml +++ b/sdk/playwrighttesting/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/playwrighttesting/ci.mgmt.yml - sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/playwrighttesting/ci.mgmt.yml + - sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/policyinsights/ci.mgmt.yml b/sdk/policyinsights/ci.mgmt.yml index 56fa5c3ead85..c0fa9e7dd917 100644 --- a/sdk/policyinsights/ci.mgmt.yml +++ b/sdk/policyinsights/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/policyinsights/ci.mgmt.yml - sdk/policyinsights/Azure.ResourceManager.PolicyInsights/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/policyinsights/ci.mgmt.yml + - sdk/policyinsights/Azure.ResourceManager.PolicyInsights/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/postgresql/ci.mgmt.yml b/sdk/postgresql/ci.mgmt.yml index 77dbaed301ba..08dff06cd11f 100644 --- a/sdk/postgresql/ci.mgmt.yml +++ b/sdk/postgresql/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/postgresql/ci.mgmt.yml - sdk/postgresql/Azure.ResourceManager.PostgreSql/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/postgresql/ci.mgmt.yml + - sdk/postgresql/Azure.ResourceManager.PostgreSql/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/powerbidedicated/ci.mgmt.yml b/sdk/powerbidedicated/ci.mgmt.yml index 414f2b8ef0a9..951d3e8d0434 100644 --- a/sdk/powerbidedicated/ci.mgmt.yml +++ b/sdk/powerbidedicated/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/powerbidedicated/ci.mgmt.yml - sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/powerbidedicated/ci.mgmt.yml + - sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/privatedns/ci.mgmt.yml b/sdk/privatedns/ci.mgmt.yml index 86401f2f9675..31c567bfe408 100644 --- a/sdk/privatedns/ci.mgmt.yml +++ b/sdk/privatedns/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/privatedns/ci.mgmt.yml - sdk/privatedns/Azure.ResourceManager.PrivateDns/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/privatedns/ci.mgmt.yml + - sdk/privatedns/Azure.ResourceManager.PrivateDns/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/providerhub/ci.mgmt.yml b/sdk/providerhub/ci.mgmt.yml index 2c7f6ca61d3f..3de6a7f30b80 100644 --- a/sdk/providerhub/ci.mgmt.yml +++ b/sdk/providerhub/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/providerhub/ci.mgmt.yml - sdk/providerhub/Azure.ResourceManager.ProviderHub/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/providerhub/ci.mgmt.yml + - sdk/providerhub/Azure.ResourceManager.ProviderHub/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/purview/ci.mgmt.yml b/sdk/purview/ci.mgmt.yml index 226718ca583c..d5961aa8833a 100644 --- a/sdk/purview/ci.mgmt.yml +++ b/sdk/purview/ci.mgmt.yml @@ -1,5 +1,6 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -12,6 +13,18 @@ pr: - sdk/purview/ci.mgmt.yml - sdk/purview/Azure.ResourceManager.Purview/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/purview/ci.mgmt.yml + - sdk/purview/Azure.ResourceManager.Purview/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/quantum/ci.mgmt.yml b/sdk/quantum/ci.mgmt.yml index 8562320fa7c7..6ee02d7799bd 100644 --- a/sdk/quantum/ci.mgmt.yml +++ b/sdk/quantum/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/quantum/ci.mgmt.yml - sdk/quantum/Azure.ResourceManager.Quantum/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/quantum/ci.mgmt.yml + - sdk/quantum/Azure.ResourceManager.Quantum/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/qumulo/ci.mgmt.yml b/sdk/qumulo/ci.mgmt.yml index e89c4bea0e70..fe6e1fa253d3 100644 --- a/sdk/qumulo/ci.mgmt.yml +++ b/sdk/qumulo/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/qumulo/ci.mgmt.yml - sdk/qumulo/Azure.ResourceManager.Qumulo/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/qumulo/ci.mgmt.yml + - sdk/qumulo/Azure.ResourceManager.Qumulo/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/quota/ci.mgmt.yml b/sdk/quota/ci.mgmt.yml index f1f545ad13f1..9409730d342e 100644 --- a/sdk/quota/ci.mgmt.yml +++ b/sdk/quota/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/quota/ci.mgmt.yml - sdk/quota/Azure.ResourceManager.Quota/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/quota/ci.mgmt.yml + - sdk/quota/Azure.ResourceManager.Quota/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/recoveryservices-backup/ci.mgmt.yml b/sdk/recoveryservices-backup/ci.mgmt.yml index 5edfd823e3c0..402121c0f72c 100644 --- a/sdk/recoveryservices-backup/ci.mgmt.yml +++ b/sdk/recoveryservices-backup/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/recoveryservices-backup/ci.mgmt.yml - sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/recoveryservices-backup/ci.mgmt.yml + - sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/recoveryservices-datareplication/ci.mgmt.yml b/sdk/recoveryservices-datareplication/ci.mgmt.yml index 2e3966d67a88..143f2e0317c3 100644 --- a/sdk/recoveryservices-datareplication/ci.mgmt.yml +++ b/sdk/recoveryservices-datareplication/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/recoveryservices-datareplication/ci.mgmt.yml - sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/recoveryservices-datareplication/ci.mgmt.yml + - sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/recoveryservices-siterecovery/ci.mgmt.yml b/sdk/recoveryservices-siterecovery/ci.mgmt.yml index bded800f3ee2..3a8a3179d5a5 100644 --- a/sdk/recoveryservices-siterecovery/ci.mgmt.yml +++ b/sdk/recoveryservices-siterecovery/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/recoveryservices-siterecovery/ci.mgmt.yml - sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/recoveryservices-siterecovery/ci.mgmt.yml + - sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/recoveryservices/ci.mgmt.yml b/sdk/recoveryservices/ci.mgmt.yml index 0e7e6985f21c..d4a5e482dfa7 100644 --- a/sdk/recoveryservices/ci.mgmt.yml +++ b/sdk/recoveryservices/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/recoveryservices/ci.mgmt.yml - sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/recoveryservices/ci.mgmt.yml + - sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/redis/ci.mgmt.yml b/sdk/redis/ci.mgmt.yml index 9e6845322580..dfc71e356b87 100644 --- a/sdk/redis/ci.mgmt.yml +++ b/sdk/redis/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/redis/ci.mgmt.yml - sdk/redis/Azure.ResourceManager.Redis/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/redis/ci.mgmt.yml + - sdk/redis/Azure.ResourceManager.Redis/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/redisenterprise/ci.mgmt.yml b/sdk/redisenterprise/ci.mgmt.yml index 93641cfe3983..294ec0377bdf 100644 --- a/sdk/redisenterprise/ci.mgmt.yml +++ b/sdk/redisenterprise/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/redisenterprise/ci.mgmt.yml - sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/redisenterprise/ci.mgmt.yml + - sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/relay/ci.mgmt.yml b/sdk/relay/ci.mgmt.yml index b69a1efbd0f9..fc5a3764ebb5 100644 --- a/sdk/relay/ci.mgmt.yml +++ b/sdk/relay/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/relay/ci.mgmt.yml - sdk/relay/Azure.ResourceManager.Relay/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/relay/ci.mgmt.yml + - sdk/relay/Azure.ResourceManager.Relay/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/reservations/ci.mgmt.yml b/sdk/reservations/ci.mgmt.yml index c46c8c69cd2e..8effbcdd4424 100644 --- a/sdk/reservations/ci.mgmt.yml +++ b/sdk/reservations/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/reservations/ci.mgmt.yml - sdk/reservations/Azure.ResourceManager.Reservations/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/reservations/ci.mgmt.yml + - sdk/reservations/Azure.ResourceManager.Reservations/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/resourceconnector/ci.mgmt.yml b/sdk/resourceconnector/ci.mgmt.yml index 81269b9113c7..149f1805dab4 100644 --- a/sdk/resourceconnector/ci.mgmt.yml +++ b/sdk/resourceconnector/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/resourceconnector/ci.mgmt.yml - sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourceconnector/ci.mgmt.yml + - sdk/resourceconnector/Azure.ResourceManager.ResourceConnector/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/resourcegraph/ci.mgmt.yml b/sdk/resourcegraph/ci.mgmt.yml index 5abe050f7709..27656bcd16c2 100644 --- a/sdk/resourcegraph/ci.mgmt.yml +++ b/sdk/resourcegraph/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/resourcegraph/ci.mgmt.yml - sdk/resourcegraph/Azure.ResourceManager.ResourceGraph/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcegraph/ci.mgmt.yml + - sdk/resourcegraph/Azure.ResourceManager.ResourceGraph/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/resourcehealth/ci.mgmt.yml b/sdk/resourcehealth/ci.mgmt.yml index fb0a27171a69..bf3868346c7b 100644 --- a/sdk/resourcehealth/ci.mgmt.yml +++ b/sdk/resourcehealth/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/resourcehealth/ci.mgmt.yml - sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcehealth/ci.mgmt.yml + - sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/resourcemanager/ci.mgmt.yml b/sdk/resourcemanager/ci.mgmt.yml index e844fdb04cde..65b1a0e2d747 100644 --- a/sdk/resourcemanager/ci.mgmt.yml +++ b/sdk/resourcemanager/ci.mgmt.yml @@ -11,197 +11,197 @@ trigger: - sdk/resourcemanager - common/ManagementTestShared - common/ManagementCoreShared - - sdk/advisor/Azure.ResourceManager.Advisor - - sdk/agrifood/Azure.ResourceManager.AgFoodPlatform - - sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement - - sdk/analysisservices/Azure.ResourceManager.Analysis - - sdk/apicenter/Azure.ResourceManager.ApiCenter - - sdk/apimanagement/Azure.ResourceManager.ApiManagement - - sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation + - sdk/graphservices/Azure.ResourceManager.GraphServices + - sdk/networkcloud/Azure.ResourceManager.NetworkCloud + - sdk/securitycenter/Azure.ResourceManager.SecurityCenter - sdk/appconfiguration/Azure.ResourceManager.AppConfiguration - - sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights - - sdk/appplatform/Azure.ResourceManager.AppPlatform + - sdk/relay/Azure.ResourceManager.Relay + - sdk/webpubsub/Azure.ResourceManager.WebPubSub + - sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup + - sdk/computeschedule/Azure.ResourceManager.ComputeSchedule + - sdk/trustedsigning/Azure.ResourceManager.TrustedSigning + - sdk/fabric/Azure.ResourceManager.Fabric + - sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices + - sdk/securitydevops/Azure.ResourceManager.SecurityDevOps + - sdk/eventhub/Azure.ResourceManager.EventHubs + - sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery + - sdk/apimanagement/Azure.ResourceManager.ApiManagement + - sdk/kusto/Azure.ResourceManager.Kusto + - sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric + - sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes + - sdk/apicenter/Azure.ResourceManager.ApiCenter + - sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering + - sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics + - sdk/dns/Azure.ResourceManager.Dns + - sdk/maintenance/Azure.ResourceManager.Maintenance + - sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics - sdk/arc-scvmm/Azure.ResourceManager.ScVmm - - sdk/astronomer/Azure.ResourceManager.Astro - - sdk/attestation/Azure.ResourceManager.Attestation - - sdk/authorization/Azure.ResourceManager.Authorization - - sdk/automanage/Azure.ResourceManager.Automanage + - sdk/iot/Azure.ResourceManager.IotFirmwareDefense + - sdk/mixedreality/Azure.ResourceManager.MixedReality + - sdk/mongocluster/Azure.ResourceManager.MongoCluster + - sdk/terraform/Azure.ResourceManager.Terraform + - sdk/storagemover/Azure.ResourceManager.StorageMover + - sdk/frontdoor/Azure.ResourceManager.FrontDoor + - sdk/elasticsan/Azure.ResourceManager.ElasticSan + - sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities + - sdk/databox/Azure.ResourceManager.DataBox + - sdk/dnsresolver/Azure.ResourceManager.DnsResolver + - sdk/containerinstance/Azure.ResourceManager.ContainerInstance + - sdk/dynatrace/Azure.ResourceManager.Dynatrace + - sdk/operationalinsights/Azure.ResourceManager.OperationalInsights + - sdk/managednetwork/Azure.ResourceManager.ManagedNetwork - sdk/automation/Azure.ResourceManager.Automation - - sdk/avs/Azure.ResourceManager.Avs - - sdk/azurelargeinstance/Azure.ResourceManager.LargeInstance - - sdk/azurestackhci/Azure.ResourceManager.Hci - - sdk/batch/Azure.ResourceManager.Batch - - sdk/billing/Azure.ResourceManager.Billing - - sdk/billingbenefits/Azure.ResourceManager.BillingBenefits - - sdk/blueprint/Azure.ResourceManager.Blueprint - - sdk/botservice/Azure.ResourceManager.BotService - - sdk/cdn/Azure.ResourceManager.Cdn - - sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis - - sdk/chaos/Azure.ResourceManager.Chaos - - sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices - - sdk/communication/Azure.ResourceManager.Communication - - sdk/compute/Azure.ResourceManager.Compute - - sdk/computefleet/Azure.ResourceManager.ComputeFleet - - sdk/computeschedule/Azure.ResourceManager.ComputeSchedule - - sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger - - sdk/confluent/Azure.ResourceManager.Confluent + - sdk/machinelearningservices/Azure.ResourceManager.MachineLearning + - sdk/managementpartner/Azure.ResourceManager.ManagementPartner - sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere - - sdk/consumption/Azure.ResourceManager.Consumption - - sdk/containerapps/Azure.ResourceManager.AppContainers - - sdk/containerinstance/Azure.ResourceManager.ContainerInstance - - sdk/containerorchestratorruntime/Azure.ResourceManager.ContainerOrchestratorRuntime - - sdk/containerregistry/Azure.ResourceManager.ContainerRegistry - - sdk/containerservice/Azure.ResourceManager.ContainerService - - sdk/cosmosdb/Azure.ResourceManager.CosmosDB - - sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql - - sdk/costmanagement/Azure.ResourceManager.CostManagement - - sdk/customer-insights/Azure.ResourceManager.CustomerInsights - - sdk/databox/Azure.ResourceManager.DataBox - - sdk/databoxedge/Azure.ResourceManager.DataBoxEdge - - sdk/datadog/Azure.ResourceManager.Datadog - - sdk/datafactory/Azure.ResourceManager.DataFactory - - sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics - sdk/datalake-store/Azure.ResourceManager.DataLakeStore - sdk/datamigration/Azure.ResourceManager.DataMigration - - sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup - - sdk/datashare/Azure.ResourceManager.DataShare - - sdk/defendereasm/Azure.ResourceManager.DefenderEasm - - sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization - - sdk/devcenter/Azure.ResourceManager.DevCenter - - sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices - - sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry + - sdk/billing/Azure.ResourceManager.Billing + - sdk/notificationhubs/Azure.ResourceManager.NotificationHubs + - sdk/datafactory/Azure.ResourceManager.DataFactory + - sdk/servicebus/Azure.ResourceManager.ServiceBus + - sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration + - sdk/springappdiscovery/Azure.ResourceManager.SpringAppDiscovery + - sdk/selfhelp/Azure.ResourceManager.SelfHelp + - sdk/cdn/Azure.ResourceManager.Cdn + - sdk/securityinsights/Azure.ResourceManager.SecurityInsights + - sdk/cosmosdb/Azure.ResourceManager.CosmosDB + - sdk/loadtestservice/Azure.ResourceManager.LoadTesting - sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate - - sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure - - sdk/devspaces/Azure.ResourceManager.DevSpaces + - sdk/storagesync/Azure.ResourceManager.StorageSync + - sdk/policyinsights/Azure.ResourceManager.PolicyInsights - sdk/devtestlabs/Azure.ResourceManager.DevTestLabs + - sdk/trafficmanager/Azure.ResourceManager.TrafficManager + - sdk/devspaces/Azure.ResourceManager.DevSpaces + - sdk/reservations/Azure.ResourceManager.Reservations + - sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics + - sdk/migrationdiscoverysap/Azure.ResourceManager.MigrationDiscoverySap + - sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork + - sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure + - sdk/maps/Azure.ResourceManager.Maps + - sdk/hdinsightcontainers/Azure.ResourceManager.HDInsight.Containers + - sdk/peering/Azure.ResourceManager.Peering + - sdk/compute/Azure.ResourceManager.Compute + - sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking + - sdk/redis/Azure.ResourceManager.Redis + - sdk/quantum/Azure.ResourceManager.Quantum + - sdk/costmanagement/Azure.ResourceManager.CostManagement + - sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules + - sdk/openenergyplatform/Azure.ResourceManager.EnergyServices + - sdk/nginx/Azure.ResourceManager.Nginx + - sdk/resourceconnector/Azure.ResourceManager.ResourceConnector + - sdk/datashare/Azure.ResourceManager.DataShare + - sdk/workloads/Azure.ResourceManager.Workloads + - sdk/hybridaks/Azure.ResourceManager.HybridContainerService + - sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor + - sdk/resourcehealth/Azure.ResourceManager.ResourceHealth + - sdk/azurestackhci/Azure.ResourceManager.Hci - sdk/digitaltwins/Azure.ResourceManager.DigitalTwins - - sdk/dns/Azure.ResourceManager.Dns - - sdk/dnsresolver/Azure.ResourceManager.DnsResolver - - sdk/dynatrace/Azure.ResourceManager.Dynatrace - - sdk/edgeorder/Azure.ResourceManager.EdgeOrder - - sdk/edgezones/Azure.ResourceManager.EdgeZones - - sdk/elastic/Azure.ResourceManager.Elastic - - sdk/elasticsan/Azure.ResourceManager.ElasticSan - - sdk/eventgrid/Azure.ResourceManager.EventGrid - - sdk/eventhub/Azure.ResourceManager.EventHubs - - sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations - - sdk/fabric/Azure.ResourceManager.Fabric + - sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute + - sdk/monitor/Azure.ResourceManager.Monitor + - sdk/websites/Azure.ResourceManager.AppService - sdk/fleet/Azure.ResourceManager.ContainerServiceFleet - - sdk/fluidrelay/Azure.ResourceManager.FluidRelay - - sdk/frontdoor/Azure.ResourceManager.FrontDoor - - sdk/grafana/Azure.ResourceManager.Grafana - - sdk/graphservices/Azure.ResourceManager.GraphServices - sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration - - sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules - - sdk/hdinsight/Azure.ResourceManager.HDInsight - - sdk/hdinsightcontainers/Azure.ResourceManager.HDInsight.Containers - - sdk/healthbot/Azure.ResourceManager.HealthBot - - sdk/healthcareapis/Azure.ResourceManager.HealthcareApis - - sdk/healthdataaiservices/Azure.ResourceManager.HealthDataAIServices - - sdk/hybridaks/Azure.ResourceManager.HybridContainerService - - sdk/hybridcompute/Azure.ResourceManager.HybridCompute - - sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity - - sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes - - sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork - - sdk/informaticadatamanagement/Azure.ResourceManager.InformaticaDataManagement - - sdk/iot/Azure.ResourceManager.IotFirmwareDefense - - sdk/iotcentral/Azure.ResourceManager.IotCentral - - sdk/iothub/Azure.ResourceManager.IotHub - - sdk/keyvault/Azure.ResourceManager.KeyVault - - sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration - - sdk/kusto/Azure.ResourceManager.Kusto - - sdk/labservices/Azure.ResourceManager.LabServices - - sdk/loadtestservice/Azure.ResourceManager.LoadTesting - sdk/logic/Azure.ResourceManager.Logic - - sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute - - sdk/machinelearningservices/Azure.ResourceManager.MachineLearning - - sdk/maintenance/Azure.ResourceManager.Maintenance - - sdk/managednetwork/Azure.ResourceManager.ManagedNetwork - - sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric - - sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities - - sdk/managedservices/Azure.ResourceManager.ManagedServices - - sdk/managementpartner/Azure.ResourceManager.ManagementPartner - - sdk/maps/Azure.ResourceManager.Maps - - sdk/marketplace/Azure.ResourceManager.Marketplace - - sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering + - sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting + - sdk/resourcegraph/Azure.ResourceManager.ResourceGraph + - sdk/agrifood/Azure.ResourceManager.AgFoodPlatform - sdk/mediaservices/Azure.ResourceManager.Media - - sdk/migrationdiscoverysap/Azure.ResourceManager.MigrationDiscoverySap - - sdk/mixedreality/Azure.ResourceManager.MixedReality - - sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork - - sdk/mongocluster/Azure.ResourceManager.MongoCluster - - sdk/monitor/Azure.ResourceManager.Monitor - - sdk/mysql/Azure.ResourceManager.MySql - - sdk/netapp/Azure.ResourceManager.NetApp - - sdk/network/Azure.ResourceManager.Network - - sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics - - sdk/networkcloud/Azure.ResourceManager.NetworkCloud + - sdk/keyvault/Azure.ResourceManager.KeyVault + - sdk/labservices/Azure.ResourceManager.LabServices + - sdk/azurelargeinstance/Azure.ResourceManager.LargeInstance - sdk/networkfunction/Azure.ResourceManager.NetworkFunction + - sdk/resources/Azure.ResourceManager.Resources + - sdk/storagecache/Azure.ResourceManager.StorageCache + - sdk/subscription/Azure.ResourceManager.Subscription + - sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity + - sdk/communication/Azure.ResourceManager.Communication + - sdk/customer-insights/Azure.ResourceManager.CustomerInsights + - sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup + - sdk/healthbot/Azure.ResourceManager.HealthBot + - sdk/marketplace/Azure.ResourceManager.Marketplace + - sdk/defendereasm/Azure.ResourceManager.DefenderEasm + - sdk/privatedns/Azure.ResourceManager.PrivateDns + - sdk/iothub/Azure.ResourceManager.IotHub - sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability - - sdk/nginx/Azure.ResourceManager.Nginx - - sdk/notificationhubs/Azure.ResourceManager.NotificationHubs - - sdk/openenergyplatform/Azure.ResourceManager.EnergyServices - - sdk/operationalinsights/Azure.ResourceManager.OperationalInsights - - sdk/oracle/Azure.ResourceManager.OracleDatabase - sdk/orbital/Azure.ResourceManager.Orbital - - sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw - - sdk/peering/Azure.ResourceManager.Peering - - sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting - - sdk/policyinsights/Azure.ResourceManager.PolicyInsights + - sdk/signalr/Azure.ResourceManager.SignalR + - sdk/elastic/Azure.ResourceManager.Elastic + - sdk/netapp/Azure.ResourceManager.NetApp + - sdk/authorization/Azure.ResourceManager.Authorization + - sdk/grafana/Azure.ResourceManager.Grafana + - sdk/containerapps/Azure.ResourceManager.AppContainers + - sdk/healthcareapis/Azure.ResourceManager.HealthcareApis - sdk/postgresql/Azure.ResourceManager.PostgreSql - - sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated - - sdk/privatedns/Azure.ResourceManager.PrivateDns - - sdk/providerhub/Azure.ResourceManager.ProviderHub + - sdk/astronomer/Azure.ResourceManager.Astro + - sdk/avs/Azure.ResourceManager.Avs + - sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement + - sdk/servicefabric/Azure.ResourceManager.ServiceFabric + - sdk/hybridcompute/Azure.ResourceManager.HybridCompute + - sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis - sdk/purview/Azure.ResourceManager.Purview - - sdk/quantum/Azure.ResourceManager.Quantum + - sdk/appplatform/Azure.ResourceManager.AppPlatform + - sdk/databoxedge/Azure.ResourceManager.DataBoxEdge + - sdk/search/Azure.ResourceManager.Search - sdk/qumulo/Azure.ResourceManager.Qumulo - - sdk/quota/Azure.ResourceManager.Quota + - sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations + - sdk/containerorchestratorruntime/Azure.ResourceManager.ContainerOrchestratorRuntime + - sdk/standbypool/Azure.ResourceManager.StandbyPool + - sdk/datadog/Azure.ResourceManager.Datadog + - sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw + - sdk/botservice/Azure.ResourceManager.BotService + - sdk/devcenter/Azure.ResourceManager.DevCenter + - sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation + - sdk/automanage/Azure.ResourceManager.Automanage - sdk/recoveryservices/Azure.ResourceManager.RecoveryServices - - sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup - - sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication - - sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery - - sdk/redis/Azure.ResourceManager.Redis - - sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise - - sdk/relay/Azure.ResourceManager.Relay - - sdk/reservations/Azure.ResourceManager.Reservations - - sdk/resourceconnector/Azure.ResourceManager.ResourceConnector - - sdk/resourcegraph/Azure.ResourceManager.ResourceGraph - - sdk/resourcehealth/Azure.ResourceManager.ResourceHealth + - sdk/edgeorder/Azure.ResourceManager.EdgeOrder + - sdk/consumption/Azure.ResourceManager.Consumption + - sdk/blueprint/Azure.ResourceManager.Blueprint - sdk/resourcemover/Azure.ResourceManager.ResourceMover - - sdk/resources/Azure.ResourceManager.Resources - - sdk/search/Azure.ResourceManager.Search - - sdk/securitycenter/Azure.ResourceManager.SecurityCenter - - sdk/securitydevops/Azure.ResourceManager.SecurityDevOps - - sdk/securityinsights/Azure.ResourceManager.SecurityInsights - - sdk/selfhelp/Azure.ResourceManager.SelfHelp - - sdk/servicebus/Azure.ResourceManager.ServiceBus - - sdk/servicefabric/Azure.ResourceManager.ServiceFabric + - sdk/oracle/Azure.ResourceManager.OracleDatabase + - sdk/batch/Azure.ResourceManager.Batch + - sdk/eventgrid/Azure.ResourceManager.EventGrid + - sdk/analysisservices/Azure.ResourceManager.Analysis + - sdk/support/Azure.ResourceManager.Support + - sdk/billingbenefits/Azure.ResourceManager.BillingBenefits + - sdk/hdinsight/Azure.ResourceManager.HDInsight + - sdk/storage/Azure.ResourceManager.Storage - sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters - - sdk/servicelinker/Azure.ResourceManager.ServiceLinker - - sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking - - sdk/signalr/Azure.ResourceManager.SignalR + - sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine - sdk/sphere/Azure.ResourceManager.Sphere - - sdk/springappdiscovery/Azure.ResourceManager.SpringAppDiscovery + - sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization + - sdk/confluent/Azure.ResourceManager.Confluent + - sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated + - sdk/mysql/Azure.ResourceManager.MySql + - sdk/informaticadatamanagement/Azure.ResourceManager.InformaticaDataManagement + - sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger + - sdk/edgezones/Azure.ResourceManager.EdgeZones + - sdk/healthdataaiservices/Azure.ResourceManager.HealthDataAIServices - sdk/sqlmanagement/Azure.ResourceManager.Sql - - sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine - - sdk/standbypool/Azure.ResourceManager.StandbyPool - - sdk/storage/Azure.ResourceManager.Storage + - sdk/network/Azure.ResourceManager.Network + - sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise + - sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql - sdk/storageactions/Azure.ResourceManager.StorageActions - - sdk/storagecache/Azure.ResourceManager.StorageCache - - sdk/storagemover/Azure.ResourceManager.StorageMover + - sdk/chaos/Azure.ResourceManager.Chaos + - sdk/quota/Azure.ResourceManager.Quota + - sdk/containerservice/Azure.ResourceManager.ContainerService + - sdk/iotcentral/Azure.ResourceManager.IotCentral + - sdk/advisor/Azure.ResourceManager.Advisor + - sdk/containerregistry/Azure.ResourceManager.ContainerRegistry + - sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights + - sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices - sdk/storagepool/Azure.ResourceManager.StoragePool - - sdk/storagesync/Azure.ResourceManager.StorageSync - - sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics - - sdk/subscription/Azure.ResourceManager.Subscription - - sdk/support/Azure.ResourceManager.Support + - sdk/attestation/Azure.ResourceManager.Attestation + - sdk/fluidrelay/Azure.ResourceManager.FluidRelay - sdk/synapse/Azure.ResourceManager.Synapse - - sdk/terraform/Azure.ResourceManager.Terraform - - sdk/trafficmanager/Azure.ResourceManager.TrafficManager - - sdk/trustedsigning/Azure.ResourceManager.TrustedSigning - sdk/voiceservices/Azure.ResourceManager.VoiceServices - - sdk/webpubsub/Azure.ResourceManager.WebPubSub - - sdk/websites/Azure.ResourceManager.AppService - - sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor - - sdk/workloads/Azure.ResourceManager.Workloads + - sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication + - sdk/computefleet/Azure.ResourceManager.ComputeFleet + - sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork + - sdk/managedservices/Azure.ResourceManager.ManagedServices + - sdk/servicelinker/Azure.ResourceManager.ServiceLinker + - sdk/providerhub/Azure.ResourceManager.ProviderHub + - sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry pr: branches: @@ -215,197 +215,197 @@ pr: - sdk/resourcemanager - common/ManagementTestShared - common/ManagementCoreShared - - sdk/advisor/Azure.ResourceManager.Advisor - - sdk/agrifood/Azure.ResourceManager.AgFoodPlatform - - sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement - - sdk/analysisservices/Azure.ResourceManager.Analysis - - sdk/apicenter/Azure.ResourceManager.ApiCenter - - sdk/apimanagement/Azure.ResourceManager.ApiManagement - - sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation + - sdk/graphservices/Azure.ResourceManager.GraphServices + - sdk/networkcloud/Azure.ResourceManager.NetworkCloud + - sdk/securitycenter/Azure.ResourceManager.SecurityCenter - sdk/appconfiguration/Azure.ResourceManager.AppConfiguration - - sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights - - sdk/appplatform/Azure.ResourceManager.AppPlatform - - sdk/arc-scvmm/Azure.ResourceManager.ScVmm - - sdk/astronomer/Azure.ResourceManager.Astro - - sdk/attestation/Azure.ResourceManager.Attestation - - sdk/authorization/Azure.ResourceManager.Authorization - - sdk/automanage/Azure.ResourceManager.Automanage - - sdk/automation/Azure.ResourceManager.Automation - - sdk/avs/Azure.ResourceManager.Avs - - sdk/azurelargeinstance/Azure.ResourceManager.LargeInstance - - sdk/azurestackhci/Azure.ResourceManager.Hci - - sdk/batch/Azure.ResourceManager.Batch - - sdk/billing/Azure.ResourceManager.Billing - - sdk/billingbenefits/Azure.ResourceManager.BillingBenefits - - sdk/blueprint/Azure.ResourceManager.Blueprint - - sdk/botservice/Azure.ResourceManager.BotService - - sdk/cdn/Azure.ResourceManager.Cdn - - sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis - - sdk/chaos/Azure.ResourceManager.Chaos - - sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices - - sdk/communication/Azure.ResourceManager.Communication - - sdk/compute/Azure.ResourceManager.Compute - - sdk/computefleet/Azure.ResourceManager.ComputeFleet + - sdk/relay/Azure.ResourceManager.Relay + - sdk/webpubsub/Azure.ResourceManager.WebPubSub + - sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup - sdk/computeschedule/Azure.ResourceManager.ComputeSchedule - - sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger - - sdk/confluent/Azure.ResourceManager.Confluent - - sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere - - sdk/consumption/Azure.ResourceManager.Consumption - - sdk/containerapps/Azure.ResourceManager.AppContainers - - sdk/containerinstance/Azure.ResourceManager.ContainerInstance - - sdk/containerorchestratorruntime/Azure.ResourceManager.ContainerOrchestratorRuntime - - sdk/containerregistry/Azure.ResourceManager.ContainerRegistry - - sdk/containerservice/Azure.ResourceManager.ContainerService - - sdk/cosmosdb/Azure.ResourceManager.CosmosDB - - sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql - - sdk/costmanagement/Azure.ResourceManager.CostManagement - - sdk/customer-insights/Azure.ResourceManager.CustomerInsights + - sdk/trustedsigning/Azure.ResourceManager.TrustedSigning + - sdk/fabric/Azure.ResourceManager.Fabric + - sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices + - sdk/securitydevops/Azure.ResourceManager.SecurityDevOps + - sdk/eventhub/Azure.ResourceManager.EventHubs + - sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery + - sdk/apimanagement/Azure.ResourceManager.ApiManagement + - sdk/kusto/Azure.ResourceManager.Kusto + - sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric + - sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes + - sdk/apicenter/Azure.ResourceManager.ApiCenter + - sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering + - sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics + - sdk/dns/Azure.ResourceManager.Dns + - sdk/maintenance/Azure.ResourceManager.Maintenance + - sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics + - sdk/arc-scvmm/Azure.ResourceManager.ScVmm + - sdk/iot/Azure.ResourceManager.IotFirmwareDefense + - sdk/mixedreality/Azure.ResourceManager.MixedReality + - sdk/mongocluster/Azure.ResourceManager.MongoCluster + - sdk/terraform/Azure.ResourceManager.Terraform + - sdk/storagemover/Azure.ResourceManager.StorageMover + - sdk/frontdoor/Azure.ResourceManager.FrontDoor + - sdk/elasticsan/Azure.ResourceManager.ElasticSan + - sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities - sdk/databox/Azure.ResourceManager.DataBox - - sdk/databoxedge/Azure.ResourceManager.DataBoxEdge - - sdk/datadog/Azure.ResourceManager.Datadog - - sdk/datafactory/Azure.ResourceManager.DataFactory - - sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics + - sdk/dnsresolver/Azure.ResourceManager.DnsResolver + - sdk/containerinstance/Azure.ResourceManager.ContainerInstance + - sdk/dynatrace/Azure.ResourceManager.Dynatrace + - sdk/operationalinsights/Azure.ResourceManager.OperationalInsights + - sdk/managednetwork/Azure.ResourceManager.ManagedNetwork + - sdk/automation/Azure.ResourceManager.Automation + - sdk/machinelearningservices/Azure.ResourceManager.MachineLearning + - sdk/managementpartner/Azure.ResourceManager.ManagementPartner + - sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere - sdk/datalake-store/Azure.ResourceManager.DataLakeStore - sdk/datamigration/Azure.ResourceManager.DataMigration - - sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup - - sdk/datashare/Azure.ResourceManager.DataShare - - sdk/defendereasm/Azure.ResourceManager.DefenderEasm - - sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization - - sdk/devcenter/Azure.ResourceManager.DevCenter - - sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices - - sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry + - sdk/billing/Azure.ResourceManager.Billing + - sdk/notificationhubs/Azure.ResourceManager.NotificationHubs + - sdk/datafactory/Azure.ResourceManager.DataFactory + - sdk/servicebus/Azure.ResourceManager.ServiceBus + - sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration + - sdk/springappdiscovery/Azure.ResourceManager.SpringAppDiscovery + - sdk/selfhelp/Azure.ResourceManager.SelfHelp + - sdk/cdn/Azure.ResourceManager.Cdn + - sdk/securityinsights/Azure.ResourceManager.SecurityInsights + - sdk/cosmosdb/Azure.ResourceManager.CosmosDB + - sdk/loadtestservice/Azure.ResourceManager.LoadTesting - sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate - - sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure - - sdk/devspaces/Azure.ResourceManager.DevSpaces + - sdk/storagesync/Azure.ResourceManager.StorageSync + - sdk/policyinsights/Azure.ResourceManager.PolicyInsights - sdk/devtestlabs/Azure.ResourceManager.DevTestLabs + - sdk/trafficmanager/Azure.ResourceManager.TrafficManager + - sdk/devspaces/Azure.ResourceManager.DevSpaces + - sdk/reservations/Azure.ResourceManager.Reservations + - sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics + - sdk/migrationdiscoverysap/Azure.ResourceManager.MigrationDiscoverySap + - sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork + - sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure + - sdk/maps/Azure.ResourceManager.Maps + - sdk/hdinsightcontainers/Azure.ResourceManager.HDInsight.Containers + - sdk/peering/Azure.ResourceManager.Peering + - sdk/compute/Azure.ResourceManager.Compute + - sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking + - sdk/redis/Azure.ResourceManager.Redis + - sdk/quantum/Azure.ResourceManager.Quantum + - sdk/costmanagement/Azure.ResourceManager.CostManagement + - sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules + - sdk/openenergyplatform/Azure.ResourceManager.EnergyServices + - sdk/nginx/Azure.ResourceManager.Nginx + - sdk/resourceconnector/Azure.ResourceManager.ResourceConnector + - sdk/datashare/Azure.ResourceManager.DataShare + - sdk/workloads/Azure.ResourceManager.Workloads + - sdk/hybridaks/Azure.ResourceManager.HybridContainerService + - sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor + - sdk/resourcehealth/Azure.ResourceManager.ResourceHealth + - sdk/azurestackhci/Azure.ResourceManager.Hci - sdk/digitaltwins/Azure.ResourceManager.DigitalTwins - - sdk/dns/Azure.ResourceManager.Dns - - sdk/dnsresolver/Azure.ResourceManager.DnsResolver - - sdk/dynatrace/Azure.ResourceManager.Dynatrace - - sdk/edgeorder/Azure.ResourceManager.EdgeOrder - - sdk/edgezones/Azure.ResourceManager.EdgeZones - - sdk/elastic/Azure.ResourceManager.Elastic - - sdk/elasticsan/Azure.ResourceManager.ElasticSan - - sdk/eventgrid/Azure.ResourceManager.EventGrid - - sdk/eventhub/Azure.ResourceManager.EventHubs - - sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations - - sdk/fabric/Azure.ResourceManager.Fabric + - sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute + - sdk/monitor/Azure.ResourceManager.Monitor + - sdk/websites/Azure.ResourceManager.AppService - sdk/fleet/Azure.ResourceManager.ContainerServiceFleet - - sdk/fluidrelay/Azure.ResourceManager.FluidRelay - - sdk/frontdoor/Azure.ResourceManager.FrontDoor - - sdk/grafana/Azure.ResourceManager.Grafana - - sdk/graphservices/Azure.ResourceManager.GraphServices - sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration - - sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules - - sdk/hdinsight/Azure.ResourceManager.HDInsight - - sdk/hdinsightcontainers/Azure.ResourceManager.HDInsight.Containers - - sdk/healthbot/Azure.ResourceManager.HealthBot - - sdk/healthcareapis/Azure.ResourceManager.HealthcareApis - - sdk/healthdataaiservices/Azure.ResourceManager.HealthDataAIServices - - sdk/hybridaks/Azure.ResourceManager.HybridContainerService - - sdk/hybridcompute/Azure.ResourceManager.HybridCompute - - sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity - - sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes - - sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork - - sdk/informaticadatamanagement/Azure.ResourceManager.InformaticaDataManagement - - sdk/iot/Azure.ResourceManager.IotFirmwareDefense - - sdk/iotcentral/Azure.ResourceManager.IotCentral - - sdk/iothub/Azure.ResourceManager.IotHub - - sdk/keyvault/Azure.ResourceManager.KeyVault - - sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration - - sdk/kusto/Azure.ResourceManager.Kusto - - sdk/labservices/Azure.ResourceManager.LabServices - - sdk/loadtestservice/Azure.ResourceManager.LoadTesting - sdk/logic/Azure.ResourceManager.Logic - - sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute - - sdk/machinelearningservices/Azure.ResourceManager.MachineLearning - - sdk/maintenance/Azure.ResourceManager.Maintenance - - sdk/managednetwork/Azure.ResourceManager.ManagedNetwork - - sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric - - sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities - - sdk/managedservices/Azure.ResourceManager.ManagedServices - - sdk/managementpartner/Azure.ResourceManager.ManagementPartner - - sdk/maps/Azure.ResourceManager.Maps - - sdk/marketplace/Azure.ResourceManager.Marketplace - - sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering + - sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting + - sdk/resourcegraph/Azure.ResourceManager.ResourceGraph + - sdk/agrifood/Azure.ResourceManager.AgFoodPlatform - sdk/mediaservices/Azure.ResourceManager.Media - - sdk/migrationdiscoverysap/Azure.ResourceManager.MigrationDiscoverySap - - sdk/mixedreality/Azure.ResourceManager.MixedReality - - sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork - - sdk/mongocluster/Azure.ResourceManager.MongoCluster - - sdk/monitor/Azure.ResourceManager.Monitor - - sdk/mysql/Azure.ResourceManager.MySql - - sdk/netapp/Azure.ResourceManager.NetApp - - sdk/network/Azure.ResourceManager.Network - - sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics - - sdk/networkcloud/Azure.ResourceManager.NetworkCloud + - sdk/keyvault/Azure.ResourceManager.KeyVault + - sdk/labservices/Azure.ResourceManager.LabServices + - sdk/azurelargeinstance/Azure.ResourceManager.LargeInstance - sdk/networkfunction/Azure.ResourceManager.NetworkFunction + - sdk/resources/Azure.ResourceManager.Resources + - sdk/storagecache/Azure.ResourceManager.StorageCache + - sdk/subscription/Azure.ResourceManager.Subscription + - sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity + - sdk/communication/Azure.ResourceManager.Communication + - sdk/customer-insights/Azure.ResourceManager.CustomerInsights + - sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup + - sdk/healthbot/Azure.ResourceManager.HealthBot + - sdk/marketplace/Azure.ResourceManager.Marketplace + - sdk/defendereasm/Azure.ResourceManager.DefenderEasm + - sdk/privatedns/Azure.ResourceManager.PrivateDns + - sdk/iothub/Azure.ResourceManager.IotHub - sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability - - sdk/nginx/Azure.ResourceManager.Nginx - - sdk/notificationhubs/Azure.ResourceManager.NotificationHubs - - sdk/openenergyplatform/Azure.ResourceManager.EnergyServices - - sdk/operationalinsights/Azure.ResourceManager.OperationalInsights - - sdk/oracle/Azure.ResourceManager.OracleDatabase - sdk/orbital/Azure.ResourceManager.Orbital - - sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw - - sdk/peering/Azure.ResourceManager.Peering - - sdk/playwrighttesting/Azure.ResourceManager.PlaywrightTesting - - sdk/policyinsights/Azure.ResourceManager.PolicyInsights + - sdk/signalr/Azure.ResourceManager.SignalR + - sdk/elastic/Azure.ResourceManager.Elastic + - sdk/netapp/Azure.ResourceManager.NetApp + - sdk/authorization/Azure.ResourceManager.Authorization + - sdk/grafana/Azure.ResourceManager.Grafana + - sdk/containerapps/Azure.ResourceManager.AppContainers + - sdk/healthcareapis/Azure.ResourceManager.HealthcareApis - sdk/postgresql/Azure.ResourceManager.PostgreSql - - sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated - - sdk/privatedns/Azure.ResourceManager.PrivateDns - - sdk/providerhub/Azure.ResourceManager.ProviderHub + - sdk/astronomer/Azure.ResourceManager.Astro + - sdk/avs/Azure.ResourceManager.Avs + - sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement + - sdk/servicefabric/Azure.ResourceManager.ServiceFabric + - sdk/hybridcompute/Azure.ResourceManager.HybridCompute + - sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis - sdk/purview/Azure.ResourceManager.Purview - - sdk/quantum/Azure.ResourceManager.Quantum + - sdk/appplatform/Azure.ResourceManager.AppPlatform + - sdk/databoxedge/Azure.ResourceManager.DataBoxEdge + - sdk/search/Azure.ResourceManager.Search - sdk/qumulo/Azure.ResourceManager.Qumulo - - sdk/quota/Azure.ResourceManager.Quota + - sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations + - sdk/containerorchestratorruntime/Azure.ResourceManager.ContainerOrchestratorRuntime + - sdk/standbypool/Azure.ResourceManager.StandbyPool + - sdk/datadog/Azure.ResourceManager.Datadog + - sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw + - sdk/botservice/Azure.ResourceManager.BotService + - sdk/devcenter/Azure.ResourceManager.DevCenter + - sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation + - sdk/automanage/Azure.ResourceManager.Automanage - sdk/recoveryservices/Azure.ResourceManager.RecoveryServices - - sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup - - sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication - - sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery - - sdk/redis/Azure.ResourceManager.Redis - - sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise - - sdk/relay/Azure.ResourceManager.Relay - - sdk/reservations/Azure.ResourceManager.Reservations - - sdk/resourceconnector/Azure.ResourceManager.ResourceConnector - - sdk/resourcegraph/Azure.ResourceManager.ResourceGraph - - sdk/resourcehealth/Azure.ResourceManager.ResourceHealth + - sdk/edgeorder/Azure.ResourceManager.EdgeOrder + - sdk/consumption/Azure.ResourceManager.Consumption + - sdk/blueprint/Azure.ResourceManager.Blueprint - sdk/resourcemover/Azure.ResourceManager.ResourceMover - - sdk/resources/Azure.ResourceManager.Resources - - sdk/search/Azure.ResourceManager.Search - - sdk/securitycenter/Azure.ResourceManager.SecurityCenter - - sdk/securitydevops/Azure.ResourceManager.SecurityDevOps - - sdk/securityinsights/Azure.ResourceManager.SecurityInsights - - sdk/selfhelp/Azure.ResourceManager.SelfHelp - - sdk/servicebus/Azure.ResourceManager.ServiceBus - - sdk/servicefabric/Azure.ResourceManager.ServiceFabric + - sdk/oracle/Azure.ResourceManager.OracleDatabase + - sdk/batch/Azure.ResourceManager.Batch + - sdk/eventgrid/Azure.ResourceManager.EventGrid + - sdk/analysisservices/Azure.ResourceManager.Analysis + - sdk/support/Azure.ResourceManager.Support + - sdk/billingbenefits/Azure.ResourceManager.BillingBenefits + - sdk/hdinsight/Azure.ResourceManager.HDInsight + - sdk/storage/Azure.ResourceManager.Storage - sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters - - sdk/servicelinker/Azure.ResourceManager.ServiceLinker - - sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking - - sdk/signalr/Azure.ResourceManager.SignalR + - sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine - sdk/sphere/Azure.ResourceManager.Sphere - - sdk/springappdiscovery/Azure.ResourceManager.SpringAppDiscovery + - sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization + - sdk/confluent/Azure.ResourceManager.Confluent + - sdk/powerbidedicated/Azure.ResourceManager.PowerBIDedicated + - sdk/mysql/Azure.ResourceManager.MySql + - sdk/informaticadatamanagement/Azure.ResourceManager.InformaticaDataManagement + - sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger + - sdk/edgezones/Azure.ResourceManager.EdgeZones + - sdk/healthdataaiservices/Azure.ResourceManager.HealthDataAIServices - sdk/sqlmanagement/Azure.ResourceManager.Sql - - sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine - - sdk/standbypool/Azure.ResourceManager.StandbyPool - - sdk/storage/Azure.ResourceManager.Storage + - sdk/network/Azure.ResourceManager.Network + - sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise + - sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql - sdk/storageactions/Azure.ResourceManager.StorageActions - - sdk/storagecache/Azure.ResourceManager.StorageCache - - sdk/storagemover/Azure.ResourceManager.StorageMover + - sdk/chaos/Azure.ResourceManager.Chaos + - sdk/quota/Azure.ResourceManager.Quota + - sdk/containerservice/Azure.ResourceManager.ContainerService + - sdk/iotcentral/Azure.ResourceManager.IotCentral + - sdk/advisor/Azure.ResourceManager.Advisor + - sdk/containerregistry/Azure.ResourceManager.ContainerRegistry + - sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights + - sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices - sdk/storagepool/Azure.ResourceManager.StoragePool - - sdk/storagesync/Azure.ResourceManager.StorageSync - - sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics - - sdk/subscription/Azure.ResourceManager.Subscription - - sdk/support/Azure.ResourceManager.Support + - sdk/attestation/Azure.ResourceManager.Attestation + - sdk/fluidrelay/Azure.ResourceManager.FluidRelay - sdk/synapse/Azure.ResourceManager.Synapse - - sdk/terraform/Azure.ResourceManager.Terraform - - sdk/trafficmanager/Azure.ResourceManager.TrafficManager - - sdk/trustedsigning/Azure.ResourceManager.TrustedSigning - sdk/voiceservices/Azure.ResourceManager.VoiceServices - - sdk/webpubsub/Azure.ResourceManager.WebPubSub - - sdk/websites/Azure.ResourceManager.AppService - - sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor - - sdk/workloads/Azure.ResourceManager.Workloads + - sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication + - sdk/computefleet/Azure.ResourceManager.ComputeFleet + - sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork + - sdk/managedservices/Azure.ResourceManager.ManagedServices + - sdk/servicelinker/Azure.ResourceManager.ServiceLinker + - sdk/providerhub/Azure.ResourceManager.ProviderHub + - sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml diff --git a/sdk/resourcemover/ci.mgmt.yml b/sdk/resourcemover/ci.mgmt.yml index 519b8a431926..bbb814c6a4f0 100644 --- a/sdk/resourcemover/ci.mgmt.yml +++ b/sdk/resourcemover/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/resourcemover/ci.mgmt.yml - sdk/resourcemover/Azure.ResourceManager.ResourceMover/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemover/ci.mgmt.yml + - sdk/resourcemover/Azure.ResourceManager.ResourceMover/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/resources/ci.mgmt.yml b/sdk/resources/ci.mgmt.yml index 3fefd5254c85..ff65cb96d07d 100644 --- a/sdk/resources/ci.mgmt.yml +++ b/sdk/resources/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/resources/ci.mgmt.yml - sdk/resources/Azure.ResourceManager.Resources/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resources/ci.mgmt.yml + - sdk/resources/Azure.ResourceManager.Resources/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/search/ci.mgmt.yml b/sdk/search/ci.mgmt.yml index a8c2a632c1c8..63c0e200644f 100644 --- a/sdk/search/ci.mgmt.yml +++ b/sdk/search/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/search/ci.mgmt.yml - sdk/search/Azure.ResourceManager.Search/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/search/ci.mgmt.yml + - sdk/search/Azure.ResourceManager.Search/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/securitycenter/ci.mgmt.yml b/sdk/securitycenter/ci.mgmt.yml index c728522efab2..6ed8ff4d67a9 100644 --- a/sdk/securitycenter/ci.mgmt.yml +++ b/sdk/securitycenter/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/securitycenter/ci.mgmt.yml - sdk/securitycenter/Azure.ResourceManager.SecurityCenter/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/securitycenter/ci.mgmt.yml + - sdk/securitycenter/Azure.ResourceManager.SecurityCenter/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/securitydevops/ci.mgmt.yml b/sdk/securitydevops/ci.mgmt.yml index c5a54a9ad206..972d98a7376e 100644 --- a/sdk/securitydevops/ci.mgmt.yml +++ b/sdk/securitydevops/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/securitydevops/ci.mgmt.yml - sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/securitydevops/ci.mgmt.yml + - sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/securityinsights/ci.mgmt.yml b/sdk/securityinsights/ci.mgmt.yml index f1d428ebef90..0659cac2858f 100644 --- a/sdk/securityinsights/ci.mgmt.yml +++ b/sdk/securityinsights/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/securityinsights/ci.mgmt.yml - sdk/securityinsights/Azure.ResourceManager.SecurityInsights/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/securityinsights/ci.mgmt.yml + - sdk/securityinsights/Azure.ResourceManager.SecurityInsights/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/selfhelp/ci.mgmt.yml b/sdk/selfhelp/ci.mgmt.yml index bb6a162210eb..ac13ec845ce7 100644 --- a/sdk/selfhelp/ci.mgmt.yml +++ b/sdk/selfhelp/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/selfhelp/ci.mgmt.yml - sdk/selfhelp/Azure.ResourceManager.SelfHelp/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/selfhelp/ci.mgmt.yml + - sdk/selfhelp/Azure.ResourceManager.SelfHelp/ + extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/servicebus/ci.mgmt.yml b/sdk/servicebus/ci.mgmt.yml index 02c45dc88e18..f2ead205ced6 100644 --- a/sdk/servicebus/ci.mgmt.yml +++ b/sdk/servicebus/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/servicebus/ci.mgmt.yml - sdk/servicebus/Azure.ResourceManager.ServiceBus/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/servicebus/ci.mgmt.yml + - sdk/servicebus/Azure.ResourceManager.ServiceBus/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/servicefabric/ci.mgmt.yml b/sdk/servicefabric/ci.mgmt.yml index 430f48c8c87b..afc886a4f7f2 100644 --- a/sdk/servicefabric/ci.mgmt.yml +++ b/sdk/servicefabric/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/servicefabric/ci.mgmt.yml - sdk/servicefabric/Azure.ResourceManager.ServiceFabric/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/servicefabric/ci.mgmt.yml + - sdk/servicefabric/Azure.ResourceManager.ServiceFabric/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/servicefabricmanagedclusters/ci.mgmt.yml b/sdk/servicefabricmanagedclusters/ci.mgmt.yml index e73289f589f4..022ac0f03cd1 100644 --- a/sdk/servicefabricmanagedclusters/ci.mgmt.yml +++ b/sdk/servicefabricmanagedclusters/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/servicefabricmanagedclusters/ci.mgmt.yml - sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/servicefabricmanagedclusters/ci.mgmt.yml + - sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/servicelinker/ci.mgmt.yml b/sdk/servicelinker/ci.mgmt.yml index 77df314e977a..6069e04a3157 100644 --- a/sdk/servicelinker/ci.mgmt.yml +++ b/sdk/servicelinker/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/servicelinker/ci.mgmt.yml - sdk/servicelinker/Azure.ResourceManager.ServiceLinker/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/servicelinker/ci.mgmt.yml + - sdk/servicelinker/Azure.ResourceManager.ServiceLinker/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/servicenetworking/ci.mgmt.yml b/sdk/servicenetworking/ci.mgmt.yml index b2332ae15224..4551f1325475 100644 --- a/sdk/servicenetworking/ci.mgmt.yml +++ b/sdk/servicenetworking/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/servicenetworking/ci.mgmt.yml - sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/servicenetworking/ci.mgmt.yml + - sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/signalr/ci.mgmt.yml b/sdk/signalr/ci.mgmt.yml index c934ed4314fa..f066849c56a1 100644 --- a/sdk/signalr/ci.mgmt.yml +++ b/sdk/signalr/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/signalr/ci.mgmt.yml - sdk/signalr/Azure.ResourceManager.SignalR/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/signalr/ci.mgmt.yml + - sdk/signalr/Azure.ResourceManager.SignalR/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/sphere/ci.mgmt.yml b/sdk/sphere/ci.mgmt.yml index f3f33e9d00f4..749774244735 100644 --- a/sdk/sphere/ci.mgmt.yml +++ b/sdk/sphere/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/sphere/ci.mgmt.yml - sdk/sphere/Azure.ResourceManager.Sphere/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/sphere/ci.mgmt.yml + - sdk/sphere/Azure.ResourceManager.Sphere/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/springappdiscovery/ci.mgmt.yml b/sdk/springappdiscovery/ci.mgmt.yml index 7676386684df..f86c14368089 100644 --- a/sdk/springappdiscovery/ci.mgmt.yml +++ b/sdk/springappdiscovery/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/springappdiscovery/ci.mgmt.yml - sdk/springappdiscovery/Azure.ResourceManager.SpringAppDiscovery/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/springappdiscovery/ci.mgmt.yml + - sdk/springappdiscovery/Azure.ResourceManager.SpringAppDiscovery/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/sqlmanagement/ci.mgmt.yml b/sdk/sqlmanagement/ci.mgmt.yml index da93d03f2d33..8377a2663681 100644 --- a/sdk/sqlmanagement/ci.mgmt.yml +++ b/sdk/sqlmanagement/ci.mgmt.yml @@ -2,6 +2,7 @@ # This file is generated automatically and any changes will be lost. trigger: none + pr: branches: include: @@ -14,6 +15,18 @@ pr: - sdk/sqlmanagement/ci.mgmt.yml - sdk/sqlmanagement/Azure.ResourceManager.Sql/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/sqlmanagement/ci.mgmt.yml + - sdk/sqlmanagement/Azure.ResourceManager.Sql/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/sqlvirtualmachine/ci.mgmt.yml b/sdk/sqlvirtualmachine/ci.mgmt.yml index 28c6192fa86b..049e315855ed 100644 --- a/sdk/sqlvirtualmachine/ci.mgmt.yml +++ b/sdk/sqlvirtualmachine/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/sqlvirtualmachine/ci.mgmt.yml - sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/sqlvirtualmachine/ci.mgmt.yml + - sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/standbypool/ci.mgmt.yml b/sdk/standbypool/ci.mgmt.yml index 0763a516e2c1..54ce1137a123 100644 --- a/sdk/standbypool/ci.mgmt.yml +++ b/sdk/standbypool/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/standbypool/ci.mgmt.yml - sdk/standbypool/Azure.ResourceManager.StandbyPool/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/standbypool/ci.mgmt.yml + - sdk/standbypool/Azure.ResourceManager.StandbyPool/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/storage/ci.mgmt.yml b/sdk/storage/ci.mgmt.yml index 95bc19b325d5..6f05608983be 100644 --- a/sdk/storage/ci.mgmt.yml +++ b/sdk/storage/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/storage/ci.mgmt.yml - sdk/storage/Azure.ResourceManager.Storage/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/storage/ci.mgmt.yml + - sdk/storage/Azure.ResourceManager.Storage/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/storageactions/ci.mgmt.yml b/sdk/storageactions/ci.mgmt.yml index 27062b4565a8..b27838343a2e 100644 --- a/sdk/storageactions/ci.mgmt.yml +++ b/sdk/storageactions/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/storageactions/ci.mgmt.yml - sdk/storageactions/Azure.ResourceManager.StorageActions/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/storageactions/ci.mgmt.yml + - sdk/storageactions/Azure.ResourceManager.StorageActions/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/storagecache/ci.mgmt.yml b/sdk/storagecache/ci.mgmt.yml index c6abf63baf2c..84c922940939 100644 --- a/sdk/storagecache/ci.mgmt.yml +++ b/sdk/storagecache/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/storagecache/ci.mgmt.yml - sdk/storagecache/Azure.ResourceManager.StorageCache/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/storagecache/ci.mgmt.yml + - sdk/storagecache/Azure.ResourceManager.StorageCache/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/storagemover/ci.mgmt.yml b/sdk/storagemover/ci.mgmt.yml index e9055f49e1a9..4e45261a60aa 100644 --- a/sdk/storagemover/ci.mgmt.yml +++ b/sdk/storagemover/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/storagemover/ci.mgmt.yml - sdk/storagemover/Azure.ResourceManager.StorageMover/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/storagemover/ci.mgmt.yml + - sdk/storagemover/Azure.ResourceManager.StorageMover/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/storagepool/ci.mgmt.yml b/sdk/storagepool/ci.mgmt.yml index 2178fc390757..6592a12a262a 100644 --- a/sdk/storagepool/ci.mgmt.yml +++ b/sdk/storagepool/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/storagepool/ci.mgmt.yml - sdk/storagepool/Azure.ResourceManager.StoragePool/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/storagepool/ci.mgmt.yml + - sdk/storagepool/Azure.ResourceManager.StoragePool/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/storagesync/ci.mgmt.yml b/sdk/storagesync/ci.mgmt.yml index a8789947c687..b9fcbb66b30f 100644 --- a/sdk/storagesync/ci.mgmt.yml +++ b/sdk/storagesync/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/storagesync/ci.mgmt.yml - sdk/storagesync/Azure.ResourceManager.StorageSync/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/storagesync/ci.mgmt.yml + - sdk/storagesync/Azure.ResourceManager.StorageSync/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/streamanalytics/ci.mgmt.yml b/sdk/streamanalytics/ci.mgmt.yml index 09d108a1a7d9..860cd851bbd1 100644 --- a/sdk/streamanalytics/ci.mgmt.yml +++ b/sdk/streamanalytics/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/streamanalytics/ci.mgmt.yml - sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/streamanalytics/ci.mgmt.yml + - sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/subscription/ci.mgmt.yml b/sdk/subscription/ci.mgmt.yml index f9067b4c0af3..a00a0e9c56ad 100644 --- a/sdk/subscription/ci.mgmt.yml +++ b/sdk/subscription/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/subscription/ci.mgmt.yml - sdk/subscription/Azure.ResourceManager.Subscription/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/subscription/ci.mgmt.yml + - sdk/subscription/Azure.ResourceManager.Subscription/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/support/ci.mgmt.yml b/sdk/support/ci.mgmt.yml index 5a947c4c4939..d5c857ad8346 100644 --- a/sdk/support/ci.mgmt.yml +++ b/sdk/support/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/support/ci.mgmt.yml - sdk/support/Azure.ResourceManager.Support/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/support/ci.mgmt.yml + - sdk/support/Azure.ResourceManager.Support/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/synapse/ci.mgmt.yml b/sdk/synapse/ci.mgmt.yml index 0a089a504291..18c8132c4803 100644 --- a/sdk/synapse/ci.mgmt.yml +++ b/sdk/synapse/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/synapse/ci.mgmt.yml - sdk/synapse/Azure.ResourceManager.Synapse/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/synapse/ci.mgmt.yml + - sdk/synapse/Azure.ResourceManager.Synapse/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/terraform/ci.mgmt.yml b/sdk/terraform/ci.mgmt.yml index 82c4c1f05a4c..5f7b3d41fb27 100644 --- a/sdk/terraform/ci.mgmt.yml +++ b/sdk/terraform/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/terraform/ci.mgmt.yml - sdk/terraform/Azure.ResourceManager.Terraform/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/terraform/ci.mgmt.yml + - sdk/terraform/Azure.ResourceManager.Terraform/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/trafficmanager/ci.mgmt.yml b/sdk/trafficmanager/ci.mgmt.yml index 528f78b70b96..86b17c08ac4e 100644 --- a/sdk/trafficmanager/ci.mgmt.yml +++ b/sdk/trafficmanager/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/trafficmanager/ci.mgmt.yml - sdk/trafficmanager/Azure.ResourceManager.TrafficManager/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/trafficmanager/ci.mgmt.yml + - sdk/trafficmanager/Azure.ResourceManager.TrafficManager/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/trustedsigning/ci.mgmt.yml b/sdk/trustedsigning/ci.mgmt.yml index 5b67358a4477..07fb171ee416 100644 --- a/sdk/trustedsigning/ci.mgmt.yml +++ b/sdk/trustedsigning/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/trustedsigning/ci.mgmt.yml - sdk/trustedsigning/Azure.ResourceManager.TrustedSigning/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/trustedsigning/ci.mgmt.yml + - sdk/trustedsigning/Azure.ResourceManager.TrustedSigning/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/voiceservices/ci.mgmt.yml b/sdk/voiceservices/ci.mgmt.yml index a914d1640296..64ea2eb63c0f 100644 --- a/sdk/voiceservices/ci.mgmt.yml +++ b/sdk/voiceservices/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/voiceservices/ci.mgmt.yml - sdk/voiceservices/Azure.ResourceManager.VoiceServices/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/voiceservices/ci.mgmt.yml + - sdk/voiceservices/Azure.ResourceManager.VoiceServices/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/webpubsub/ci.mgmt.yml b/sdk/webpubsub/ci.mgmt.yml index 6bcb8439a2b0..a312a96feb5a 100644 --- a/sdk/webpubsub/ci.mgmt.yml +++ b/sdk/webpubsub/ci.mgmt.yml @@ -1,5 +1,6 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -12,6 +13,18 @@ pr: - sdk/webpubsub/ci.mgmt.yml - sdk/webpubsub/Azure.ResourceManager.WebPubSub/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/webpubsub/ci.mgmt.yml + - sdk/webpubsub/Azure.ResourceManager.WebPubSub/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/websites/ci.mgmt.yml b/sdk/websites/ci.mgmt.yml index d67c580bc414..4dbf184acc87 100644 --- a/sdk/websites/ci.mgmt.yml +++ b/sdk/websites/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/websites/ci.mgmt.yml - sdk/websites/Azure.ResourceManager.AppService/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/websites/ci.mgmt.yml + - sdk/websites/Azure.ResourceManager.AppService/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/workloadmonitor/ci.mgmt.yml b/sdk/workloadmonitor/ci.mgmt.yml index 7c6a51fbe75c..e834be340ea9 100644 --- a/sdk/workloadmonitor/ci.mgmt.yml +++ b/sdk/workloadmonitor/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/workloadmonitor/ci.mgmt.yml - sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/workloadmonitor/ci.mgmt.yml + - sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: diff --git a/sdk/workloads/ci.mgmt.yml b/sdk/workloads/ci.mgmt.yml index e3457d69ceaa..bf3983053473 100644 --- a/sdk/workloads/ci.mgmt.yml +++ b/sdk/workloads/ci.mgmt.yml @@ -1,6 +1,7 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none + pr: branches: include: @@ -13,6 +14,18 @@ pr: - sdk/workloads/ci.mgmt.yml - sdk/workloads/Azure.ResourceManager.Workloads/ + + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/workloads/ci.mgmt.yml + - sdk/workloads/Azure.ResourceManager.Workloads/ + extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: