From ab9776199f5c45906356ffb4ddf23a28f3819b51 Mon Sep 17 00:00:00 2001 From: matthohn-msft <89162957+matthohn-msft@users.noreply.github.com> Date: Tue, 7 Nov 2023 10:27:47 -0800 Subject: [PATCH] SDK update for 2023-06-01-preview (#39399) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Prepare for WebJobs Storage Extension Release (#38943) * [AppConfiguration] Fix: GetConfigurationSettings does not set the ContentType property (#38917) * Adding Hold/Unhold capabilities to ACS. (#38858) * Adding hold/unhold * Updating swagger * Fixing last merge * Adding tests and missing apis * Exporting new APIs * Updating swagger * Adding missing files * Updating docstring * Export API * Updating swagger location * Update AutoRest C# version to 3.0.0-beta.20230924.2 (#38934) * Update Generator Version 3.0.0-beta.20230924.2 * Update SDK codes * remove unused Etag customization --------- Co-authored-by: FAREAST\chunyu * [Network] Fix partial resource (#38110) * Increment package version after release of Azure.ResourceManager.DataProtectionBackup (#38953) * Update Generator Version 3.0.0-beta.20230925.2 (#38955) * Increment version for storage releases (#38946) * Increment package version after release of Microsoft.Azure.WebJobs.Extensions.Storage.Blobs * Increment package version after release of Microsoft.Azure.WebJobs.Extensions.Storage.Queues * Increment package version after release of Microsoft.Azure.WebJobs.Extensions.Storage * Increment package version after release of Azure.ResourceManager.Network (#38957) * Increment package version after release of Azure.ResourceManager.RecoveryServicesSiteRecovery (#38958) * Increment package version after release of Azure.ResourceManager.Chaos (#38956) * Fleet .NET SDK generation (#38873) * Increment package version after release of Azure.ResourceManager.DatabaseFleetManager (#38960) * DataMovement Test Infra: In-Memory StorageResources (#38941) * memoryresources initial implementation * revised implementaoin * testing memoryitem * test container * [DataFactory]Upgrade SDK Version To 1.0.0-beta.4 (#38930) * Increment package version after release of Azure.ResourceManager.DataFactory (#38967) * [Network] Fix HopLink format error issue when resourceId return "" (#38876) * [FormRecognizer] Cleaning up misc operations live tests (#38807) * Update messaging stress to use addons parallel job configuration (#38949) * Vendor OpenTelemetry.NET Instrumentation Libraries into Azure.Monitor.OpenTelemetry.AspNetCore (#38848) * Vendoring * Update copyrights * Update Notice file * Remove the default OpenTelemetry instrumentation options customization from the README. (#38970) * Remove OpenTelemetry ASP.NET Core and HTTP metrics. (#38972) * DataMovment `StorageResourceContainer` internal hooks to protected APIs (#38968) * internals access class and hookup to file * applied to blobs * docsting * Implemention ShareFileStorageResource (#38938) * WIP * Implemented base file storage resource; Testst * Export API * Attempt to fix double dependency files in tests * Addressing PR comments; Added StorageResourceItemInternal * Rename internal methods * PR Comments for tests * CHange out verify parameters with the mock verify method * Support typespec to sdk preview pipeline (#38576) * Add changes to support typespec preview pipeline * Revert whitespace changes * Improve error logging in Update-dotnet-GeneratedSdks * Update Monitor labels (#38974) * Change prod maintenance day. Fix stress watcher deploy (#38948) Co-authored-by: Ben Broderick Phillips * Azure Deployment Manager is being decommissioned. Remove its NET SDK through this PR (#38614) * Update Generator Version 3.0.0-beta.20230926.2 (#38979) * Update AutoRest C# version to 3.0.0-beta.20230927.1 (#38987) * fix (#38995) * [AppConfig] Allow unknown condition members (#38971) * [AppConfig] Allow unknown condition members The focus of these changes is to allow for unknown members to be present in the `conditions` property of a feature flag configuration setting. Previously, these were ignored as the setting assumed that `conditions` should be treated as a well-known member. This change moves the well-known member to `conditions/client_filters` and preserves unknown children of `conditions`. * Enabled STG 91 live tests (#38990) * [Core] Adding attributes to support Native AOT compiling (#37734) * part 1 * additional changes * additional attributes * additional attributes * adding diagnosticscope attributes * updating messages * more fixes * additional updates * updates * PR feedback * API update * removing unnecessary warnings * reverting attribute on HttpPipelineSynchronousPolicy * update api * updates * update * API export * WIP fix 1 * WIP * attribute adjustments * adding compatibility test * WIP adding test * WIP API * WIP * WIP * updates * add test script and remove #if statements * fixing build * Update Program.cs * adding some compile statements * Update AzureCoreEventSource.cs * build fix attempt * fix built attempt 2 * Update MutableJsonChange.cs * Update MutableJsonChange.cs * Update MutableJsonDocument.cs * Update HttpPipelineSynchronousPolicy.cs * adding comments * PR fb 1 * test * test2 * test3 * attempt * additional build fixes * Remove comment * PR feedback + fixing impacts of feedback changes * fixes * Update GeoRedundantFallbackPolicy.cs * Update GeoRedundantFallbackPolicy.cs * Update GeoRedundantFallbackPolicy.cs * fix * add tests * pipeline fixes * update comments * feedback * adjustments * adjustment * pipeline fix * PR feedback 1 * Apply suggestions from code review Co-authored-by: Vitek Karas <10670590+vitek-karas@users.noreply.github.com> * PR feedback updates 2 * Update sdk/core/Azure.Core/src/Shared/DiagnosticScope.cs Co-authored-by: Vitek Karas <10670590+vitek-karas@users.noreply.github.com> * need one other suppression * remove 2 annotations + update suppression message * removing all attributes from RequestContentHelper * tweak justification * removing test project from Azure.Core, will be adding feedback to general CI pipeline * WIP * feedback * Update sdk/core/Azure.Core/src/Shared/DiagnosticScope.cs Co-authored-by: Anne Thompson * fix attribute and add comments * Addressing feedback * adding net 5 preprocessor directives * Update sdk/core/Azure.Core/src/DynamicData/MutableJsonElement.cs Co-authored-by: Vitek Karas <10670590+vitek-karas@users.noreply.github.com> * remove unused const * pipeline fix --------- Co-authored-by: Vitek Karas <10670590+vitek-karas@users.noreply.github.com> Co-authored-by: Anne Thompson * [Text Translation] Options Parameter for Translate and Transliterate (#38760) * Options Parameter for Translate and Transliterate * Remove empty options constructor, add new samples and recorded tests, update documentation. * Update CHANGELOG.md and assets.json, fixed bug in TranslationLiveTests.cs * Deleting unnecessary SessionRecords test files. --------- Co-authored-by: Rango Meadows * Add rules for convenience method and protocol method (#38603) * Add rules for convenience method and protocol method * update * Increment version for managednetworkfabric releases (#39010) * Update AutoRest C# version to 3.0.0-beta.20230927.3 (#39013) * ShareDirectoryClient extensions (#38993) * ShareDirectoryClient extensions * removed mention of blobs * exportapi * fix tests * Update AutoRest C# version to 3.0.0-beta.20230928.1 (#39017) * Added transcription APIs and events (#38988) * Autorest generated code * Adding SDK methods for start, stop and update transcription * Add transcription options for the create & answer call * Adding events * Adding event parser test cases * Adding tests * Refactoring code to make options param optional * Adding models and parser for the transcription schema * Fixing enum conversion logic for transcription schema * Cleaning up code * Add transcription options in create/answer/group call and tests * Updted TranscriptionUpdate to take TranscriptionUpdate and TranscriptionStatusDetails as enums * Fixed API typo * Adding SDK methods for start, stop and update transcription * Add transcription options for the create & answer call * Adding models and parser for the transcription schema * Adding events * Adding event parser test cases * Adding tests * Refactoring code to make options param optional * Fixing enum conversion logic for transcription schema * Cleaning up code * Add transcription options in create/answer/group call and tests * Updted TranscriptionUpdate to take TranscriptionUpdate and TranscriptionStatusDetails as enums * Fixed API typo * Updated contract after rebase * Removed duplicate tests * Update in transcription ws schema * Fixed TranscriptionOptions review comment * Fixing TranscriptionOptions arguments in create call, group call & answer call * Fixing build issues --------- Co-authored-by: abhishesingh-msft * Modified storage ARM template to point at built-in Files RBAC role (#39018) * Add support for settlement from the isolated worker extension (#38865) * Add support for settlement from the isolated worker extension * Update comment * roll back version of Grpc.Tools * roll back further * PR fb * Revert eventArgs fields to private * remove in finally block * Fix test and move versions to package.data.props * Update sdk/servicebus/Microsoft.Azure.WebJobs.Extensions.ServiceBus/src/Listeners/ServiceBusListener.cs Co-authored-by: Jesse Squire * Add batch test cases * Fix tests * Fix --------- Co-authored-by: Jesse Squire * Update the migration guide. (#38961) * [ARM] Updating Azure.ResourceManager.MachineLearning to generate for … (#38814) * Increment package version after release of Azure.ResourceManager.MachineLearning (#39035) * Increment package version after release of Azure.ResourceManager.RecoveryServicesDataReplication (#39034) * add traling slash to directory wildcard entries (#39038) * Update CODEOWNERS (#39039) Just testing to see if this path isn't recognizing owners because the ones there were invalid * Revert "Update CODEOWNERS (#39039)" (#39040) This reverts commit ec8e5bb1cfb86d8824de5ac3c3973dc1e920fd1c. * Remove old check enforcer comment template (#39042) * [JimBot] Remove CXP Attention (#39036) Removing config for the dead CXP Attention rule * Multi-tenant tests added as recorded tests (#38992) * TokenExchangeManagedIdentitySource with async IO (#38939) * Add AOT target for Key Vault SDK (#38721) * Add AOT target for Key Vault SDK Resolves #38500 * Rebase on main, resolve PR feedback * Detect Instrumentation Package and Backoff (#39001) * AddVendorInstrumentationIfPackageNotReferenced * PR feedback. * event souce fix. * Replace LocalFilesStorageResourceProvider.FromPath with FromFile and Directory (#39053) * Replace LocalFilesStorageResourceProvider.FromPath with FromFile and FromDirectory * Export API * Update snippets * Sync eng/common directory with azure-sdk-tools for PR 7040 (#39052) * Remove codeowners resolution logic from docs scripts * Remove parameters that aren't needed * Remove auth information from update-docsms-metadata.yml --------- Co-authored-by: Daniel Jurek * Add support for Key Vault 7.5-preview.1 (#38377) * Add support for Key Vault 7.5-preview.1 Also treats KeyRotationPolicyAction as case-insensitive. * Update public APIs * Use latest commit Resolves #38729 * [AzureMonitorExporter] resolve AOT warnings (#38459) * initial commit * build fix * workaround for StackFrame.GetMethod() * cleanup * fix test * remove TrimmingAttribute.cs * temp disable ApiCompat * cleanup * test fix for ApiCompat * update comment * add aotcompat test app * add readme * readme * recommended fix for ApiCompat * comment * test fix for validation errors re: aotcompat directory * isolate StackFrame.GetMethod * cleanup * isolate StackFrame.GetMethod (2) * add comment. * fix * pr feedback * update comment * fix script * refactor as extension method * cleanup * Transcription package fix: (#39066) 1> Made non-internal TranscriptionData & Word classes as public 2> Rename Word to WordData, as single word classes are not allowed 3> Cleanup vars & references * removed mock resource types (#39020) Now uses internal types elsewhere in the inheritance line * Remove AAD credentials from Service-Level-Readme-Automation.ps1 invocation (#39061) * [Storage][DataMovement] Update checkpointer to read/write to job file - Part 1 (#39057) * [DataMovement] Adding Tests for Recorded File Upload (Add fix Creating File at Initial Start) (#39037) * Added Single Share File Upload Tests; Create before putrange * WIP * Removed testbase for startTransfer upload test base; other pr comments * Vendor OpenTelemetry.ResourceDetectors.Azure resource detector package. (#39076) * Richardcho/cancel live test (#38969) * add live test * record test * ignore test --------- Co-authored-by: root * Update Changelog/Readme for Azure.Monitor.OpenTelemetry.AspNetCore (#39077) * Update Changelog * Remove forked. * Update Readme * pr feedback * Update API Comment. * Update changelog * [Search] Regenerate code using 2023-10-01-preview API version (#38925) * Regenerate code * Replace Azure.Monitor.OpenTelemetry.Exporter project reference with Package Reference. (#39082) * Removed unnecessary .Models.Events namespace (#39075) * Added Support for PSTN Dial-Out Feature For ACS Rooms (.NET) SDK (#38837) * Updated ACS Rooms .NET SDK to Support PSTN DialOut Feature * Removed Auto Script Generation Snippet From Older Test Class * Updated Readme Link * Updated new tag in Rooms assets.json * Updated ChangeLog and Generated new export API * Modified UpdateRoom Signagure and Renamed Variables * Updated ReadMe and added more test scenarios * Update ReadMe * Update ReadMe with Snippets * Updated Rooms Sample * Updated Codes Per SDK Reviews * Updated ChangeLog * Fix the assembly load that validates the package reference. (#39091) * [AzureMonitorDistro] Update the troubleshooting section in the Readme (#39096) * Update Readme * pr feedback * pr feedback * Prepare new release: Distro beta8 (#39100) * Ignoring case (#39105) * Prep for release (#39108) * [Search] Update changelog for "11.5.0-beta.5" release (#39102) [Search] Update changelog for "11.5.0-beta.5" release. * [Azure.Monitor.Ingestion] Fix Sovereign Support for Ingestion (#39078) * [App Config] Update snapshot API and changelog for "1.3.0-beta.3" release (#39116) [App Config] Update snapshot API and changelog for "11.5.0-beta.5" release * Updating package version for configured workflows (#39119) Co-authored-by: Jesse Squire * [Search] Add a work around to fix CreateAzureBlobIndexer test (#39117) * Renamed Storage PublicAudience to DefaultAudience, Get..Audience to Create..Audience (#39083) * Increment package version after release of Azure.Monitor.OpenTelemetry.AspNetCore (#39129) * Add livetests to PPE (#39110) * Update tests.yml * Skip SIP tests on int and ppe * Skip SIP tests on ppe * Add flag to skip sip configuration tests * Add flag to skip sip configuration in matrix * Update to net462 * Remove Siprounting flag * Remove Siprounting flag from matrix * Add Siprounting flag to matrix * Detect all file diff types for eng/common changes (#39128) Fixes https://github.com/Azure/azure-sdk-tools/issues/5882 We need to set the difffilter to empty instead of the default of exclude deleted files when we are trying to verify there are no changes under eng/common. See test PR https://github.com/Azure/azure-sdk-for-python/pull/32348 which demonstrates us not detecting a deleted file under eng/common. I'll use that same test PR to verify this now catches that issue. Co-authored-by: Wes Haggard * Adding CorrelationId to TranscriptionMetadata (#39130) * Update ChangeLog file (#39125) * [Storage][DataMovement] Update checkpointer to read/write to job file - Part 2 (#39101) * Release Azure.ResourceManager.ContainerServiceFleet (#39106) * Release Azure.ResourceManager.ContainerServiceFleet * update * Increment package version after release of Azure.ResourceManager.ContainerServiceFleet (#39139) * fix pageable operation issue in purview administration library (#39009) * use directive to set api-version as client for Resources_GetById (#39141) * Update AutoRest C# version to 3.0.0-beta.20231008.1 (#39143) * Update Generator Version 3.0.0-beta.20231008.1 * Update SDK codes * Update SDK codes * Update SDK codes * Update SDK codes * Update SDK codes * Update SDK codes * Update Generator Version 3.0.0-beta.20231008.2 (#39148) * [WebPubSubClient] Parsing message returns IList (#39137) * Parsing message returns IList * update api * Use IReadonlyList * Update CHANGELOG.md (#39160) * Increment package version after release of Azure.Search.Documents (#39161) * [Azure.Monitor.Inestion] Update CHANGELOG.md for GA Release (#39165) * Adding Support to override the ClientRequestID guid format for test recording sessions. (#39133) * adding an enviroment variable "RECORDING_DEFAULT_ClIENT_GUID" to support using the default string format for ClientID's in test recording mode * changing code to support storing the enviroment variable into the test recordings variables * handling the case if the variable is not present in the recording * changing from enviroment var to property of RecordedTestBase * removing files * whitespace fix * update * recovered deleted file * restored deleted code * fix * feedback (cherry picked from commit 240efa7ad801712117eb3624791431f92aa132d6) * removed dead code * whitespace * Move ResourcesRestOperations to generated (#39150) * Move most of ResourcesRestOperations to generated * make api-version as method parameter for Resources_GetById * Add comments * Increment package version after release of Azure.Data.AppConfiguration (#39169) * Increment package version after release of Azure.Monitor.Ingestion (#39168) * Update Generator Version 3.0.0-beta.20231009.1 (#39173) * Add azure communication messages sdk (#39167) * Add Messages SDK * Work around the issue with nextLink never empty, add more tests * Update CHANGELOG.md * Update autorest and use Github link for input file * Update README.md * dropping the Value suffix on everything but the base class (MessageTemplateValue) * change the param name from url to uri, filename to fileName * Update CHANGELOG.md * revert accidental check in of RecordedTestMode * sanitize session records * remove unneeded import * update to 2023-08-24-preview api version * update CommunicationMessagesClientOptions api version to 2023-08-24-preview * re-run live test recording * fix broken link * use latest swagger * Remove unsupported auth type, add more live tests, and re-run the live tests * use the swagger that does not have operation-id response header * Take Value suffix off MessageTemplateQuickAction * update sdk to latest - change autorest to using readme instead of swagger input-file - update Butotn from IDictionary to IEnumerable for maintaining orders - autorest point to azure-rest-api-specs-pr - re-run live tests to get new session records * update the source file to the public azure specs repo * fix recording * run "eng\scripts\Export-API.ps1 communication" * run "eng\scripts\CodeChecks.ps1 -ServiceDirectory communication" * Prepare for release (#39184) * Replace Azure.Identity AAD references (#39123) * [Storage][DataMovement] Add ProviderId to resources and job plan file (#39163) * Update github-event-processor version to 1.0.0-dev.20231010.2 (#39189) Co-authored-by: James Suplizio * Fixed tansxription review comments (#39195) * Increment package version after release of Azure.Communication.Messages (#39185) * Fix broken link (#39188) * Prepare for release (#39203) * Increment package version after release of Microsoft.Azure.WebJobs.Extensions.EventHubs (#39201) * Add new system events (#39202) * Add new system events * Fix source generator * refactor * Prepare for release (#39205) * Use url version spec for autorest.* packages (#39131) Co-authored-by: Patrick Hallisey * Increment package version after release of Azure.Messaging.ServiceBus (#39204) * Fix OperationalInsights Type Issue (#38425) * update * update * [Core] Update RequestFailedException to use source generation for serialization (#38996) * iteration 1 * iteration 1 * tweak logic * simplification * adjust comments * Update sdk/core/Azure.Core/src/RequestFailedException.cs Co-authored-by: Eric Erhardt * feedback fixes --------- Co-authored-by: Eric Erhardt * Rename property in ResourceNotificationsResourceUpdatedDetails (#39210) * Use better description for single repo sparse checkout (#39209) Co-authored-by: Patrick Hallisey * Document sovereign cloud support in LogsIngestionClient (#39221) * Dispose clients on host shutdown rather than listener dispose (#39225) * Dispose clients on host shutdown rather than listener dispose * Remove project reference * Update version - for some reason the auto-update job failed * Update Generator Version 3.0.0-beta.20231012.5 (#39239) * Add PauseOnStart Recording Option (#39132) * generated files using swagger * removed extra swagger file * modified unit tests * undo status code change for mute participant in generated files * merged with main * merged with main * reverted 202 change * Both status code changed to 202 * modified test cases to check for 200 status code * regenerated code * regenerated code * Revert "regenerated code" This reverts commit a5a9e0e5b8296fbf90a49dc8ebacd62f75298690. * Added TransciptionDataRequest Change * generated from latest swagger * generated netstandard2.0.cs * edited changelog * Revert "generated netstandard2.0.cs" This reverts commit 2a39b2d865a5a223e0edaf7e3615dc16562e85b7. * Revert "edited changelog" This reverts commit 7eb14250f0a123983d82e606ed8c7fb5d4585a86. * added line to changelog and standard2.0.cs * Update CHANGELOG.md * [NetAppFiles] Update to api-version 2023-05-01 (#38882) * Update to api-version 2023-05-01 * SystemData * Sync + systemdata * update assets * update assets * s2ync * EB.Never * EB.Never missing using ?? * export api * change changelog * assets * assets * assets * add autorest changes to support fleet issues (#39172) * Increment package version after release of Azure.ResourceManager.ContainerServiceFleet (#39256) * Increment package version after release of Azure.Messaging.EventGrid (#39262) * Refactor cleanup (#39264) * Fix CODEOWNERS for missing paths and other fun stuff (#39269) * Fix CODEOWNERS for missing paths and other fun stuff * Fix the label entry, without the % it isn't recognized as a label * [Storage][DataMovement] Fix several issues with pause/resume (#39208) * [Azure.Monitor.Ingestion] Update CHANGELOG.md (#39234) * Update code owners list in the .NET repo (#39180) * Update codeowners list. * Autorest Regen Preview to 3.0.0-alpha.20231013.8 by Michael Nash from refs/pull/3810/head (#39275) * Update Generator Version 3.0.0-alpha.20231013.8 * Update SDK codes he_ma_3 * Update SDK codes da_he_2 * Update SDK codes me_pu_4 * customize the access for ImageSize * update devcenter api * update custom code to use new reponse type * customize deserialization for lro return type change * Update Generator Version 3.0.0-beta.20231013.1 --------- Co-authored-by: m-nash * Release stable version 2022-12-27 of HybridCompute (#39217) * release stable version * update code * update code * update code * Increment package version after release of Azure.Communication.Rooms (#39231) * [Core] Add `DiagnosticScope` test and removing bug workarounds that are no longer needed (#39274) * new tests * formatting * [Schema registry] Stream fix / typo (#39270) * fixes * Update sdk/schemaregistry/Azure.Data.SchemaRegistry/samples/Sample02_Serialization.md Co-authored-by: Jesse Squire --------- Co-authored-by: Jesse Squire * Makes AzureKeyVaultConfigurationSource a public class (#39099) * Makes AzureKeyVaultConfigurationSource a public class * Updates generated code * [Extensions]: Update KeyVault Config change log (#39292) The focus of these changes is to update the change log for the KeyVault configuration package to acknowledge the recent contribution for exposing the config section as public. * Set product as parent of package work item. (#39156) Co-authored-by: praveenkuttappan * [ACS JobRouter] DPG Models (#38868) * missing usage of Azure.Etag in RouterQueueItem * add tsp-location * dpg models initial commit * update commit * all Serialize methods added * auth policy modified to new generated code * fix errors and update readme * fix tests * Update with more fixes * more fixess * update assets * update assests.json * update api def * more fixes * STG 91 beta release (#39297) * [Azure.Monitor.Ingestion] update Changelog for release (#39304) * Sync eng/common directory with azure-sdk-tools for PR 7113 (#39226) * Remove ARM deployment after deploy * Update eng/common/TestResources/New-TestResources.ps1 Co-authored-by: Heath Stewart * Apply suggestions from code review --------- Co-authored-by: Ben Broderick Phillips Co-authored-by: Heath Stewart * fix Azure OpenAI whisper snippets (#39313) * Prepare release for hybridcompute (#39318) * Increment package version after release of Azure.ResourceManager.HybridCompute (#39320) * Increment version for storage releases (#39302) * [Storage][DataMovement] More fixes to resuming transfers (#39271) * Use bytes to represent AMQP property map (#39307) * Use bytes to represent AMQP property map * Delete SettlementPropertiesTests.cs * PR fb * Fix test and revert testbase change * remove unused import * Update AutoRest C# version to 3.0.0-beta.20231017.1 (#39329) * Update Generator Version 3.0.0-beta.20231017.1 * Update SDK codes me_pu_4 * Use singleton rather than hosted service for cleanup (#39327) * Use singleton rather than hosted service for cleanup * prepare for release * add date * Added x-ms-file-request-itent to PutRangeFromUrl (#39278) * Merge identity/1.10.2-rel back to main (#39331) * Bug fixes for development time credentials * update project version * Increment package version after release of Azure.Identity (#39170) * tests --------- Co-authored-by: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> * [Azure.Monitor.Query] Add MetricsBatch (#38640) * add ContainerServiceFleet test support (#39348) * [NetAppFiles] Update version number to stable (#39352) * Update version number to stable * Update release date * Increment package version after release of Microsoft.Azure.WebJobs.Extensions.ServiceBus (#39339) * Increment package version after release of Azure.Monitor.Ingestion (#39334) * Redo (#39060) * Fixing communication test scripts (#39355) * Updated test-resources template to contain necessary properties. * Added logging for test environment variables for better troubleshooting. * Azure.Identity.Broker archboard feedback (#39296) * Fix namespace of ACS models (#39341) * Fix namespace of ACS models * Fix * [Storage] [DataMovement] Added Download File Share Tests and Minor Fixes (#39206) * Added download tests for file shares * Rerecorded tests * Cleanup * Apply EBN to back compat ACS models (#39360) * DataMovement unify TransferAndVerify Part 1 (#39300) * initial unified implementation * applied to blob single download tests * move local tooling * checkpoint * separate out blob utilities * separating item and container test util * cancellation tokens * using single blob * apply to append tests * added page blobs * remove old verify methods * Fix: Prevent data duplication in TraceTelemetry with IncludeFormattedMessage (#39308) * Fix: Prevent data duplication in TraceTelemetry with IncludeFormattedMessage. * Update Changelog * PR feedback on Exception original format. * test changes * Test changes. * Implement generci parser for Transcription, Audio data (#39250) * One more EBN and add test (#39365) * One more EBN and add test * Fix * Fix proto definition (#39361) * prep for Identity patch release (#39359) * Update CHANGELOG.md (#39343) * Increment package version after release of Microsoft.Azure.WebJobs.Extensions.ServiceBus (#39369) * Increment package version after release of Azure.Identity (#39374) * Increment package version after release of Azure.Monitor.Query (#39372) * add a funtion to convert BinaryData to RequestContent (#39316) * add serialize funtion for BinaryData * add more test * Update sdk/core/Azure.Core/src/Shared/RequestContentHelper.cs Co-authored-by: Christopher Scott --------- Co-authored-by: Christopher Scott * [ElasticSan] API version 2023-03-01: support snapshots and CMK (#39215) * ElasticSan snapshots and CMK * Update changelog to remove empty sections * Update sourceId format * Update Generator Version 3.0.0-beta.20231019.2 (#39393) * Increment package version after release of Azure.Messaging.EventGrid (#39373) * Increment package version after release of Azure.ResourceManager.NetApp (#39381) * Prep Azure.Identity.Broker for release (#39375) * [CODEOWNERS] Fix Schema Registry (#39396) The focus of these changes is to fix the Schema Registry service entry to use the special `` token rather than a path, allowing our new automation to correctly parse it. * Increment package version after release of Azure.Identity.Broker (#39395) * Add Setter to CallInvite to allow pstn to pstn tranfer call (#39397) * Bump min tls version to 1.2 for digital twins live test storage account (#39402) * fix(monitor): remove newing-up unused object in UseAzureMonitor (#39356) fixes #38787 * Bump min tls version to 1.2 for digital twins live test event hub (#39405) * Bump min tls version to 1.2 for digital twins live test storage account * Bump min tls version to 1.2 for digital twins live test event hub * Fix update test resources tagging when tags are empty. Bump max limit (#39409) Co-authored-by: Ben Broderick Phillips * 2023 08 15 (#39145) * sdk generation * adding tests * mitigate breaking change * export API * all tests pass * small fix * csproj version * changelog * small fix * fix release date * remove unreleased * updating assets.json to fit the new recordings * Wei comment fixes * fixes * renaming * recording tag --------- Co-authored-by: Wei Hu * Update AutoRest C# version to 3.0.0-beta.20231019.3 (#39416) * Gfeitosa/increase coverage include int (#39392) * Remove common package from coverage report * Added SMS speciffic phone number to test pipeline * Fix typo in yml file * Extra tests implemented * Add a few extra tests for coverage * Add a few extra tests for coverage * Remove unecessary usings * Fix assert exception * Remove shared core ConnectionString from tests * Make internal classes visible to test package * Implement SmsRestClient tests for coverage * Remove duplicate snippets * Update code owners for SMS sdk to include only SMS team * Remove missing user from codeowners file * Update CHANGELOG.md (#39406) * Datamovement shares oauth (#39164) * datamovemnet access to header and audience * include audience in HttpAuthorization * tests * small changes * rebased and adopted a rename from main * fix * exportapi * DataMovement unify TransferAndVerify Part 2 (#39364) * directory download tests * unused imprt * Fix deadlettering and exception propagation in Grpc service (#39412) * Fix deadlettering in Grpc service * Propagate exception details * remove project ref * Increment package version after release of Microsoft.Azure.WebJobs.Extensions.ServiceBus (#39419) * Add Microsoft.NetworkAnalytics RP SDK package (#39240) * [Storage][DataMovement] Add source/destination checkpoint data to Job Plan file (#39411) * [Storage] Added Fix for Creating Share File before service copy; Added Data Movement E2E service copy tests (#39440) * WIP * WIP - tests written but CopyAuthorization needs to be done first * Added tests for single sync copy file share; Added minor fixes for creation of file beforehand * Fix recording * Fix to share file resource tests * Prep Azure.Microsoft.Support for release (#39403) * Add EnvironmentCredential to token cache table (#39476) * Replace Azure AD references with Entra (#39477) * Check az login for target subscription in stress deploy login (#39479) Co-authored-by: Ben Broderick Phillips * Set min tls version for search+storage live tests (#39471) * Test updates for 2023-06-01-preview SDK * Update StreamingChatCompletions.cs (#39480) * [Storage][DataMovement] Cleanup after recent changes to checkpointer (#39456) * Failed Update AutoRest C# version to 3.0.0-beta.20231024.1 (#39463) * Increment version for kusto releases (#39485) * Adding basic [CallerShouldAudit] support and initial support for Storage and Tables (#39345) Adding basic [CallerShouldAudit] support and initial annotations of Storage and Tables. * Update ContainerServiceFleet to 10-15 (#39487) * [StorageMover] Upgrade to API version 2023-10-01 (#39495) * StorageMover 2023-10-01 * update version * Increment package version after release of Azure.ResourceManager.Support (#39488) * Increment package version after release of Azure.ResourceManager.Peering (#39497) * Fix tests for Fleet (#39496) * DataMovement unify TransferAndVerify Part 3 (#39401) * block * append * net462 fix * default timeouts * test proxy * DataMovement unify TransferAndVerify Part 4 (#39452) * Update Generator Version 3.0.0-beta.20231025.1 (#39504) * Devcenter dataplane TypeSpec preview SDK v2023-04-01 (#39358) * add tsp location and remove autorest * SDK generation from TypeSpec * Update tests and samples reflected by client changes * Generate snippets * Generate API updates * Add breaking changes to CHANGELOG * Update parameter to delayUntil * [Event Hubs] Handle cases where desired worker count exceeds int.MaxInt (#39468) * handle long desired worker count * adding additional unit test * use checked approach * remove unncessary cast * add unit test * update comment * add unit tests * handle long desired worker count * adding additional unit test * use checked approach * remove unncessary cast * add unit test * update comment * fix merge conflict * fix concurrency in unit tests --------- Co-authored-by: Vincent Chiang * Update AutoRest C# version to 3.0.0-beta.20231025.3 (#39521) * [Service Bus] Handle cases where desired worker count exceeds int.MaxInt (#39474) * handle long desired worker count * adding additional unit test * handle overflow * Revert "adding additional unit test" This reverts commit a0869c47bb4898acfc7cab3e78b52d1e4bc72dbc. * Revert "handle overflow" This reverts commit dba066189f252936a2d21e0d7406cab95e089358. * Revert "Revert "handle overflow"" This reverts commit bd6bd1d28fc30fb55fe2972cee60aedfcc008821. * Revert "handle long desired worker count" This reverts commit e5a8756fbf8fff87409cea415f7c413dd8083bf0. * add checked block --------- Co-authored-by: Vincent Chiang * Update AutoRest C# version to 3.0.0-beta.20231026.1 (#39526) * Update Generator Version 3.0.0-beta.20231026.1 * Update SDK codes me_pu_4 * roll back workaround due to `logicalPath` not supported in lro --------- Co-authored-by: Mingzhe Huang (from Dev Box) * Increment package version after release of Azure.ResourceManager.ContainerServiceFleet (#39524) * Sb cross receiver samples (#39514) * Add samples demonstrating cross receiver settlement * Fix * Fix * fix line break * Fix sln * regenerate * Apply suggestions from code review Co-authored-by: Jesse Squire --------- Co-authored-by: Jesse Squire * Add samples link in README (#39529) * [Storage][DataMovement] Fixes to pause/resume around enumeration (#39486) * attributes (#39428) * Upgrade `Azure.ClientSdk.Analyzers` and disable enhanced analysis for some SDKs (#39518) - update the client sdk analyzer to dev build - add globla config to suppress enhanced analysis rules - modify ci steps to support suppression by a property * disable enhanced analysis for backward compatibility * update `Azure.ClientSdk.Analyzers` to `0.1.1-dev.20231025.2` --------- Co-authored-by: Mingzhe Huang (from Dev Box) * Update Microsoft.Search to include 2023-11-01 API version (#39326) * initial regeneration * update tests * update generated code * generated code feedback * updating recordings * fix tests * recording tests * recording tests * regenerate code * updating generated code * update * updating tests * update changelog * fixing changelog --------- Co-authored-by: Matt Gotteiner * Update Azure.ResourceManager.DesktopVirtualization to new api version 2023-09-05 (#39025) * Increment version for elasticsan releases (#39547) * Increment version for desktopvirtualization releases (#39548) * Update Generator Version 3.0.0-beta.20231027.1 (#39550) * Updating tests and addressing PR comments. * Comment out RecordedTestMode.Record * update autorest * use datetimeoffset * Updating tests and assets * rebuilding package to pick up changes from main * Disable record mode * Update version for acs resources * update api signature * Updating changelog.md --------- Co-authored-by: Amanda Nguyen <48961492+amnguye@users.noreply.github.com> Co-authored-by: Caio Saldanha Co-authored-by: Franko Morales <67804607+cochi2@users.noreply.github.com> Co-authored-by: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Co-authored-by: FAREAST\chunyu Co-authored-by: Minghao Chen <30464227+HarveyLink@users.noreply.github.com> Co-authored-by: frantran Co-authored-by: Jocelyn <41338290+jaschrep-msft@users.noreply.github.com> Co-authored-by: Jingshu918 <138486531+Jingshu918@users.noreply.github.com> Co-authored-by: Chengming <61542202+dvbb@users.noreply.github.com> Co-authored-by: Ben Broderick Phillips Co-authored-by: Rajkumar Rangaraj Co-authored-by: Patrick Hallisey Co-authored-by: Scott Addie <10702007+scottaddie@users.noreply.github.com> Co-authored-by: rohantagaru <126915631+rohantagaru@users.noreply.github.com> Co-authored-by: Madalyn Redding <66138537+m-redding@users.noreply.github.com> Co-authored-by: Jesse Squire Co-authored-by: Sean McCullough <44180881+seanmcc-msft@users.noreply.github.com> Co-authored-by: Vitek Karas <10670590+vitek-karas@users.noreply.github.com> Co-authored-by: Anne Thompson Co-authored-by: Matthew Meadows (Rango the Dog) Co-authored-by: Rango Meadows Co-authored-by: Pan Shao <97225342+pshao25@users.noreply.github.com> Co-authored-by: Vivek More <123148745+vivekmore-msft@users.noreply.github.com> Co-authored-by: abhishesingh-msft Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> Co-authored-by: Jesse Squire Co-authored-by: Arthur Ma Co-authored-by: Gerardo Lecaros Co-authored-by: James Suplizio Co-authored-by: Wes Haggard Co-authored-by: Christopher Scott Co-authored-by: Heath Stewart Co-authored-by: Daniel Jurek Co-authored-by: Timothy Mothra Co-authored-by: abhishesingh-msft <123186776+abhishesingh-msft@users.noreply.github.com> Co-authored-by: Jacob Lauzon <96087589+jalauzon-msft@users.noreply.github.com> Co-authored-by: richardcho-msft <95773682+richardcho-msft@users.noreply.github.com> Co-authored-by: root Co-authored-by: ShivangiReja <45216704+ShivangiReja@users.noreply.github.com> Co-authored-by: calvinkwtang Co-authored-by: Mike Hang <108955604+mikehang-msft@users.noreply.github.com> Co-authored-by: nisha-bhatia <67986960+nisha-bhatia@users.noreply.github.com> Co-authored-by: sofiar-msft Co-authored-by: Dapeng Zhang Co-authored-by: Wei Hu Co-authored-by: Chenyang Liu Co-authored-by: wiboris <54044985+wiboris@users.noreply.github.com> Co-authored-by: glorialimicrosoft <67171398+glorialimicrosoft@users.noreply.github.com> Co-authored-by: mcgallan <88413158+mcgallan@users.noreply.github.com> Co-authored-by: Eric Erhardt Co-authored-by: amariwest-msft <139818906+amariwest-msft@users.noreply.github.com> Co-authored-by: Auðunn Co-authored-by: Pallavi Taneja Co-authored-by: m-nash Co-authored-by: yaotongms <137821665+yaotongms@users.noreply.github.com> Co-authored-by: Daniel Laughland Co-authored-by: praveenkuttappan Co-authored-by: Rajarshi Sarkar <73562869+sarkar-rajarshi@users.noreply.github.com> Co-authored-by: Heath Stewart Co-authored-by: Travis Wilson <35748617+trrwilson@users.noreply.github.com> Co-authored-by: Scott Schaab Co-authored-by: Alexander Batishchev Co-authored-by: Jiri Burant <83883278+jiriburant@users.noreply.github.com> Co-authored-by: Christopher Scott Co-authored-by: yifanz7 <131133995+yifanz7@users.noreply.github.com> Co-authored-by: Amadeusz Sadowski Co-authored-by: t-abebchuk <113615233+t-abebchuk@users.noreply.github.com> Co-authored-by: Wei Hu Co-authored-by: gfeitosa-msft <112948415+gfeitosa-msft@users.noreply.github.com> Co-authored-by: Gaurav Agarwal <120563366+gaagarwalMS@users.noreply.github.com> Co-authored-by: devinlstoen <105672060+devinlstoen@users.noreply.github.com> Co-authored-by: tg-msft Co-authored-by: Driele Neves Ribeiro Co-authored-by: Vincent Chiang Co-authored-by: Vincent Chiang Co-authored-by: Mingzhe Huang (from Dev Box) Co-authored-by: Mingzhe Huang Co-authored-by: Matt <57731498+mattmsft@users.noreply.github.com> Co-authored-by: Matt Gotteiner Co-authored-by: Alec Baird <100880612+alec-baird@users.noreply.github.com> --- .../CHANGELOG.md | 6 + ...rceManager.Communication.netstandard2.0.cs | 92 ++++ .../assets.json | 2 +- .../Sample_CommunicationDomainResource.cs | 10 +- ...e_CommunicationDomainResourceCollection.cs | 10 +- .../Sample_CommunicationServiceResource.cs | 31 +- ..._CommunicationServiceResourceCollection.cs | 12 +- .../Samples/Sample_EmailServiceResource.cs | 10 +- .../Sample_EmailServiceResourceCollection.cs | 10 +- .../Samples/Sample_SenderUsernameResource.cs | 6 +- ...Sample_SenderUsernameResourceCollection.cs | 14 +- .../Sample_SuppressionListAddressResource.cs | 124 +++++ ...uppressionListAddressResourceCollection.cs | 217 ++++++++ .../Samples/Sample_SuppressionListResource.cs | 120 +++++ ...ample_SuppressionListResourceCollection.cs | 211 ++++++++ .../Generated/ArmCommunicationModelFactory.cs | 32 ++ .../Generated/CommunicationDomainResource.cs | 53 ++ .../Extensions/CommunicationExtensions.cs | 32 ++ .../MockableCommunicationArmClient.cs | 24 + ...AddressResourceCollection.Serialization.cs | 50 ++ ...uppressionListAddressResourceCollection.cs | 37 ++ ...onListAddressResourceData.Serialization.cs | 138 +++++ ...ionListResourceCollection.Serialization.cs | 50 ++ .../SuppressionListResourceCollection.cs | 37 ++ ...ppressionListResourceData.Serialization.cs | 115 ++++ .../CommunicationServicesRestOperations.cs | 2 +- .../RestOperations/DomainsRestOperations.cs | 2 +- .../EmailServicesRestOperations.cs | 2 +- .../SenderUsernamesRestOperations.cs | 2 +- .../SuppressionListAddressesRestOperations.cs | 509 ++++++++++++++++++ .../SuppressionListsRestOperations.cs | 481 +++++++++++++++++ .../SuppressionListAddressResource.cs | 303 +++++++++++ ...uppressionListAddressResourceCollection.cs | 415 ++++++++++++++ .../SuppressionListAddressResourceData.cs | 59 ++ .../src/Generated/SuppressionListResource.cs | 355 ++++++++++++ .../SuppressionListResourceCollection.cs | 415 ++++++++++++++ .../Generated/SuppressionListResourceData.cs | 51 ++ .../src/autorest.md | 6 +- ...mmunicationManagementClientLiveTestBase.cs | 50 +- .../ScenarioTests/SuppressionListTests.cs | 280 ++++++++++ 40 files changed, 4314 insertions(+), 61 deletions(-) create mode 100644 sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_SuppressionListAddressResource.cs create mode 100644 sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_SuppressionListAddressResourceCollection.cs create mode 100644 sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_SuppressionListResource.cs create mode 100644 sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_SuppressionListResourceCollection.cs create mode 100644 sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/SuppressionListAddressResourceCollection.Serialization.cs create mode 100644 sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/SuppressionListAddressResourceCollection.cs create mode 100644 sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/SuppressionListAddressResourceData.Serialization.cs create mode 100644 sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/SuppressionListResourceCollection.Serialization.cs create mode 100644 sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/SuppressionListResourceCollection.cs create mode 100644 sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/SuppressionListResourceData.Serialization.cs create mode 100644 sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/SuppressionListAddressesRestOperations.cs create mode 100644 sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/SuppressionListsRestOperations.cs create mode 100644 sdk/communication/Azure.ResourceManager.Communication/src/Generated/SuppressionListAddressResource.cs create mode 100644 sdk/communication/Azure.ResourceManager.Communication/src/Generated/SuppressionListAddressResourceCollection.cs create mode 100644 sdk/communication/Azure.ResourceManager.Communication/src/Generated/SuppressionListAddressResourceData.cs create mode 100644 sdk/communication/Azure.ResourceManager.Communication/src/Generated/SuppressionListResource.cs create mode 100644 sdk/communication/Azure.ResourceManager.Communication/src/Generated/SuppressionListResourceCollection.cs create mode 100644 sdk/communication/Azure.ResourceManager.Communication/src/Generated/SuppressionListResourceData.cs create mode 100644 sdk/communication/Azure.ResourceManager.Communication/tests/ScenarioTests/SuppressionListTests.cs diff --git a/sdk/communication/Azure.ResourceManager.Communication/CHANGELOG.md b/sdk/communication/Azure.ResourceManager.Communication/CHANGELOG.md index be64b1a0f05e..e22133f3ec78 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/CHANGELOG.md +++ b/sdk/communication/Azure.ResourceManager.Communication/CHANGELOG.md @@ -1,5 +1,11 @@ # Release History +## 1.2.0-beta.4 (2023-11-06) + +### Features Added + +- Added support for Email Suppression List and Address resources. + ## 1.2.0-beta.3 (Unreleased) ### Features Added diff --git a/sdk/communication/Azure.ResourceManager.Communication/api/Azure.ResourceManager.Communication.netstandard2.0.cs b/sdk/communication/Azure.ResourceManager.Communication/api/Azure.ResourceManager.Communication.netstandard2.0.cs index 4828facc882c..fa07577c490c 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/api/Azure.ResourceManager.Communication.netstandard2.0.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/api/Azure.ResourceManager.Communication.netstandard2.0.cs @@ -18,6 +18,9 @@ protected CommunicationDomainResource() { } public virtual Azure.Response GetSenderUsernameResource(string senderUsername, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetSenderUsernameResourceAsync(string senderUsername, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.Communication.SenderUsernameResourceCollection GetSenderUsernameResources() { throw null; } + public virtual Azure.Response GetSuppressionListResource(string suppressionListName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSuppressionListResourceAsync(string suppressionListName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Communication.SuppressionListResourceCollection GetSuppressionListResources() { throw null; } public virtual Azure.ResourceManager.ArmOperation InitiateVerification(Azure.WaitUntil waitUntil, Azure.ResourceManager.Communication.Models.DomainsRecordVerificationContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task InitiateVerificationAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Communication.Models.DomainsRecordVerificationContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -74,6 +77,8 @@ public static partial class CommunicationExtensions public static Azure.Pageable GetEmailServiceResources(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetEmailServiceResourcesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.ResourceManager.Communication.SenderUsernameResource GetSenderUsernameResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.Communication.SuppressionListAddressResource GetSuppressionListAddressResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.Communication.SuppressionListResource GetSuppressionListResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.Pageable GetVerifiedExchangeOnlineDomainsEmailServices(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetVerifiedExchangeOnlineDomainsEmailServicesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } @@ -217,6 +222,89 @@ public SenderUsernameResourceData() { } public Azure.ResourceManager.Communication.Models.CommunicationServiceProvisioningState? ProvisioningState { get { throw null; } } public string Username { get { throw null; } set { } } } + public partial class SuppressionListAddressResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected SuppressionListAddressResource() { } + public virtual Azure.ResourceManager.Communication.SuppressionListAddressResourceData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string emailServiceName, string domainName, string suppressionListName, string addressId) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.Communication.SuppressionListAddressResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Communication.SuppressionListAddressResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class SuppressionListAddressResourceCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected SuppressionListAddressResourceCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string addressId, Azure.ResourceManager.Communication.SuppressionListAddressResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string addressId, Azure.ResourceManager.Communication.SuppressionListAddressResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string addressId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string addressId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string addressId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string addressId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string addressId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string addressId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class SuppressionListAddressResourceData : Azure.ResourceManager.Models.ResourceData + { + public SuppressionListAddressResourceData() { } + public string DataLocation { get { throw null; } } + public string Email { get { throw null; } set { } } + public string FirstName { get { throw null; } set { } } + public System.DateTimeOffset? LastModified { get { throw null; } } + public string LastName { get { throw null; } set { } } + public string Notes { get { throw null; } set { } } + } + public partial class SuppressionListResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected SuppressionListResource() { } + public virtual Azure.ResourceManager.Communication.SuppressionListResourceData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string emailServiceName, string domainName, string suppressionListName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetSuppressionListAddressResource(string addressId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSuppressionListAddressResourceAsync(string addressId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Communication.SuppressionListAddressResourceCollection GetSuppressionListAddressResources() { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.Communication.SuppressionListResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Communication.SuppressionListResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class SuppressionListResourceCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected SuppressionListResourceCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string suppressionListName, Azure.ResourceManager.Communication.SuppressionListResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string suppressionListName, Azure.ResourceManager.Communication.SuppressionListResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string suppressionListName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string suppressionListName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string suppressionListName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string suppressionListName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string suppressionListName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string suppressionListName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class SuppressionListResourceData : Azure.ResourceManager.Models.ResourceData + { + public SuppressionListResourceData() { } + public System.DateTimeOffset? CreatedTimeStamp { get { throw null; } } + public string DataLocation { get { throw null; } } + public System.DateTimeOffset? LastUpdatedTimeStamp { get { throw null; } } + public string ListName { get { throw null; } set { } } + } } namespace Azure.ResourceManager.Communication.Mocking { @@ -227,6 +315,8 @@ protected MockableCommunicationArmClient() { } public virtual Azure.ResourceManager.Communication.CommunicationServiceResource GetCommunicationServiceResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.Communication.EmailServiceResource GetEmailServiceResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.Communication.SenderUsernameResource GetSenderUsernameResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Communication.SuppressionListAddressResource GetSuppressionListAddressResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Communication.SuppressionListResource GetSuppressionListResource(Azure.Core.ResourceIdentifier id) { throw null; } } public partial class MockableCommunicationResourceGroupResource : Azure.ResourceManager.ArmResource { @@ -266,6 +356,8 @@ public static partial class ArmCommunicationModelFactory public static Azure.ResourceManager.Communication.EmailServiceResourceData EmailServiceResourceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.Communication.Models.EmailServicesProvisioningState? provisioningState = default(Azure.ResourceManager.Communication.Models.EmailServicesProvisioningState?), string dataLocation = null) { throw null; } public static Azure.ResourceManager.Communication.Models.LinkedNotificationHub LinkedNotificationHub(Azure.Core.ResourceIdentifier resourceId = null) { throw null; } public static Azure.ResourceManager.Communication.SenderUsernameResourceData SenderUsernameResourceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string dataLocation = null, string username = null, string displayName = null, Azure.ResourceManager.Communication.Models.CommunicationServiceProvisioningState? provisioningState = default(Azure.ResourceManager.Communication.Models.CommunicationServiceProvisioningState?)) { throw null; } + public static Azure.ResourceManager.Communication.SuppressionListAddressResourceData SuppressionListAddressResourceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string email = null, string firstName = null, string lastName = null, string notes = null, System.DateTimeOffset? lastModified = default(System.DateTimeOffset?), string dataLocation = null) { throw null; } + public static Azure.ResourceManager.Communication.SuppressionListResourceData SuppressionListResourceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string listName = null, System.DateTimeOffset? lastUpdatedTimeStamp = default(System.DateTimeOffset?), System.DateTimeOffset? createdTimeStamp = default(System.DateTimeOffset?), string dataLocation = null) { throw null; } public static Azure.ResourceManager.Communication.Models.VerificationDnsRecord VerificationDnsRecord(string dnsRecordType = null, string name = null, string value = null, int? timeToLiveInSeconds = default(int?)) { throw null; } } public partial class CommunicationAcceptTags diff --git a/sdk/communication/Azure.ResourceManager.Communication/assets.json b/sdk/communication/Azure.ResourceManager.Communication/assets.json index 73014c588927..a05b2f54ac3b 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/assets.json +++ b/sdk/communication/Azure.ResourceManager.Communication/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "net", "TagPrefix": "net/communication/Azure.ResourceManager.Communication", - "Tag": "net/communication/Azure.ResourceManager.Communication_696b7aac1e" + "Tag": "net/communication/Azure.ResourceManager.Communication_3d69aa0976" } diff --git a/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_CommunicationDomainResource.cs b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_CommunicationDomainResource.cs index a7fc3b2dca01..e1bd0c42d92a 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_CommunicationDomainResource.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_CommunicationDomainResource.cs @@ -23,7 +23,7 @@ public partial class Sample_CommunicationDomainResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetDomainsResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/domains/get.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/domains/get.json // this example is just showing the usage of "Domains_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_GetDomainsResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_DeleteDomainsResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/domains/delete.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/domains/delete.json // this example is just showing the usage of "Domains_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 @@ -83,7 +83,7 @@ public async Task Delete_DeleteDomainsResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_UpdateDomainsResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/domains/update.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/domains/update.json // this example is just showing the usage of "Domains_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 @@ -120,7 +120,7 @@ public async Task Update_UpdateDomainsResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task InitiateVerification_InitiateVerification() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/domains/initiateVerification.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/domains/initiateVerification.json // this example is just showing the usage of "Domains_InitiateVerification" 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 @@ -149,7 +149,7 @@ public async Task InitiateVerification_InitiateVerification() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CancelVerification_CancelVerification() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/domains/cancelVerification.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/domains/cancelVerification.json // this example is just showing the usage of "Domains_CancelVerification" 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/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_CommunicationDomainResourceCollection.cs b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_CommunicationDomainResourceCollection.cs index 9fa8a43f016b..04baa2d5fe08 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_CommunicationDomainResourceCollection.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_CommunicationDomainResourceCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_CommunicationDomainResourceCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetDomainsResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/domains/get.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/domains/get.json // this example is just showing the usage of "Domains_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -58,7 +58,7 @@ public async Task Get_GetDomainsResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetDomainsResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/domains/get.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/domains/get.json // this example is just showing the usage of "Domains_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -89,7 +89,7 @@ public async Task Exists_GetDomainsResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetDomainsResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/domains/get.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/domains/get.json // this example is just showing the usage of "Domains_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 @@ -132,7 +132,7 @@ public async Task GetIfExists_GetDomainsResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_CreateOrUpdateDomainsResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/domains/createOrUpdate.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/domains/createOrUpdate.json // this example is just showing the usage of "Domains_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 @@ -172,7 +172,7 @@ public async Task CreateOrUpdate_CreateOrUpdateDomainsResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListDomainsResourcesByEmailServiceName() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/domains/listByEmailService.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/domains/listByEmailService.json // this example is just showing the usage of "Domains_ListByEmailServiceResource" 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/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_CommunicationServiceResource.cs b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_CommunicationServiceResource.cs index c93c8c82b2eb..cabaccd770b7 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_CommunicationServiceResource.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_CommunicationServiceResource.cs @@ -25,7 +25,7 @@ public partial class Sample_CommunicationServiceResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CheckCommunicationNameAvailability_CheckNameAvailabilityAvailable() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/checkNameAvailabilityAvailable.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/communicationServices/checkNameAvailabilityAvailable.json // this example is just showing the usage of "CommunicationServices_CheckNameAvailability" 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 CheckCommunicationNameAvailability_CheckNameAvailabilityAvaila [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CheckCommunicationNameAvailability_CheckNameAvailabilityUnavailable() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/checkNameAvailabilityUnavailable.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/communicationServices/checkNameAvailabilityUnavailable.json // this example is just showing the usage of "CommunicationServices_CheckNameAvailability" 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 @@ -85,7 +85,7 @@ public async Task CheckCommunicationNameAvailability_CheckNameAvailabilityUnavai [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task LinkNotificationHub_LinkNotificationHub() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/linkNotificationHub.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/communicationServices/linkNotificationHub.json // this example is just showing the usage of "CommunicationServices_LinkNotificationHub" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -113,7 +113,7 @@ public async Task LinkNotificationHub_LinkNotificationHub() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetCommunicationServiceResources_ListBySubscription() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/listBySubscription.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/communicationServices/listBySubscription.json // this example is just showing the usage of "CommunicationServices_ListBySubscription" 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 @@ -145,7 +145,7 @@ public async Task GetCommunicationServiceResources_ListBySubscription() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_UpdateResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/update.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/communicationServices/update.json // this example is just showing the usage of "CommunicationServices_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 @@ -164,6 +164,7 @@ public async Task Update_UpdateResource() // invoke the operation CommunicationServiceResourcePatch patch = new CommunicationServiceResourcePatch() { + Identity = new ManagedServiceIdentity("SystemAssigned"), Tags = { ["newTag"] = "newVal", @@ -183,7 +184,7 @@ public async Task Update_UpdateResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_UpdateResourceToAddSystemAndUserManagedIdentities() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/updateWithSystemAndUserIdentity.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/communicationServices/updateWithSystemAndUserIdentity.json // this example is just showing the usage of "CommunicationServices_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 @@ -228,7 +229,7 @@ public async Task Update_UpdateResourceToAddSystemAndUserManagedIdentities() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_UpdateResourceToAddASystemAssignedManagedIdentity() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/updateWithSystemAssignedIdentity.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/communicationServices/updateWithSystemAssignedIdentity.json // this example is just showing the usage of "CommunicationServices_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 @@ -267,7 +268,7 @@ public async Task Update_UpdateResourceToAddASystemAssignedManagedIdentity() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_UpdateResourceToAddAUserAssignedManagedIdentity() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/updateWithUserAssignedIdentity.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/communicationServices/updateWithUserAssignedIdentity.json // this example is just showing the usage of "CommunicationServices_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 @@ -312,7 +313,7 @@ public async Task Update_UpdateResourceToAddAUserAssignedManagedIdentity() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_UpdateResourceToRemoveIdentity() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/updateRemoveSystemIdentity.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/communicationServices/updateRemoveSystemIdentity.json // this example is just showing the usage of "CommunicationServices_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 @@ -332,10 +333,6 @@ public async Task Update_UpdateResourceToRemoveIdentity() CommunicationServiceResourcePatch patch = new CommunicationServiceResourcePatch() { Identity = new ManagedServiceIdentity("None"), - Tags = -{ -["newTag"] = "newVal", -}, }; CommunicationServiceResource result = await communicationServiceResource.UpdateAsync(patch); @@ -351,7 +348,7 @@ public async Task Update_UpdateResourceToRemoveIdentity() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/get.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/communicationServices/get.json // this example is just showing the usage of "CommunicationServices_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 @@ -382,7 +379,7 @@ public async Task Get_GetResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_DeleteResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/delete.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/communicationServices/delete.json // this example is just showing the usage of "CommunicationServices_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 @@ -409,7 +406,7 @@ public async Task Delete_DeleteResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetKeys_ListKeys() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/listKeys.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/communicationServices/listKeys.json // this example is just showing the usage of "CommunicationServices_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 @@ -436,7 +433,7 @@ public async Task GetKeys_ListKeys() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task RegenerateKey_RegenerateKey() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/regenerateKey.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/communicationServices/regenerateKey.json // this example is just showing the usage of "CommunicationServices_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 diff --git a/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_CommunicationServiceResourceCollection.cs b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_CommunicationServiceResourceCollection.cs index 54ce0cee6cfd..dd07309f9907 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_CommunicationServiceResourceCollection.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_CommunicationServiceResourceCollection.cs @@ -24,7 +24,7 @@ public partial class Sample_CommunicationServiceResourceCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListByResourceGroup() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/listByResourceGroup.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/communicationServices/listByResourceGroup.json // this example is just showing the usage of "CommunicationServices_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 @@ -60,7 +60,7 @@ public async Task GetAll_ListByResourceGroup() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/get.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/communicationServices/get.json // this example is just showing the usage of "CommunicationServices_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -94,7 +94,7 @@ public async Task Get_GetResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/get.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/communicationServices/get.json // this example is just showing the usage of "CommunicationServices_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 @@ -124,7 +124,7 @@ public async Task Exists_GetResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/get.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/communicationServices/get.json // this example is just showing the usage of "CommunicationServices_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_GetResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_CreateOrUpdateResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/createOrUpdate.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/communicationServices/createOrUpdate.json // this example is just showing the usage of "CommunicationServices_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 @@ -205,7 +205,7 @@ public async Task CreateOrUpdate_CreateOrUpdateResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_CreateOrUpdateResourceWithManagedIdentity() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/communicationServices/createOrUpdateWithSystemAssignedIdentity.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/communicationServices/createOrUpdateWithSystemAssignedIdentity.json // this example is just showing the usage of "CommunicationServices_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/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_EmailServiceResource.cs b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_EmailServiceResource.cs index e137b353e40f..3b4ca0c52dd9 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_EmailServiceResource.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_EmailServiceResource.cs @@ -24,7 +24,7 @@ public partial class Sample_EmailServiceResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetEmailServiceResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/emailServices/get.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/emailServices/get.json // this example is just showing the usage of "EmailServices_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_GetEmailServiceResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_DeleteEmailServiceResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/emailServices/delete.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/emailServices/delete.json // this example is just showing the usage of "EmailServices_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 @@ -82,7 +82,7 @@ public async Task Delete_DeleteEmailServiceResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_UpdateEmailServiceResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/emailServices/update.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/emailServices/update.json // this example is just showing the usage of "EmailServices_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 @@ -121,7 +121,7 @@ public async Task Update_UpdateEmailServiceResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetEmailServiceResources_ListEmailServiceResourcesBySubscription() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/emailServices/listBySubscription.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/emailServices/listBySubscription.json // this example is just showing the usage of "EmailServices_ListBySubscription" 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 @@ -153,7 +153,7 @@ public async Task GetEmailServiceResources_ListEmailServiceResourcesBySubscripti [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetVerifiedExchangeOnlineDomainsEmailServices_GetVerifiedExchangeOnlineDomains() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/emailServices/getVerifiedExchangeOnlineDomains.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/emailServices/getVerifiedExchangeOnlineDomains.json // this example is just showing the usage of "EmailServices_ListVerifiedExchangeOnlineDomains" 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/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_EmailServiceResourceCollection.cs b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_EmailServiceResourceCollection.cs index 06351c2bf06f..a6f82b3dcd11 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_EmailServiceResourceCollection.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_EmailServiceResourceCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_EmailServiceResourceCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetEmailServiceResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/emailServices/get.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/emailServices/get.json // this example is just showing the usage of "EmailServices_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 @@ -57,7 +57,7 @@ public async Task Get_GetEmailServiceResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetEmailServiceResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/emailServices/get.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/emailServices/get.json // this example is just showing the usage of "EmailServices_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 @@ -87,7 +87,7 @@ public async Task Exists_GetEmailServiceResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetEmailServiceResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/emailServices/get.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/emailServices/get.json // this example is just showing the usage of "EmailServices_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 @@ -129,7 +129,7 @@ public async Task GetIfExists_GetEmailServiceResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_CreateOrUpdateEmailServiceResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/emailServices/createOrUpdate.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/emailServices/createOrUpdate.json // this example is just showing the usage of "EmailServices_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 @@ -168,7 +168,7 @@ public async Task CreateOrUpdate_CreateOrUpdateEmailServiceResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListEmailServiceResourcesByResourceGroup() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/emailServices/listByResourceGroup.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/emailServices/listByResourceGroup.json // this example is just showing the usage of "EmailServices_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/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_SenderUsernameResource.cs b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_SenderUsernameResource.cs index 95647f9bd151..d473c0d30349 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_SenderUsernameResource.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_SenderUsernameResource.cs @@ -22,7 +22,7 @@ public partial class Sample_SenderUsernameResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetSenderUsernamesResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/senderUsernames/get.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/senderUsernames/get.json // this example is just showing the usage of "SenderUsernames_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_GetSenderUsernamesResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_CreateOrUpdateSenderUsernamesResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/senderUsernames/createOrUpdate.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/senderUsernames/createOrUpdate.json // this example is just showing the usage of "SenderUsernames_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 @@ -94,7 +94,7 @@ public async Task Update_CreateOrUpdateSenderUsernamesResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_DeleteSenderUsernamesResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/senderUsernames/delete.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/senderUsernames/delete.json // this example is just showing the usage of "SenderUsernames_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/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_SenderUsernameResourceCollection.cs b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_SenderUsernameResourceCollection.cs index c3c5f0d281f8..ee05e18d63a8 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_SenderUsernameResourceCollection.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_SenderUsernameResourceCollection.cs @@ -17,12 +17,12 @@ namespace Azure.ResourceManager.Communication.Samples { public partial class Sample_SenderUsernameResourceCollection { - // Get SenderUsernames resource + // Get all SenderUsernames resources for a Domain. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetAll_GetSenderUsernamesResource() + public async Task GetAll_GetAllSenderUsernamesResourcesForADomain() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/senderUsernames/listByDomain.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/senderUsernames/listByDomain.json // this example is just showing the usage of "SenderUsernames_ListByDomains" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -60,7 +60,7 @@ public async Task GetAll_GetSenderUsernamesResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetSenderUsernamesResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/senderUsernames/get.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/senderUsernames/get.json // this example is just showing the usage of "SenderUsernames_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 @@ -96,7 +96,7 @@ public async Task Get_GetSenderUsernamesResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetSenderUsernamesResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/senderUsernames/get.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/senderUsernames/get.json // this example is just showing the usage of "SenderUsernames_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 @@ -128,7 +128,7 @@ public async Task Exists_GetSenderUsernamesResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetSenderUsernamesResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/senderUsernames/get.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/senderUsernames/get.json // this example is just showing the usage of "SenderUsernames_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 @@ -172,7 +172,7 @@ public async Task GetIfExists_GetSenderUsernamesResource() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_CreateOrUpdateSenderUsernamesResource() { - // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-04-01-preview/examples/senderUsernames/createOrUpdate.json + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/senderUsernames/createOrUpdate.json // this example is just showing the usage of "SenderUsernames_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/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_SuppressionListAddressResource.cs b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_SuppressionListAddressResource.cs new file mode 100644 index 000000000000..7b4d90e067f4 --- /dev/null +++ b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_SuppressionListAddressResource.cs @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.Communication; + +namespace Azure.ResourceManager.Communication.Samples +{ + public partial class Sample_SuppressionListAddressResource + { + // Get a SuppressionListAddress resource. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetASuppressionListAddressResource() + { + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/suppressionLists/getAddress.json + // this example is just showing the usage of "SuppressionListAddresses_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 SuppressionListAddressResource created on azure + // for more information of creating SuppressionListAddressResource, please refer to the document of SuppressionListAddressResource + string subscriptionId = "11112222-3333-4444-5555-666677778888"; + string resourceGroupName = "contosoResourceGroup"; + string emailServiceName = "contosoEmailService"; + string domainName = "contoso.com"; + string suppressionListName = "aaaa1111-bbbb-2222-3333-aaaa11112222"; + string addressId = "11112222-3333-4444-5555-aaaabbbbcccc"; + ResourceIdentifier suppressionListAddressResourceId = SuppressionListAddressResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, emailServiceName, domainName, suppressionListName, addressId); + SuppressionListAddressResource suppressionListAddressResource = client.GetSuppressionListAddressResource(suppressionListAddressResourceId); + + // invoke the operation + SuppressionListAddressResource result = await suppressionListAddressResource.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 + SuppressionListAddressResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CreateOrUpdate SuppressionListAddress resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CreateOrUpdateSuppressionListAddressResource() + { + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/suppressionLists/createOrUpdateAddress.json + // this example is just showing the usage of "SuppressionListAddresses_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 SuppressionListAddressResource created on azure + // for more information of creating SuppressionListAddressResource, please refer to the document of SuppressionListAddressResource + string subscriptionId = "11112222-3333-4444-5555-666677778888"; + string resourceGroupName = "contosoResourceGroup"; + string emailServiceName = "contosoEmailService"; + string domainName = "contoso.com"; + string suppressionListName = "aaaa1111-bbbb-2222-3333-aaaa11112222"; + string addressId = "11112222-3333-4444-5555-aaaabbbbcccc"; + ResourceIdentifier suppressionListAddressResourceId = SuppressionListAddressResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, emailServiceName, domainName, suppressionListName, addressId); + SuppressionListAddressResource suppressionListAddressResource = client.GetSuppressionListAddressResource(suppressionListAddressResourceId); + + // invoke the operation + SuppressionListAddressResourceData data = new SuppressionListAddressResourceData() + { + Email = "newuser1@fabrikam.com", + FirstName = "updatedFirstName", + }; + ArmOperation lro = await suppressionListAddressResource.UpdateAsync(WaitUntil.Completed, data); + SuppressionListAddressResource 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 + SuppressionListAddressResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Delete a SuppressionListAddress resource. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteASuppressionListAddressResource() + { + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/suppressionLists/deleteAddress.json + // this example is just showing the usage of "SuppressionListAddresses_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 SuppressionListAddressResource created on azure + // for more information of creating SuppressionListAddressResource, please refer to the document of SuppressionListAddressResource + string subscriptionId = "11112222-3333-4444-5555-666677778888"; + string resourceGroupName = "MyResourceGroup"; + string emailServiceName = "MyEmailServiceResource"; + string domainName = "mydomain.com"; + string suppressionListName = "aaaa1111-bbbb-2222-3333-aaaa11112222"; + string addressId = "11112222-3333-4444-5555-999999999999"; + ResourceIdentifier suppressionListAddressResourceId = SuppressionListAddressResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, emailServiceName, domainName, suppressionListName, addressId); + SuppressionListAddressResource suppressionListAddressResource = client.GetSuppressionListAddressResource(suppressionListAddressResourceId); + + // invoke the operation + await suppressionListAddressResource.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_SuppressionListAddressResourceCollection.cs b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_SuppressionListAddressResourceCollection.cs new file mode 100644 index 000000000000..134098984675 --- /dev/null +++ b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_SuppressionListAddressResourceCollection.cs @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.Communication; + +namespace Azure.ResourceManager.Communication.Samples +{ + public partial class Sample_SuppressionListAddressResourceCollection + { + // Get all SuppressionListAddresses resources for a SuppressionList resource. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_GetAllSuppressionListAddressesResourcesForASuppressionListResource() + { + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/suppressionLists/getAddresses.json + // this example is just showing the usage of "SuppressionListAddresses_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 SuppressionListResource created on azure + // for more information of creating SuppressionListResource, please refer to the document of SuppressionListResource + string subscriptionId = "11112222-3333-4444-5555-666677778888"; + string resourceGroupName = "contosoResourceGroup"; + string emailServiceName = "contosoEmailService"; + string domainName = "contoso.com"; + string suppressionListName = "aaaa1111-bbbb-2222-3333-aaaa11112222"; + ResourceIdentifier suppressionListResourceId = SuppressionListResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, emailServiceName, domainName, suppressionListName); + SuppressionListResource suppressionListResource = client.GetSuppressionListResource(suppressionListResourceId); + + // get the collection of this SuppressionListAddressResource + SuppressionListAddressResourceCollection collection = suppressionListResource.GetSuppressionListAddressResources(); + + // invoke the operation and iterate over the result + await foreach (SuppressionListAddressResource 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 + SuppressionListAddressResourceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get a SuppressionListAddress resource. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetASuppressionListAddressResource() + { + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/suppressionLists/getAddress.json + // this example is just showing the usage of "SuppressionListAddresses_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 SuppressionListResource created on azure + // for more information of creating SuppressionListResource, please refer to the document of SuppressionListResource + string subscriptionId = "11112222-3333-4444-5555-666677778888"; + string resourceGroupName = "contosoResourceGroup"; + string emailServiceName = "contosoEmailService"; + string domainName = "contoso.com"; + string suppressionListName = "aaaa1111-bbbb-2222-3333-aaaa11112222"; + ResourceIdentifier suppressionListResourceId = SuppressionListResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, emailServiceName, domainName, suppressionListName); + SuppressionListResource suppressionListResource = client.GetSuppressionListResource(suppressionListResourceId); + + // get the collection of this SuppressionListAddressResource + SuppressionListAddressResourceCollection collection = suppressionListResource.GetSuppressionListAddressResources(); + + // invoke the operation + string addressId = "11112222-3333-4444-5555-aaaabbbbcccc"; + SuppressionListAddressResource result = await collection.GetAsync(addressId); + + // 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 + SuppressionListAddressResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a SuppressionListAddress resource. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetASuppressionListAddressResource() + { + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/suppressionLists/getAddress.json + // this example is just showing the usage of "SuppressionListAddresses_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 SuppressionListResource created on azure + // for more information of creating SuppressionListResource, please refer to the document of SuppressionListResource + string subscriptionId = "11112222-3333-4444-5555-666677778888"; + string resourceGroupName = "contosoResourceGroup"; + string emailServiceName = "contosoEmailService"; + string domainName = "contoso.com"; + string suppressionListName = "aaaa1111-bbbb-2222-3333-aaaa11112222"; + ResourceIdentifier suppressionListResourceId = SuppressionListResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, emailServiceName, domainName, suppressionListName); + SuppressionListResource suppressionListResource = client.GetSuppressionListResource(suppressionListResourceId); + + // get the collection of this SuppressionListAddressResource + SuppressionListAddressResourceCollection collection = suppressionListResource.GetSuppressionListAddressResources(); + + // invoke the operation + string addressId = "11112222-3333-4444-5555-aaaabbbbcccc"; + bool result = await collection.ExistsAsync(addressId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get a SuppressionListAddress resource. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetASuppressionListAddressResource() + { + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/suppressionLists/getAddress.json + // this example is just showing the usage of "SuppressionListAddresses_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 SuppressionListResource created on azure + // for more information of creating SuppressionListResource, please refer to the document of SuppressionListResource + string subscriptionId = "11112222-3333-4444-5555-666677778888"; + string resourceGroupName = "contosoResourceGroup"; + string emailServiceName = "contosoEmailService"; + string domainName = "contoso.com"; + string suppressionListName = "aaaa1111-bbbb-2222-3333-aaaa11112222"; + ResourceIdentifier suppressionListResourceId = SuppressionListResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, emailServiceName, domainName, suppressionListName); + SuppressionListResource suppressionListResource = client.GetSuppressionListResource(suppressionListResourceId); + + // get the collection of this SuppressionListAddressResource + SuppressionListAddressResourceCollection collection = suppressionListResource.GetSuppressionListAddressResources(); + + // invoke the operation + string addressId = "11112222-3333-4444-5555-aaaabbbbcccc"; + NullableResponse response = await collection.GetIfExistsAsync(addressId); + SuppressionListAddressResource 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 + SuppressionListAddressResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CreateOrUpdate SuppressionListAddress resource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateSuppressionListAddressResource() + { + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/suppressionLists/createOrUpdateAddress.json + // this example is just showing the usage of "SuppressionListAddresses_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 SuppressionListResource created on azure + // for more information of creating SuppressionListResource, please refer to the document of SuppressionListResource + string subscriptionId = "11112222-3333-4444-5555-666677778888"; + string resourceGroupName = "contosoResourceGroup"; + string emailServiceName = "contosoEmailService"; + string domainName = "contoso.com"; + string suppressionListName = "aaaa1111-bbbb-2222-3333-aaaa11112222"; + ResourceIdentifier suppressionListResourceId = SuppressionListResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, emailServiceName, domainName, suppressionListName); + SuppressionListResource suppressionListResource = client.GetSuppressionListResource(suppressionListResourceId); + + // get the collection of this SuppressionListAddressResource + SuppressionListAddressResourceCollection collection = suppressionListResource.GetSuppressionListAddressResources(); + + // invoke the operation + string addressId = "11112222-3333-4444-5555-aaaabbbbcccc"; + SuppressionListAddressResourceData data = new SuppressionListAddressResourceData() + { + Email = "newuser1@fabrikam.com", + FirstName = "updatedFirstName", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, addressId, data); + SuppressionListAddressResource 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 + SuppressionListAddressResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_SuppressionListResource.cs b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_SuppressionListResource.cs new file mode 100644 index 000000000000..8b835210a6d8 --- /dev/null +++ b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_SuppressionListResource.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.Communication; + +namespace Azure.ResourceManager.Communication.Samples +{ + public partial class Sample_SuppressionListResource + { + // Get a SuppressionList resource. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetASuppressionListResource() + { + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/suppressionLists/getSuppressionList.json + // this example is just showing the usage of "SuppressionLists_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 SuppressionListResource created on azure + // for more information of creating SuppressionListResource, please refer to the document of SuppressionListResource + string subscriptionId = "11112222-3333-4444-5555-666677778888"; + string resourceGroupName = "contosoResourceGroup"; + string emailServiceName = "contosoEmailService"; + string domainName = "contoso.com"; + string suppressionListName = "aaaa1111-bbbb-2222-3333-aaaa11112222"; + ResourceIdentifier suppressionListResourceId = SuppressionListResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, emailServiceName, domainName, suppressionListName); + SuppressionListResource suppressionListResource = client.GetSuppressionListResource(suppressionListResourceId); + + // invoke the operation + SuppressionListResource result = await suppressionListResource.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 + SuppressionListResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // CreateOrUpdate SuppressionLists resource. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CreateOrUpdateSuppressionListsResource() + { + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/suppressionLists/createOrUpdateSuppressionList.json + // this example is just showing the usage of "SuppressionLists_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 SuppressionListResource created on azure + // for more information of creating SuppressionListResource, please refer to the document of SuppressionListResource + string subscriptionId = "11112222-3333-4444-5555-666677778888"; + string resourceGroupName = "contosoResourceGroup"; + string emailServiceName = "contosoEmailService"; + string domainName = "contoso.com"; + string suppressionListName = "aaaa1111-bbbb-2222-3333-aaaa11112222"; + ResourceIdentifier suppressionListResourceId = SuppressionListResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, emailServiceName, domainName, suppressionListName); + SuppressionListResource suppressionListResource = client.GetSuppressionListResource(suppressionListResourceId); + + // invoke the operation + SuppressionListResourceData data = new SuppressionListResourceData() + { + ListName = "contosoNewsAlerts", + }; + ArmOperation lro = await suppressionListResource.UpdateAsync(WaitUntil.Completed, data); + SuppressionListResource 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 + SuppressionListResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Delete a SuppressionLists resource. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteASuppressionListsResource() + { + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/suppressionLists/deleteSuppressionList.json + // this example is just showing the usage of "SuppressionLists_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 SuppressionListResource created on azure + // for more information of creating SuppressionListResource, please refer to the document of SuppressionListResource + string subscriptionId = "11112222-3333-4444-5555-666677778888"; + string resourceGroupName = "MyResourceGroup"; + string emailServiceName = "MyEmailServiceResource"; + string domainName = "mydomain.com"; + string suppressionListName = "aaaa1111-bbbb-2222-3333-aaaa11112222"; + ResourceIdentifier suppressionListResourceId = SuppressionListResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, emailServiceName, domainName, suppressionListName); + SuppressionListResource suppressionListResource = client.GetSuppressionListResource(suppressionListResourceId); + + // invoke the operation + await suppressionListResource.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_SuppressionListResourceCollection.cs b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_SuppressionListResourceCollection.cs new file mode 100644 index 000000000000..a12414b55135 --- /dev/null +++ b/sdk/communication/Azure.ResourceManager.Communication/samples/Generated/Samples/Sample_SuppressionListResourceCollection.cs @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.Communication; + +namespace Azure.ResourceManager.Communication.Samples +{ + public partial class Sample_SuppressionListResourceCollection + { + // Get all SuppressionLists resources. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_GetAllSuppressionListsResources() + { + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/suppressionLists/getSuppressionLists.json + // this example is just showing the usage of "SuppressionLists_ListByDomain" 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 CommunicationDomainResource created on azure + // for more information of creating CommunicationDomainResource, please refer to the document of CommunicationDomainResource + string subscriptionId = "11112222-3333-4444-5555-666677778888"; + string resourceGroupName = "contosoResourceGroup"; + string emailServiceName = "contosoEmailService"; + string domainName = "contoso.com"; + ResourceIdentifier communicationDomainResourceId = CommunicationDomainResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, emailServiceName, domainName); + CommunicationDomainResource communicationDomainResource = client.GetCommunicationDomainResource(communicationDomainResourceId); + + // get the collection of this SuppressionListResource + SuppressionListResourceCollection collection = communicationDomainResource.GetSuppressionListResources(); + + // invoke the operation and iterate over the result + await foreach (SuppressionListResource 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 + SuppressionListResourceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get a SuppressionList resource. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetASuppressionListResource() + { + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/suppressionLists/getSuppressionList.json + // this example is just showing the usage of "SuppressionLists_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 CommunicationDomainResource created on azure + // for more information of creating CommunicationDomainResource, please refer to the document of CommunicationDomainResource + string subscriptionId = "11112222-3333-4444-5555-666677778888"; + string resourceGroupName = "contosoResourceGroup"; + string emailServiceName = "contosoEmailService"; + string domainName = "contoso.com"; + ResourceIdentifier communicationDomainResourceId = CommunicationDomainResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, emailServiceName, domainName); + CommunicationDomainResource communicationDomainResource = client.GetCommunicationDomainResource(communicationDomainResourceId); + + // get the collection of this SuppressionListResource + SuppressionListResourceCollection collection = communicationDomainResource.GetSuppressionListResources(); + + // invoke the operation + string suppressionListName = "aaaa1111-bbbb-2222-3333-aaaa11112222"; + SuppressionListResource result = await collection.GetAsync(suppressionListName); + + // 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 + SuppressionListResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a SuppressionList resource. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetASuppressionListResource() + { + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/suppressionLists/getSuppressionList.json + // this example is just showing the usage of "SuppressionLists_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 CommunicationDomainResource created on azure + // for more information of creating CommunicationDomainResource, please refer to the document of CommunicationDomainResource + string subscriptionId = "11112222-3333-4444-5555-666677778888"; + string resourceGroupName = "contosoResourceGroup"; + string emailServiceName = "contosoEmailService"; + string domainName = "contoso.com"; + ResourceIdentifier communicationDomainResourceId = CommunicationDomainResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, emailServiceName, domainName); + CommunicationDomainResource communicationDomainResource = client.GetCommunicationDomainResource(communicationDomainResourceId); + + // get the collection of this SuppressionListResource + SuppressionListResourceCollection collection = communicationDomainResource.GetSuppressionListResources(); + + // invoke the operation + string suppressionListName = "aaaa1111-bbbb-2222-3333-aaaa11112222"; + bool result = await collection.ExistsAsync(suppressionListName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get a SuppressionList resource. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetASuppressionListResource() + { + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/suppressionLists/getSuppressionList.json + // this example is just showing the usage of "SuppressionLists_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 CommunicationDomainResource created on azure + // for more information of creating CommunicationDomainResource, please refer to the document of CommunicationDomainResource + string subscriptionId = "11112222-3333-4444-5555-666677778888"; + string resourceGroupName = "contosoResourceGroup"; + string emailServiceName = "contosoEmailService"; + string domainName = "contoso.com"; + ResourceIdentifier communicationDomainResourceId = CommunicationDomainResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, emailServiceName, domainName); + CommunicationDomainResource communicationDomainResource = client.GetCommunicationDomainResource(communicationDomainResourceId); + + // get the collection of this SuppressionListResource + SuppressionListResourceCollection collection = communicationDomainResource.GetSuppressionListResources(); + + // invoke the operation + string suppressionListName = "aaaa1111-bbbb-2222-3333-aaaa11112222"; + NullableResponse response = await collection.GetIfExistsAsync(suppressionListName); + SuppressionListResource 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 + SuppressionListResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // CreateOrUpdate SuppressionLists resource. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateSuppressionListsResource() + { + // Generated from example definition: specification/communication/resource-manager/Microsoft.Communication/preview/2023-06-01-preview/examples/suppressionLists/createOrUpdateSuppressionList.json + // this example is just showing the usage of "SuppressionLists_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 CommunicationDomainResource created on azure + // for more information of creating CommunicationDomainResource, please refer to the document of CommunicationDomainResource + string subscriptionId = "11112222-3333-4444-5555-666677778888"; + string resourceGroupName = "contosoResourceGroup"; + string emailServiceName = "contosoEmailService"; + string domainName = "contoso.com"; + ResourceIdentifier communicationDomainResourceId = CommunicationDomainResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, emailServiceName, domainName); + CommunicationDomainResource communicationDomainResource = client.GetCommunicationDomainResource(communicationDomainResourceId); + + // get the collection of this SuppressionListResource + SuppressionListResourceCollection collection = communicationDomainResource.GetSuppressionListResources(); + + // invoke the operation + string suppressionListName = "aaaa1111-bbbb-2222-3333-aaaa11112222"; + SuppressionListResourceData data = new SuppressionListResourceData() + { + ListName = "contosoNewsAlerts", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, suppressionListName, data); + SuppressionListResource 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 + SuppressionListResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/ArmCommunicationModelFactory.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/ArmCommunicationModelFactory.cs index ba6b9309c751..603139d82eec 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/ArmCommunicationModelFactory.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/ArmCommunicationModelFactory.cs @@ -168,5 +168,37 @@ public static SenderUsernameResourceData SenderUsernameResourceData(ResourceIden { return new SenderUsernameResourceData(id, name, resourceType, systemData, dataLocation, username, displayName, provisioningState); } + + /// Initializes a new instance of SuppressionListResourceData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The the name of the suppression list. This value must match one of the valid sender usernames of the sending domain. + /// The date the resource was last updated. + /// The date the resource was created. + /// The location where the SuppressionListAddress data is stored at rest. This value is inherited from the parent Domains resource. + /// A new instance for mocking. + public static SuppressionListResourceData SuppressionListResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string listName = null, DateTimeOffset? lastUpdatedTimeStamp = null, DateTimeOffset? createdTimeStamp = null, string dataLocation = null) + { + return new SuppressionListResourceData(id, name, resourceType, systemData, listName, lastUpdatedTimeStamp, createdTimeStamp, dataLocation); + } + + /// Initializes a new instance of SuppressionListAddressResourceData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Email address of the recipient. + /// The first name of the email recipient. + /// The last name of the email recipient. + /// An optional property to provide contextual notes or a description for an address. + /// The date the address was last updated in a suppression list. + /// The location where the SuppressionListAddress data is stored at rest. This value is inherited from the parent Domains resource. + /// A new instance for mocking. + public static SuppressionListAddressResourceData SuppressionListAddressResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string email = null, string firstName = null, string lastName = null, string notes = null, DateTimeOffset? lastModified = null, string dataLocation = null) + { + return new SuppressionListAddressResourceData(id, name, resourceType, systemData, email, firstName, lastName, notes, lastModified, dataLocation); + } } } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationDomainResource.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationDomainResource.cs index 39a5a7b656f5..743f462eeab4 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationDomainResource.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationDomainResource.cs @@ -145,6 +145,59 @@ public virtual Response GetSenderUsernameResource(string return GetSenderUsernameResources().Get(senderUsername, cancellationToken); } + /// Gets a collection of SuppressionListResources in the CommunicationDomainResource. + /// An object representing collection of SuppressionListResources and their operations over a SuppressionListResource. + public virtual SuppressionListResourceCollection GetSuppressionListResources() + { + return GetCachedClient(client => new SuppressionListResourceCollection(client, Id)); + } + + /// + /// Get a SuppressionList resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName} + /// + /// + /// Operation Id + /// SuppressionLists_Get + /// + /// + /// + /// The name of the suppression list. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSuppressionListResourceAsync(string suppressionListName, CancellationToken cancellationToken = default) + { + return await GetSuppressionListResources().GetAsync(suppressionListName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a SuppressionList resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName} + /// + /// + /// Operation Id + /// SuppressionLists_Get + /// + /// + /// + /// The name of the suppression list. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSuppressionListResource(string suppressionListName, CancellationToken cancellationToken = default) + { + return GetSuppressionListResources().Get(suppressionListName, cancellationToken); + } + /// /// Get the Domains resource and its properties. /// diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Extensions/CommunicationExtensions.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Extensions/CommunicationExtensions.cs index 7d8b92d46777..177bc2002320 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Extensions/CommunicationExtensions.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Extensions/CommunicationExtensions.cs @@ -99,6 +99,38 @@ public static SenderUsernameResource GetSenderUsernameResource(this ArmClient cl return GetMockableCommunicationArmClient(client).GetSenderUsernameResource(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. + /// Returns a object. + public static SuppressionListResource GetSuppressionListResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableCommunicationArmClient(client).GetSuppressionListResource(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. + /// Returns a object. + public static SuppressionListAddressResource GetSuppressionListAddressResource(this ArmClient client, ResourceIdentifier id) + { + return GetMockableCommunicationArmClient(client).GetSuppressionListAddressResource(id); + } + /// /// Gets a collection of CommunicationServiceResources in the ResourceGroupResource. /// diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Extensions/MockableCommunicationArmClient.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Extensions/MockableCommunicationArmClient.cs index 6a199223e3f2..05ce7be20d9a 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Extensions/MockableCommunicationArmClient.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Extensions/MockableCommunicationArmClient.cs @@ -83,5 +83,29 @@ public virtual SenderUsernameResource GetSenderUsernameResource(ResourceIdentifi SenderUsernameResource.ValidateResourceId(id); return new SenderUsernameResource(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 SuppressionListResource GetSuppressionListResource(ResourceIdentifier id) + { + SuppressionListResource.ValidateResourceId(id); + return new SuppressionListResource(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 SuppressionListAddressResource GetSuppressionListAddressResource(ResourceIdentifier id) + { + SuppressionListAddressResource.ValidateResourceId(id); + return new SuppressionListAddressResource(Client, id); + } } } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/SuppressionListAddressResourceCollection.Serialization.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/SuppressionListAddressResourceCollection.Serialization.cs new file mode 100644 index 000000000000..fd4e1c1a8cde --- /dev/null +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/SuppressionListAddressResourceCollection.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Communication; + +namespace Azure.ResourceManager.Communication.Models +{ + internal partial class SuppressionListAddressResourceCollection + { + internal static SuppressionListAddressResourceCollection DeserializeSuppressionListAddressResourceCollection(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + 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(SuppressionListAddressResourceData.DeserializeSuppressionListAddressResourceData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new SuppressionListAddressResourceCollection(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/SuppressionListAddressResourceCollection.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/SuppressionListAddressResourceCollection.cs new file mode 100644 index 000000000000..73c1e3d5bbcc --- /dev/null +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/SuppressionListAddressResourceCollection.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Communication; + +namespace Azure.ResourceManager.Communication.Models +{ + /// Collection of addresses in a suppression list. Response will include a nextLink if response contains more pages. + internal partial class SuppressionListAddressResourceCollection + { + /// Initializes a new instance of SuppressionListAddressResourceCollection. + internal SuppressionListAddressResourceCollection() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of SuppressionListAddressResourceCollection. + /// List of suppressed email addresses. + /// The URL the client should use to fetch the next page (per server side paging). + internal SuppressionListAddressResourceCollection(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// List of suppressed email addresses. + public IReadOnlyList Value { get; } + /// The URL the client should use to fetch the next page (per server side paging). + public string NextLink { get; } + } +} diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/SuppressionListAddressResourceData.Serialization.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/SuppressionListAddressResourceData.Serialization.cs new file mode 100644 index 000000000000..63798271ea09 --- /dev/null +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/SuppressionListAddressResourceData.Serialization.cs @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Communication +{ + public partial class SuppressionListAddressResourceData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Email)) + { + writer.WritePropertyName("email"u8); + writer.WriteStringValue(Email); + } + if (Optional.IsDefined(FirstName)) + { + writer.WritePropertyName("firstName"u8); + writer.WriteStringValue(FirstName); + } + if (Optional.IsDefined(LastName)) + { + writer.WritePropertyName("lastName"u8); + writer.WriteStringValue(LastName); + } + if (Optional.IsDefined(Notes)) + { + writer.WritePropertyName("notes"u8); + writer.WriteStringValue(Notes); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static SuppressionListAddressResourceData DeserializeSuppressionListAddressResourceData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional email = default; + Optional firstName = default; + Optional lastName = default; + Optional notes = default; + Optional lastModified = default; + Optional dataLocation = default; + foreach (var property in element.EnumerateObject()) + { + 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("email"u8)) + { + email = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("firstName"u8)) + { + firstName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("lastName"u8)) + { + lastName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("notes"u8)) + { + notes = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("lastModified"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastModified = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("dataLocation"u8)) + { + dataLocation = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new SuppressionListAddressResourceData(id, name, type, systemData.Value, email.Value, firstName.Value, lastName.Value, notes.Value, Optional.ToNullable(lastModified), dataLocation.Value); + } + } +} diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/SuppressionListResourceCollection.Serialization.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/SuppressionListResourceCollection.Serialization.cs new file mode 100644 index 000000000000..8cc3597acf32 --- /dev/null +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/SuppressionListResourceCollection.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Communication; + +namespace Azure.ResourceManager.Communication.Models +{ + internal partial class SuppressionListResourceCollection + { + internal static SuppressionListResourceCollection DeserializeSuppressionListResourceCollection(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + 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(SuppressionListResourceData.DeserializeSuppressionListResourceData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new SuppressionListResourceCollection(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/SuppressionListResourceCollection.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/SuppressionListResourceCollection.cs new file mode 100644 index 000000000000..f3b50c0dee47 --- /dev/null +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/SuppressionListResourceCollection.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Communication; + +namespace Azure.ResourceManager.Communication.Models +{ + /// A class representing a Domains SuppressionListResource collection. + internal partial class SuppressionListResourceCollection + { + /// Initializes a new instance of SuppressionListResourceCollection. + internal SuppressionListResourceCollection() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of SuppressionListResourceCollection. + /// List of SuppressionListResource. + /// The URL the client should use to fetch the next page (per server side paging). + internal SuppressionListResourceCollection(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// List of SuppressionListResource. + public IReadOnlyList Value { get; } + /// The URL the client should use to fetch the next page (per server side paging). + public string NextLink { get; } + } +} diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/SuppressionListResourceData.Serialization.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/SuppressionListResourceData.Serialization.cs new file mode 100644 index 000000000000..a4843ea890c7 --- /dev/null +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/Models/SuppressionListResourceData.Serialization.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Communication +{ + public partial class SuppressionListResourceData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(ListName)) + { + writer.WritePropertyName("listName"u8); + writer.WriteStringValue(ListName); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static SuppressionListResourceData DeserializeSuppressionListResourceData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional listName = default; + Optional lastUpdatedTimeStamp = default; + Optional createdTimeStamp = default; + Optional dataLocation = default; + foreach (var property in element.EnumerateObject()) + { + 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("listName"u8)) + { + listName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("lastUpdatedTimeStamp"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastUpdatedTimeStamp = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("createdTimeStamp"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdTimeStamp = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("dataLocation"u8)) + { + dataLocation = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new SuppressionListResourceData(id, name, type, systemData.Value, listName.Value, Optional.ToNullable(lastUpdatedTimeStamp), Optional.ToNullable(createdTimeStamp), dataLocation.Value); + } + } +} diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/CommunicationServicesRestOperations.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/CommunicationServicesRestOperations.cs index f43aeec376af..70b387e74807 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/CommunicationServicesRestOperations.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/CommunicationServicesRestOperations.cs @@ -33,7 +33,7 @@ public CommunicationServicesRestOperations(HttpPipeline pipeline, string applica { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-04-01-preview"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/DomainsRestOperations.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/DomainsRestOperations.cs index 8121b7511752..b5e2a3af811a 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/DomainsRestOperations.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/DomainsRestOperations.cs @@ -33,7 +33,7 @@ public DomainsRestOperations(HttpPipeline pipeline, string applicationId, Uri en { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-04-01-preview"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/EmailServicesRestOperations.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/EmailServicesRestOperations.cs index 8a123c692ec3..2052abd88d98 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/EmailServicesRestOperations.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/EmailServicesRestOperations.cs @@ -34,7 +34,7 @@ public EmailServicesRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-04-01-preview"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/SenderUsernamesRestOperations.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/SenderUsernamesRestOperations.cs index 7de90a78d3f7..35ac49ec0fea 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/SenderUsernamesRestOperations.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/SenderUsernamesRestOperations.cs @@ -33,7 +33,7 @@ public SenderUsernamesRestOperations(HttpPipeline pipeline, string applicationId { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-04-01-preview"; + _apiVersion = apiVersion ?? "2023-06-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/SuppressionListAddressesRestOperations.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/SuppressionListAddressesRestOperations.cs new file mode 100644 index 000000000000..c4ba8365a39f --- /dev/null +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/SuppressionListAddressesRestOperations.cs @@ -0,0 +1,509 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Communication.Models; + +namespace Azure.ResourceManager.Communication +{ + internal partial class SuppressionListAddressesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of SuppressionListAddressesRestOperations. + /// 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 SuppressionListAddressesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-06-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string emailServiceName, string domainName, string suppressionListName) + { + 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.Communication/emailServices/", false); + uri.AppendPath(emailServiceName, true); + uri.AppendPath("/domains/", false); + uri.AppendPath(domainName, true); + uri.AppendPath("/suppressionLists/", false); + uri.AppendPath(suppressionListName, true); + uri.AppendPath("/suppressionListAddresses", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get all the addresses in a suppression list. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the EmailService resource. + /// The name of the Domains resource. + /// The name of the suppression list. + /// 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 emailServiceName, string domainName, string suppressionListName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(emailServiceName, nameof(emailServiceName)); + Argument.AssertNotNullOrEmpty(domainName, nameof(domainName)); + Argument.AssertNotNullOrEmpty(suppressionListName, nameof(suppressionListName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, emailServiceName, domainName, suppressionListName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + Models.SuppressionListAddressResourceCollection value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = Models.SuppressionListAddressResourceCollection.DeserializeSuppressionListAddressResourceCollection(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get all the addresses in a suppression list. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the EmailService resource. + /// The name of the Domains resource. + /// The name of the suppression list. + /// 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 emailServiceName, string domainName, string suppressionListName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(emailServiceName, nameof(emailServiceName)); + Argument.AssertNotNullOrEmpty(domainName, nameof(domainName)); + Argument.AssertNotNullOrEmpty(suppressionListName, nameof(suppressionListName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, emailServiceName, domainName, suppressionListName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + Models.SuppressionListAddressResourceCollection value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = Models.SuppressionListAddressResourceCollection.DeserializeSuppressionListAddressResourceCollection(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string emailServiceName, string domainName, string suppressionListName, string addressId) + { + 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.Communication/emailServices/", false); + uri.AppendPath(emailServiceName, true); + uri.AppendPath("/domains/", false); + uri.AppendPath(domainName, true); + uri.AppendPath("/suppressionLists/", false); + uri.AppendPath(suppressionListName, true); + uri.AppendPath("/suppressionListAddresses/", false); + uri.AppendPath(addressId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a SuppressionListAddress. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the EmailService resource. + /// The name of the Domains resource. + /// The name of the suppression list. + /// The id of the address in a suppression list. + /// 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 emailServiceName, string domainName, string suppressionListName, string addressId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(emailServiceName, nameof(emailServiceName)); + Argument.AssertNotNullOrEmpty(domainName, nameof(domainName)); + Argument.AssertNotNullOrEmpty(suppressionListName, nameof(suppressionListName)); + Argument.AssertNotNullOrEmpty(addressId, nameof(addressId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, emailServiceName, domainName, suppressionListName, addressId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SuppressionListAddressResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SuppressionListAddressResourceData.DeserializeSuppressionListAddressResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SuppressionListAddressResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a SuppressionListAddress. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the EmailService resource. + /// The name of the Domains resource. + /// The name of the suppression list. + /// The id of the address in a suppression list. + /// 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 emailServiceName, string domainName, string suppressionListName, string addressId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(emailServiceName, nameof(emailServiceName)); + Argument.AssertNotNullOrEmpty(domainName, nameof(domainName)); + Argument.AssertNotNullOrEmpty(suppressionListName, nameof(suppressionListName)); + Argument.AssertNotNullOrEmpty(addressId, nameof(addressId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, emailServiceName, domainName, suppressionListName, addressId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SuppressionListAddressResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SuppressionListAddressResourceData.DeserializeSuppressionListAddressResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SuppressionListAddressResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string emailServiceName, string domainName, string suppressionListName, string addressId, SuppressionListAddressResourceData 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.Communication/emailServices/", false); + uri.AppendPath(emailServiceName, true); + uri.AppendPath("/domains/", false); + uri.AppendPath(domainName, true); + uri.AppendPath("/suppressionLists/", false); + uri.AppendPath(suppressionListName, true); + uri.AppendPath("/suppressionListAddresses/", false); + uri.AppendPath(addressId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create or update a SuppressionListAddress. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the EmailService resource. + /// The name of the Domains resource. + /// The name of the suppression list. + /// The id of the address in a suppression list. + /// Parameters for the create or update operation. + /// 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 emailServiceName, string domainName, string suppressionListName, string addressId, SuppressionListAddressResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(emailServiceName, nameof(emailServiceName)); + Argument.AssertNotNullOrEmpty(domainName, nameof(domainName)); + Argument.AssertNotNullOrEmpty(suppressionListName, nameof(suppressionListName)); + Argument.AssertNotNullOrEmpty(addressId, nameof(addressId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, emailServiceName, domainName, suppressionListName, addressId, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + SuppressionListAddressResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SuppressionListAddressResourceData.DeserializeSuppressionListAddressResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create or update a SuppressionListAddress. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the EmailService resource. + /// The name of the Domains resource. + /// The name of the suppression list. + /// The id of the address in a suppression list. + /// Parameters for the create or update operation. + /// 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 emailServiceName, string domainName, string suppressionListName, string addressId, SuppressionListAddressResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(emailServiceName, nameof(emailServiceName)); + Argument.AssertNotNullOrEmpty(domainName, nameof(domainName)); + Argument.AssertNotNullOrEmpty(suppressionListName, nameof(suppressionListName)); + Argument.AssertNotNullOrEmpty(addressId, nameof(addressId)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, emailServiceName, domainName, suppressionListName, addressId, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + SuppressionListAddressResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SuppressionListAddressResourceData.DeserializeSuppressionListAddressResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string emailServiceName, string domainName, string suppressionListName, string addressId) + { + 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.Communication/emailServices/", false); + uri.AppendPath(emailServiceName, true); + uri.AppendPath("/domains/", false); + uri.AppendPath(domainName, true); + uri.AppendPath("/suppressionLists/", false); + uri.AppendPath(suppressionListName, true); + uri.AppendPath("/suppressionListAddresses/", false); + uri.AppendPath(addressId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Operation to delete a single address from a suppression list. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the EmailService resource. + /// The name of the Domains resource. + /// The name of the suppression list. + /// The id of the address in a suppression list. + /// 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 emailServiceName, string domainName, string suppressionListName, string addressId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(emailServiceName, nameof(emailServiceName)); + Argument.AssertNotNullOrEmpty(domainName, nameof(domainName)); + Argument.AssertNotNullOrEmpty(suppressionListName, nameof(suppressionListName)); + Argument.AssertNotNullOrEmpty(addressId, nameof(addressId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, emailServiceName, domainName, suppressionListName, addressId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Operation to delete a single address from a suppression list. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the EmailService resource. + /// The name of the Domains resource. + /// The name of the suppression list. + /// The id of the address in a suppression list. + /// 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 emailServiceName, string domainName, string suppressionListName, string addressId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(emailServiceName, nameof(emailServiceName)); + Argument.AssertNotNullOrEmpty(domainName, nameof(domainName)); + Argument.AssertNotNullOrEmpty(suppressionListName, nameof(suppressionListName)); + Argument.AssertNotNullOrEmpty(addressId, nameof(addressId)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, emailServiceName, domainName, suppressionListName, addressId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string emailServiceName, string domainName, string suppressionListName) + { + 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; + } + + /// Get all the addresses in a suppression list. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the EmailService resource. + /// The name of the Domains resource. + /// The name of the suppression list. + /// 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 emailServiceName, string domainName, string suppressionListName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(emailServiceName, nameof(emailServiceName)); + Argument.AssertNotNullOrEmpty(domainName, nameof(domainName)); + Argument.AssertNotNullOrEmpty(suppressionListName, nameof(suppressionListName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, emailServiceName, domainName, suppressionListName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + Models.SuppressionListAddressResourceCollection value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = Models.SuppressionListAddressResourceCollection.DeserializeSuppressionListAddressResourceCollection(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get all the addresses in a suppression list. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the EmailService resource. + /// The name of the Domains resource. + /// The name of the suppression list. + /// 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 emailServiceName, string domainName, string suppressionListName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(emailServiceName, nameof(emailServiceName)); + Argument.AssertNotNullOrEmpty(domainName, nameof(domainName)); + Argument.AssertNotNullOrEmpty(suppressionListName, nameof(suppressionListName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, emailServiceName, domainName, suppressionListName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + Models.SuppressionListAddressResourceCollection value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = Models.SuppressionListAddressResourceCollection.DeserializeSuppressionListAddressResourceCollection(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/SuppressionListsRestOperations.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/SuppressionListsRestOperations.cs new file mode 100644 index 000000000000..63ee38d7e468 --- /dev/null +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/RestOperations/SuppressionListsRestOperations.cs @@ -0,0 +1,481 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Communication.Models; + +namespace Azure.ResourceManager.Communication +{ + internal partial class SuppressionListsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of SuppressionListsRestOperations. + /// 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 SuppressionListsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-06-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByDomainRequest(string subscriptionId, string resourceGroupName, string emailServiceName, string domainName) + { + 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.Communication/emailServices/", false); + uri.AppendPath(emailServiceName, true); + uri.AppendPath("/domains/", false); + uri.AppendPath(domainName, true); + uri.AppendPath("/suppressionLists", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List all suppression lists for a domains resource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the EmailService resource. + /// The name of the Domains resource. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByDomainAsync(string subscriptionId, string resourceGroupName, string emailServiceName, string domainName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(emailServiceName, nameof(emailServiceName)); + Argument.AssertNotNullOrEmpty(domainName, nameof(domainName)); + + using var message = CreateListByDomainRequest(subscriptionId, resourceGroupName, emailServiceName, domainName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + Models.SuppressionListResourceCollection value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = Models.SuppressionListResourceCollection.DeserializeSuppressionListResourceCollection(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List all suppression lists for a domains resource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the EmailService resource. + /// The name of the Domains resource. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByDomain(string subscriptionId, string resourceGroupName, string emailServiceName, string domainName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(emailServiceName, nameof(emailServiceName)); + Argument.AssertNotNullOrEmpty(domainName, nameof(domainName)); + + using var message = CreateListByDomainRequest(subscriptionId, resourceGroupName, emailServiceName, domainName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + Models.SuppressionListResourceCollection value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = Models.SuppressionListResourceCollection.DeserializeSuppressionListResourceCollection(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string emailServiceName, string domainName, string suppressionListName) + { + 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.Communication/emailServices/", false); + uri.AppendPath(emailServiceName, true); + uri.AppendPath("/domains/", false); + uri.AppendPath(domainName, true); + uri.AppendPath("/suppressionLists/", false); + uri.AppendPath(suppressionListName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a SuppressionList resource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the EmailService resource. + /// The name of the Domains resource. + /// The name of the suppression list. + /// 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 emailServiceName, string domainName, string suppressionListName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(emailServiceName, nameof(emailServiceName)); + Argument.AssertNotNullOrEmpty(domainName, nameof(domainName)); + Argument.AssertNotNullOrEmpty(suppressionListName, nameof(suppressionListName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, emailServiceName, domainName, suppressionListName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SuppressionListResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SuppressionListResourceData.DeserializeSuppressionListResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SuppressionListResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a SuppressionList resource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the EmailService resource. + /// The name of the Domains resource. + /// The name of the suppression list. + /// 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 emailServiceName, string domainName, string suppressionListName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(emailServiceName, nameof(emailServiceName)); + Argument.AssertNotNullOrEmpty(domainName, nameof(domainName)); + Argument.AssertNotNullOrEmpty(suppressionListName, nameof(suppressionListName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, emailServiceName, domainName, suppressionListName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SuppressionListResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SuppressionListResourceData.DeserializeSuppressionListResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SuppressionListResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string emailServiceName, string domainName, string suppressionListName, SuppressionListResourceData 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.Communication/emailServices/", false); + uri.AppendPath(emailServiceName, true); + uri.AppendPath("/domains/", false); + uri.AppendPath(domainName, true); + uri.AppendPath("/suppressionLists/", false); + uri.AppendPath(suppressionListName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Add a new SuppressionList resource under the parent Domains resource or update an existing SuppressionList resource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the EmailService resource. + /// The name of the Domains resource. + /// The name of the suppression list. + /// Parameters for the create or update operation. + /// 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 emailServiceName, string domainName, string suppressionListName, SuppressionListResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(emailServiceName, nameof(emailServiceName)); + Argument.AssertNotNullOrEmpty(domainName, nameof(domainName)); + Argument.AssertNotNullOrEmpty(suppressionListName, nameof(suppressionListName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, emailServiceName, domainName, suppressionListName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + SuppressionListResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SuppressionListResourceData.DeserializeSuppressionListResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Add a new SuppressionList resource under the parent Domains resource or update an existing SuppressionList resource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the EmailService resource. + /// The name of the Domains resource. + /// The name of the suppression list. + /// Parameters for the create or update operation. + /// 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 emailServiceName, string domainName, string suppressionListName, SuppressionListResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(emailServiceName, nameof(emailServiceName)); + Argument.AssertNotNullOrEmpty(domainName, nameof(domainName)); + Argument.AssertNotNullOrEmpty(suppressionListName, nameof(suppressionListName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, emailServiceName, domainName, suppressionListName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + SuppressionListResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SuppressionListResourceData.DeserializeSuppressionListResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string emailServiceName, string domainName, string suppressionListName) + { + 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.Communication/emailServices/", false); + uri.AppendPath(emailServiceName, true); + uri.AppendPath("/domains/", false); + uri.AppendPath(domainName, true); + uri.AppendPath("/suppressionLists/", false); + uri.AppendPath(suppressionListName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a SuppressionList. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the EmailService resource. + /// The name of the Domains resource. + /// The name of the suppression list. + /// 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 emailServiceName, string domainName, string suppressionListName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(emailServiceName, nameof(emailServiceName)); + Argument.AssertNotNullOrEmpty(domainName, nameof(domainName)); + Argument.AssertNotNullOrEmpty(suppressionListName, nameof(suppressionListName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, emailServiceName, domainName, suppressionListName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a SuppressionList. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the EmailService resource. + /// The name of the Domains resource. + /// The name of the suppression list. + /// 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 emailServiceName, string domainName, string suppressionListName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(emailServiceName, nameof(emailServiceName)); + Argument.AssertNotNullOrEmpty(domainName, nameof(domainName)); + Argument.AssertNotNullOrEmpty(suppressionListName, nameof(suppressionListName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, emailServiceName, domainName, suppressionListName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByDomainNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string emailServiceName, string domainName) + { + 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 all suppression lists for a domains resource. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the EmailService resource. + /// The name of the Domains resource. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListByDomainNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string emailServiceName, string domainName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(emailServiceName, nameof(emailServiceName)); + Argument.AssertNotNullOrEmpty(domainName, nameof(domainName)); + + using var message = CreateListByDomainNextPageRequest(nextLink, subscriptionId, resourceGroupName, emailServiceName, domainName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + Models.SuppressionListResourceCollection value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = Models.SuppressionListResourceCollection.DeserializeSuppressionListResourceCollection(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List all suppression lists for a domains resource. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the EmailService resource. + /// The name of the Domains resource. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListByDomainNextPage(string nextLink, string subscriptionId, string resourceGroupName, string emailServiceName, string domainName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(emailServiceName, nameof(emailServiceName)); + Argument.AssertNotNullOrEmpty(domainName, nameof(domainName)); + + using var message = CreateListByDomainNextPageRequest(nextLink, subscriptionId, resourceGroupName, emailServiceName, domainName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + Models.SuppressionListResourceCollection value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = Models.SuppressionListResourceCollection.DeserializeSuppressionListResourceCollection(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/SuppressionListAddressResource.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/SuppressionListAddressResource.cs new file mode 100644 index 000000000000..0ba95ea18e0d --- /dev/null +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/SuppressionListAddressResource.cs @@ -0,0 +1,303 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Communication +{ + /// + /// A Class representing a SuppressionListAddressResource 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 GetSuppressionListAddressResource method. + /// Otherwise you can get one from its parent resource using the GetSuppressionListAddressResource method. + /// + public partial class SuppressionListAddressResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The emailServiceName. + /// The domainName. + /// The suppressionListName. + /// The addressId. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string emailServiceName, string domainName, string suppressionListName, string addressId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName}/suppressionListAddresses/{addressId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _suppressionListAddressResourceSuppressionListAddressesClientDiagnostics; + private readonly SuppressionListAddressesRestOperations _suppressionListAddressResourceSuppressionListAddressesRestClient; + private readonly SuppressionListAddressResourceData _data; + + /// Initializes a new instance of the class for mocking. + protected SuppressionListAddressResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SuppressionListAddressResource(ArmClient client, SuppressionListAddressResourceData 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 SuppressionListAddressResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _suppressionListAddressResourceSuppressionListAddressesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Communication", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string suppressionListAddressResourceSuppressionListAddressesApiVersion); + _suppressionListAddressResourceSuppressionListAddressesRestClient = new SuppressionListAddressesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, suppressionListAddressResourceSuppressionListAddressesApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Communication/emailServices/domains/suppressionLists/suppressionListAddresses"; + + /// 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 SuppressionListAddressResourceData 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 a SuppressionListAddress. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName}/suppressionListAddresses/{addressId} + /// + /// + /// Operation Id + /// SuppressionListAddresses_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _suppressionListAddressResourceSuppressionListAddressesClientDiagnostics.CreateScope("SuppressionListAddressResource.Get"); + scope.Start(); + try + { + var response = await _suppressionListAddressResourceSuppressionListAddressesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, 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 SuppressionListAddressResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a SuppressionListAddress. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName}/suppressionListAddresses/{addressId} + /// + /// + /// Operation Id + /// SuppressionListAddresses_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _suppressionListAddressResourceSuppressionListAddressesClientDiagnostics.CreateScope("SuppressionListAddressResource.Get"); + scope.Start(); + try + { + var response = _suppressionListAddressResourceSuppressionListAddressesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SuppressionListAddressResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Operation to delete a single address from a suppression list. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName}/suppressionListAddresses/{addressId} + /// + /// + /// Operation Id + /// SuppressionListAddresses_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _suppressionListAddressResourceSuppressionListAddressesClientDiagnostics.CreateScope("SuppressionListAddressResource.Delete"); + scope.Start(); + try + { + var response = await _suppressionListAddressResourceSuppressionListAddressesRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new CommunicationArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Operation to delete a single address from a suppression list. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName}/suppressionListAddresses/{addressId} + /// + /// + /// Operation Id + /// SuppressionListAddresses_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _suppressionListAddressResourceSuppressionListAddressesClientDiagnostics.CreateScope("SuppressionListAddressResource.Delete"); + scope.Start(); + try + { + var response = _suppressionListAddressResourceSuppressionListAddressesRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new CommunicationArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update a SuppressionListAddress. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName}/suppressionListAddresses/{addressId} + /// + /// + /// Operation Id + /// SuppressionListAddresses_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Parameters for the create or update operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, SuppressionListAddressResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _suppressionListAddressResourceSuppressionListAddressesClientDiagnostics.CreateScope("SuppressionListAddressResource.Update"); + scope.Start(); + try + { + var response = await _suppressionListAddressResourceSuppressionListAddressesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new CommunicationArmOperation(Response.FromValue(new SuppressionListAddressResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update a SuppressionListAddress. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName}/suppressionListAddresses/{addressId} + /// + /// + /// Operation Id + /// SuppressionListAddresses_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Parameters for the create or update operation. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, SuppressionListAddressResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _suppressionListAddressResourceSuppressionListAddressesClientDiagnostics.CreateScope("SuppressionListAddressResource.Update"); + scope.Start(); + try + { + var response = _suppressionListAddressResourceSuppressionListAddressesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Parent.Name, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new CommunicationArmOperation(Response.FromValue(new SuppressionListAddressResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/SuppressionListAddressResourceCollection.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/SuppressionListAddressResourceCollection.cs new file mode 100644 index 000000000000..925df2d207d5 --- /dev/null +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/SuppressionListAddressResourceCollection.cs @@ -0,0 +1,415 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Communication +{ + /// + /// 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 GetSuppressionListAddressResources method from an instance of . + /// + public partial class SuppressionListAddressResourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _suppressionListAddressResourceSuppressionListAddressesClientDiagnostics; + private readonly SuppressionListAddressesRestOperations _suppressionListAddressResourceSuppressionListAddressesRestClient; + + /// Initializes a new instance of the class for mocking. + protected SuppressionListAddressResourceCollection() + { + } + + /// 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 SuppressionListAddressResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _suppressionListAddressResourceSuppressionListAddressesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Communication", SuppressionListAddressResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(SuppressionListAddressResource.ResourceType, out string suppressionListAddressResourceSuppressionListAddressesApiVersion); + _suppressionListAddressResourceSuppressionListAddressesRestClient = new SuppressionListAddressesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, suppressionListAddressResourceSuppressionListAddressesApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != SuppressionListResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, SuppressionListResource.ResourceType), nameof(id)); + } + + /// + /// Create or update a SuppressionListAddress. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName}/suppressionListAddresses/{addressId} + /// + /// + /// Operation Id + /// SuppressionListAddresses_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The id of the address in a suppression list. + /// Parameters for the create or update operation. + /// 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 addressId, SuppressionListAddressResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(addressId, nameof(addressId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _suppressionListAddressResourceSuppressionListAddressesClientDiagnostics.CreateScope("SuppressionListAddressResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _suppressionListAddressResourceSuppressionListAddressesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, addressId, data, cancellationToken).ConfigureAwait(false); + var operation = new CommunicationArmOperation(Response.FromValue(new SuppressionListAddressResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update a SuppressionListAddress. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName}/suppressionListAddresses/{addressId} + /// + /// + /// Operation Id + /// SuppressionListAddresses_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The id of the address in a suppression list. + /// Parameters for the create or update operation. + /// 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 addressId, SuppressionListAddressResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(addressId, nameof(addressId)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _suppressionListAddressResourceSuppressionListAddressesClientDiagnostics.CreateScope("SuppressionListAddressResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _suppressionListAddressResourceSuppressionListAddressesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, addressId, data, cancellationToken); + var operation = new CommunicationArmOperation(Response.FromValue(new SuppressionListAddressResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a SuppressionListAddress. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName}/suppressionListAddresses/{addressId} + /// + /// + /// Operation Id + /// SuppressionListAddresses_Get + /// + /// + /// + /// The id of the address in a suppression list. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string addressId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(addressId, nameof(addressId)); + + using var scope = _suppressionListAddressResourceSuppressionListAddressesClientDiagnostics.CreateScope("SuppressionListAddressResourceCollection.Get"); + scope.Start(); + try + { + var response = await _suppressionListAddressResourceSuppressionListAddressesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, addressId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SuppressionListAddressResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a SuppressionListAddress. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName}/suppressionListAddresses/{addressId} + /// + /// + /// Operation Id + /// SuppressionListAddresses_Get + /// + /// + /// + /// The id of the address in a suppression list. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string addressId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(addressId, nameof(addressId)); + + using var scope = _suppressionListAddressResourceSuppressionListAddressesClientDiagnostics.CreateScope("SuppressionListAddressResourceCollection.Get"); + scope.Start(); + try + { + var response = _suppressionListAddressResourceSuppressionListAddressesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, addressId, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SuppressionListAddressResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get all the addresses in a suppression list. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName}/suppressionListAddresses + /// + /// + /// Operation Id + /// SuppressionListAddresses_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _suppressionListAddressResourceSuppressionListAddressesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _suppressionListAddressResourceSuppressionListAddressesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SuppressionListAddressResource(Client, SuppressionListAddressResourceData.DeserializeSuppressionListAddressResourceData(e)), _suppressionListAddressResourceSuppressionListAddressesClientDiagnostics, Pipeline, "SuppressionListAddressResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Get all the addresses in a suppression list. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName}/suppressionListAddresses + /// + /// + /// Operation Id + /// SuppressionListAddresses_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _suppressionListAddressResourceSuppressionListAddressesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _suppressionListAddressResourceSuppressionListAddressesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SuppressionListAddressResource(Client, SuppressionListAddressResourceData.DeserializeSuppressionListAddressResourceData(e)), _suppressionListAddressResourceSuppressionListAddressesClientDiagnostics, Pipeline, "SuppressionListAddressResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName}/suppressionListAddresses/{addressId} + /// + /// + /// Operation Id + /// SuppressionListAddresses_Get + /// + /// + /// + /// The id of the address in a suppression list. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string addressId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(addressId, nameof(addressId)); + + using var scope = _suppressionListAddressResourceSuppressionListAddressesClientDiagnostics.CreateScope("SuppressionListAddressResourceCollection.Exists"); + scope.Start(); + try + { + var response = await _suppressionListAddressResourceSuppressionListAddressesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, addressId, 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.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName}/suppressionListAddresses/{addressId} + /// + /// + /// Operation Id + /// SuppressionListAddresses_Get + /// + /// + /// + /// The id of the address in a suppression list. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string addressId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(addressId, nameof(addressId)); + + using var scope = _suppressionListAddressResourceSuppressionListAddressesClientDiagnostics.CreateScope("SuppressionListAddressResourceCollection.Exists"); + scope.Start(); + try + { + var response = _suppressionListAddressResourceSuppressionListAddressesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, addressId, 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.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName}/suppressionListAddresses/{addressId} + /// + /// + /// Operation Id + /// SuppressionListAddresses_Get + /// + /// + /// + /// The id of the address in a suppression list. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string addressId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(addressId, nameof(addressId)); + + using var scope = _suppressionListAddressResourceSuppressionListAddressesClientDiagnostics.CreateScope("SuppressionListAddressResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _suppressionListAddressResourceSuppressionListAddressesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, addressId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SuppressionListAddressResource(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.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName}/suppressionListAddresses/{addressId} + /// + /// + /// Operation Id + /// SuppressionListAddresses_Get + /// + /// + /// + /// The id of the address in a suppression list. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string addressId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(addressId, nameof(addressId)); + + using var scope = _suppressionListAddressResourceSuppressionListAddressesClientDiagnostics.CreateScope("SuppressionListAddressResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _suppressionListAddressResourceSuppressionListAddressesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, addressId, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SuppressionListAddressResource(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/communication/Azure.ResourceManager.Communication/src/Generated/SuppressionListAddressResourceData.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/SuppressionListAddressResourceData.cs new file mode 100644 index 000000000000..a3d14108cbca --- /dev/null +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/SuppressionListAddressResourceData.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Communication +{ + /// + /// A class representing the SuppressionListAddressResource data model. + /// A object that represents a SuppressionList record. + /// + public partial class SuppressionListAddressResourceData : ResourceData + { + /// Initializes a new instance of SuppressionListAddressResourceData. + public SuppressionListAddressResourceData() + { + } + + /// Initializes a new instance of SuppressionListAddressResourceData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Email address of the recipient. + /// The first name of the email recipient. + /// The last name of the email recipient. + /// An optional property to provide contextual notes or a description for an address. + /// The date the address was last updated in a suppression list. + /// The location where the SuppressionListAddress data is stored at rest. This value is inherited from the parent Domains resource. + internal SuppressionListAddressResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string email, string firstName, string lastName, string notes, DateTimeOffset? lastModified, string dataLocation) : base(id, name, resourceType, systemData) + { + Email = email; + FirstName = firstName; + LastName = lastName; + Notes = notes; + LastModified = lastModified; + DataLocation = dataLocation; + } + + /// Email address of the recipient. + public string Email { get; set; } + /// The first name of the email recipient. + public string FirstName { get; set; } + /// The last name of the email recipient. + public string LastName { get; set; } + /// An optional property to provide contextual notes or a description for an address. + public string Notes { get; set; } + /// The date the address was last updated in a suppression list. + public DateTimeOffset? LastModified { get; } + /// The location where the SuppressionListAddress data is stored at rest. This value is inherited from the parent Domains resource. + public string DataLocation { get; } + } +} diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/SuppressionListResource.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/SuppressionListResource.cs new file mode 100644 index 000000000000..f90521e85626 --- /dev/null +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/SuppressionListResource.cs @@ -0,0 +1,355 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Communication +{ + /// + /// A Class representing a SuppressionListResource 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 GetSuppressionListResource method. + /// Otherwise you can get one from its parent resource using the GetSuppressionListResource method. + /// + public partial class SuppressionListResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The emailServiceName. + /// The domainName. + /// The suppressionListName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string emailServiceName, string domainName, string suppressionListName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _suppressionListResourceSuppressionListsClientDiagnostics; + private readonly SuppressionListsRestOperations _suppressionListResourceSuppressionListsRestClient; + private readonly SuppressionListResourceData _data; + + /// Initializes a new instance of the class for mocking. + protected SuppressionListResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SuppressionListResource(ArmClient client, SuppressionListResourceData 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 SuppressionListResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _suppressionListResourceSuppressionListsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Communication", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string suppressionListResourceSuppressionListsApiVersion); + _suppressionListResourceSuppressionListsRestClient = new SuppressionListsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, suppressionListResourceSuppressionListsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Communication/emailServices/domains/suppressionLists"; + + /// 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 SuppressionListResourceData 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 SuppressionListAddressResources in the SuppressionListResource. + /// An object representing collection of SuppressionListAddressResources and their operations over a SuppressionListAddressResource. + public virtual SuppressionListAddressResourceCollection GetSuppressionListAddressResources() + { + return GetCachedClient(client => new SuppressionListAddressResourceCollection(client, Id)); + } + + /// + /// Get a SuppressionListAddress. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName}/suppressionListAddresses/{addressId} + /// + /// + /// Operation Id + /// SuppressionListAddresses_Get + /// + /// + /// + /// The id of the address in a suppression list. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSuppressionListAddressResourceAsync(string addressId, CancellationToken cancellationToken = default) + { + return await GetSuppressionListAddressResources().GetAsync(addressId, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a SuppressionListAddress. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName}/suppressionListAddresses/{addressId} + /// + /// + /// Operation Id + /// SuppressionListAddresses_Get + /// + /// + /// + /// The id of the address in a suppression list. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSuppressionListAddressResource(string addressId, CancellationToken cancellationToken = default) + { + return GetSuppressionListAddressResources().Get(addressId, cancellationToken); + } + + /// + /// Get a SuppressionList resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName} + /// + /// + /// Operation Id + /// SuppressionLists_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _suppressionListResourceSuppressionListsClientDiagnostics.CreateScope("SuppressionListResource.Get"); + scope.Start(); + try + { + var response = await _suppressionListResourceSuppressionListsRestClient.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 SuppressionListResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a SuppressionList resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName} + /// + /// + /// Operation Id + /// SuppressionLists_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _suppressionListResourceSuppressionListsClientDiagnostics.CreateScope("SuppressionListResource.Get"); + scope.Start(); + try + { + var response = _suppressionListResourceSuppressionListsRestClient.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 SuppressionListResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a SuppressionList. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName} + /// + /// + /// Operation Id + /// SuppressionLists_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _suppressionListResourceSuppressionListsClientDiagnostics.CreateScope("SuppressionListResource.Delete"); + scope.Start(); + try + { + var response = await _suppressionListResourceSuppressionListsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new CommunicationArmOperation(response); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a SuppressionList. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName} + /// + /// + /// Operation Id + /// SuppressionLists_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _suppressionListResourceSuppressionListsClientDiagnostics.CreateScope("SuppressionListResource.Delete"); + scope.Start(); + try + { + var response = _suppressionListResourceSuppressionListsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new CommunicationArmOperation(response); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a new SuppressionList resource under the parent Domains resource or update an existing SuppressionList resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName} + /// + /// + /// Operation Id + /// SuppressionLists_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Parameters for the create or update operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, SuppressionListResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _suppressionListResourceSuppressionListsClientDiagnostics.CreateScope("SuppressionListResource.Update"); + scope.Start(); + try + { + var response = await _suppressionListResourceSuppressionListsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new CommunicationArmOperation(Response.FromValue(new SuppressionListResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a new SuppressionList resource under the parent Domains resource or update an existing SuppressionList resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName} + /// + /// + /// Operation Id + /// SuppressionLists_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Parameters for the create or update operation. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, SuppressionListResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _suppressionListResourceSuppressionListsClientDiagnostics.CreateScope("SuppressionListResource.Update"); + scope.Start(); + try + { + var response = _suppressionListResourceSuppressionListsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new CommunicationArmOperation(Response.FromValue(new SuppressionListResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/SuppressionListResourceCollection.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/SuppressionListResourceCollection.cs new file mode 100644 index 000000000000..af4e6be3ec5e --- /dev/null +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/SuppressionListResourceCollection.cs @@ -0,0 +1,415 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Communication +{ + /// + /// 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 GetSuppressionListResources method from an instance of . + /// + public partial class SuppressionListResourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _suppressionListResourceSuppressionListsClientDiagnostics; + private readonly SuppressionListsRestOperations _suppressionListResourceSuppressionListsRestClient; + + /// Initializes a new instance of the class for mocking. + protected SuppressionListResourceCollection() + { + } + + /// 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 SuppressionListResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _suppressionListResourceSuppressionListsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Communication", SuppressionListResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(SuppressionListResource.ResourceType, out string suppressionListResourceSuppressionListsApiVersion); + _suppressionListResourceSuppressionListsRestClient = new SuppressionListsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, suppressionListResourceSuppressionListsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != CommunicationDomainResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, CommunicationDomainResource.ResourceType), nameof(id)); + } + + /// + /// Add a new SuppressionList resource under the parent Domains resource or update an existing SuppressionList resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName} + /// + /// + /// Operation Id + /// SuppressionLists_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the suppression list. + /// Parameters for the create or update operation. + /// 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 suppressionListName, SuppressionListResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(suppressionListName, nameof(suppressionListName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _suppressionListResourceSuppressionListsClientDiagnostics.CreateScope("SuppressionListResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _suppressionListResourceSuppressionListsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, suppressionListName, data, cancellationToken).ConfigureAwait(false); + var operation = new CommunicationArmOperation(Response.FromValue(new SuppressionListResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a new SuppressionList resource under the parent Domains resource or update an existing SuppressionList resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName} + /// + /// + /// Operation Id + /// SuppressionLists_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the suppression list. + /// Parameters for the create or update operation. + /// 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 suppressionListName, SuppressionListResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(suppressionListName, nameof(suppressionListName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _suppressionListResourceSuppressionListsClientDiagnostics.CreateScope("SuppressionListResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _suppressionListResourceSuppressionListsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, suppressionListName, data, cancellationToken); + var operation = new CommunicationArmOperation(Response.FromValue(new SuppressionListResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a SuppressionList resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName} + /// + /// + /// Operation Id + /// SuppressionLists_Get + /// + /// + /// + /// The name of the suppression list. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string suppressionListName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(suppressionListName, nameof(suppressionListName)); + + using var scope = _suppressionListResourceSuppressionListsClientDiagnostics.CreateScope("SuppressionListResourceCollection.Get"); + scope.Start(); + try + { + var response = await _suppressionListResourceSuppressionListsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, suppressionListName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SuppressionListResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a SuppressionList resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName} + /// + /// + /// Operation Id + /// SuppressionLists_Get + /// + /// + /// + /// The name of the suppression list. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string suppressionListName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(suppressionListName, nameof(suppressionListName)); + + using var scope = _suppressionListResourceSuppressionListsClientDiagnostics.CreateScope("SuppressionListResourceCollection.Get"); + scope.Start(); + try + { + var response = _suppressionListResourceSuppressionListsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, suppressionListName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SuppressionListResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List all suppression lists for a domains resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists + /// + /// + /// Operation Id + /// SuppressionLists_ListByDomain + /// + /// + /// + /// 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) => _suppressionListResourceSuppressionListsRestClient.CreateListByDomainRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _suppressionListResourceSuppressionListsRestClient.CreateListByDomainNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SuppressionListResource(Client, SuppressionListResourceData.DeserializeSuppressionListResourceData(e)), _suppressionListResourceSuppressionListsClientDiagnostics, Pipeline, "SuppressionListResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List all suppression lists for a domains resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists + /// + /// + /// Operation Id + /// SuppressionLists_ListByDomain + /// + /// + /// + /// 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) => _suppressionListResourceSuppressionListsRestClient.CreateListByDomainRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _suppressionListResourceSuppressionListsRestClient.CreateListByDomainNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SuppressionListResource(Client, SuppressionListResourceData.DeserializeSuppressionListResourceData(e)), _suppressionListResourceSuppressionListsClientDiagnostics, Pipeline, "SuppressionListResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName} + /// + /// + /// Operation Id + /// SuppressionLists_Get + /// + /// + /// + /// The name of the suppression list. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string suppressionListName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(suppressionListName, nameof(suppressionListName)); + + using var scope = _suppressionListResourceSuppressionListsClientDiagnostics.CreateScope("SuppressionListResourceCollection.Exists"); + scope.Start(); + try + { + var response = await _suppressionListResourceSuppressionListsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, suppressionListName, 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.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName} + /// + /// + /// Operation Id + /// SuppressionLists_Get + /// + /// + /// + /// The name of the suppression list. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string suppressionListName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(suppressionListName, nameof(suppressionListName)); + + using var scope = _suppressionListResourceSuppressionListsClientDiagnostics.CreateScope("SuppressionListResourceCollection.Exists"); + scope.Start(); + try + { + var response = _suppressionListResourceSuppressionListsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, suppressionListName, 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.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName} + /// + /// + /// Operation Id + /// SuppressionLists_Get + /// + /// + /// + /// The name of the suppression list. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string suppressionListName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(suppressionListName, nameof(suppressionListName)); + + using var scope = _suppressionListResourceSuppressionListsClientDiagnostics.CreateScope("SuppressionListResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _suppressionListResourceSuppressionListsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, suppressionListName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SuppressionListResource(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.Communication/emailServices/{emailServiceName}/domains/{domainName}/suppressionLists/{suppressionListName} + /// + /// + /// Operation Id + /// SuppressionLists_Get + /// + /// + /// + /// The name of the suppression list. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string suppressionListName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(suppressionListName, nameof(suppressionListName)); + + using var scope = _suppressionListResourceSuppressionListsClientDiagnostics.CreateScope("SuppressionListResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _suppressionListResourceSuppressionListsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, suppressionListName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SuppressionListResource(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/communication/Azure.ResourceManager.Communication/src/Generated/SuppressionListResourceData.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/SuppressionListResourceData.cs new file mode 100644 index 000000000000..5c4217dd5088 --- /dev/null +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/SuppressionListResourceData.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Communication +{ + /// + /// A class representing the SuppressionListResource data model. + /// A class representing a SuppressionList resource. + /// + public partial class SuppressionListResourceData : ResourceData + { + /// Initializes a new instance of SuppressionListResourceData. + public SuppressionListResourceData() + { + } + + /// Initializes a new instance of SuppressionListResourceData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The the name of the suppression list. This value must match one of the valid sender usernames of the sending domain. + /// The date the resource was last updated. + /// The date the resource was created. + /// The location where the SuppressionListAddress data is stored at rest. This value is inherited from the parent Domains resource. + internal SuppressionListResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string listName, DateTimeOffset? lastUpdatedTimeStamp, DateTimeOffset? createdTimeStamp, string dataLocation) : base(id, name, resourceType, systemData) + { + ListName = listName; + LastUpdatedTimeStamp = lastUpdatedTimeStamp; + CreatedTimeStamp = createdTimeStamp; + DataLocation = dataLocation; + } + + /// The the name of the suppression list. This value must match one of the valid sender usernames of the sending domain. + public string ListName { get; set; } + /// The date the resource was last updated. + public DateTimeOffset? LastUpdatedTimeStamp { get; } + /// The date the resource was created. + public DateTimeOffset? CreatedTimeStamp { get; } + /// The location where the SuppressionListAddress data is stored at rest. This value is inherited from the parent Domains resource. + public string DataLocation { get; } + } +} diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/autorest.md b/sdk/communication/Azure.ResourceManager.Communication/src/autorest.md index 6dba6fb0a221..f7bba04199f7 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/autorest.md +++ b/sdk/communication/Azure.ResourceManager.Communication/src/autorest.md @@ -8,7 +8,7 @@ azure-arm: true title: communication namespace: Azure.ResourceManager.Communication # default tag is a preview version -require: https://github.com/Azure/azure-rest-api-specs/blob/d71132a3e8bf8ad22ab77991805e033ed1b66dff/specification/communication/resource-manager/readme.md +require: https://github.com/Azure/azure-rest-api-specs/blob/5775c90db370eb73a5cd7ccb36e16c34630a5c8c/specification/communication/resource-manager/readme.md#tag-package-preview-2023-06 output-folder: $(this-folder)/Generated clear-output-folder: true sample-gen: @@ -74,7 +74,9 @@ rename-mapping: DnsRecord: VerificationDnsRecord DomainsProvisioningState: DomainProvisioningState ProvisioningState: CommunicationServiceProvisioningState - + SuppressionListResource.properties.createdTimeStamp: -|date-time + SuppressionListResource.properties.lastUpdatedTimeStamp: -|date-time + directive: - from: types.json where: $.parameters.SubscriptionIdParameter diff --git a/sdk/communication/Azure.ResourceManager.Communication/tests/Infrastructure/CommunicationManagementClientLiveTestBase.cs b/sdk/communication/Azure.ResourceManager.Communication/tests/Infrastructure/CommunicationManagementClientLiveTestBase.cs index aa40d125eddf..165372225e18 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/tests/Infrastructure/CommunicationManagementClientLiveTestBase.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/tests/Infrastructure/CommunicationManagementClientLiveTestBase.cs @@ -33,7 +33,7 @@ private void Init() ResourceGroupPrefix = "Communication-RG-"; ResourceLocation = "global"; ResourceDataLocation = "UnitedStates"; - //Sanitizer = new CommunicationManagementRecordedTestSanitizer(); + // Sanitizer = new CommunicationManagementRecordedTestSanitizer(); } protected CommunicationManagementClientLiveTestBase(bool isAsync, RecordedTestMode mode) @@ -73,6 +73,16 @@ internal async Task CreateDefaultDomain(string doma return domainLro.Value; } + internal async Task CreateAzureManagedDomain(EmailServiceResource emailService) + { + CommunicationDomainResourceData data = new CommunicationDomainResourceData(ResourceLocation) + { + DomainManagement = DomainManagement.AzureManaged + }; + var domainLro = await emailService.GetCommunicationDomainResources().CreateOrUpdateAsync(WaitUntil.Completed, "AzureManagedDomain", data); + return domainLro.Value; + } + internal async Task CreateDefaultSenderUsernameResource(string username, string displayName, CommunicationDomainResource domain) { SenderUsernameResourceData data = new SenderUsernameResourceData() @@ -86,6 +96,44 @@ internal async Task CreateDefaultSenderUsernameResource( return senderUsername; } + internal async Task CreateDefaultSuppressionListResource(CommunicationDomainResource domain, string listName) + { + var id = Recording.Random.NewGuid().ToString(); + + SuppressionListResourceData data = new SuppressionListResourceData + { + ListName = listName + }; + + ArmOperation suppressionListOp = + await domain.GetSuppressionListResources().CreateOrUpdateAsync(WaitUntil.Completed, id, data); + SuppressionListResource suppressionList = suppressionListOp.Value; + return suppressionList; + } + + internal async Task CreateDefaultSuppressionListAddressResource( + SuppressionListResource suppressionList, + string email, + string firstName = default, + string lastName = default, + string notes = default) + { + var id = Recording.Random.NewGuid().ToString(); + + SuppressionListAddressResourceData data = new SuppressionListAddressResourceData + { + Email = email, + FirstName = firstName, + LastName = lastName, + Notes = notes + }; + + ArmOperation suppressionListAddressOp = + await suppressionList.GetSuppressionListAddressResources().CreateOrUpdateAsync(WaitUntil.Completed, id, data); + SuppressionListAddressResource suppressionListAddress = suppressionListAddressOp.Value; + return suppressionListAddress; + } + private void IgnoreTestInLiveMode() { if (Mode == RecordedTestMode.Live) diff --git a/sdk/communication/Azure.ResourceManager.Communication/tests/ScenarioTests/SuppressionListTests.cs b/sdk/communication/Azure.ResourceManager.Communication/tests/ScenarioTests/SuppressionListTests.cs new file mode 100644 index 000000000000..13b51f200ac2 --- /dev/null +++ b/sdk/communication/Azure.ResourceManager.Communication/tests/ScenarioTests/SuppressionListTests.cs @@ -0,0 +1,280 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.TestFramework; +using Azure.Core.Tests.TestFramework; +// using Azure.Core.TestFramework; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.Communication.Tests +{ + public class SuppressionListTests : CommunicationManagementClientLiveTestBase + { + private ResourceGroupResource _resourceGroup; + private CommunicationServiceResource _communicationService; + private EmailServiceResource _emailService; + private CommunicationDomainResource _domainResource; + private ResourceIdentifier _resourceGroupIdentifier; + private string _communicationServiceName; + private string _emailServiceName; + private string _location; + private string _dataLocation; + + public SuppressionListTests(bool isAsync) + : base(isAsync) //, Core.TestFramework.RecordedTestMode.Record) + { + } + + [OneTimeSetUp] + public async Task OneTimeSetup() + { + var rgLro = await GlobalClient + .GetDefaultSubscriptionAsync().Result + .GetResourceGroups() + .CreateOrUpdateAsync(WaitUntil.Completed, SessionRecording.GenerateAssetName(ResourceGroupPrefix), new ResourceGroupData(new AzureLocation("westus"))); + + ResourceGroupResource rg = rgLro.Value; + _resourceGroupIdentifier = rg.Id; + _location = ResourceLocation; + _dataLocation = ResourceDataLocation; + + _communicationServiceName = SessionRecording.GenerateAssetName("acssdktest-"); + _communicationService = await CreateDefaultCommunicationServices(_communicationServiceName, rg); + + _emailServiceName = SessionRecording.GenerateAssetName("acssdktest-"); + _emailService = await CreateDefaultEmailServices(_emailServiceName, rg); + + _domainResource = await CreateAzureManagedDomain(_emailService); + + await StopSessionRecordingAsync(); + } + + [SetUp] + public async Task SetUp() + { + ArmClient = GetArmClient(); + + _resourceGroup = await ArmClient.GetResourceGroupResource(_resourceGroupIdentifier).GetAsync(); + _emailService = await _resourceGroup.GetEmailServiceResourceAsync(_emailServiceName); + _domainResource = await _emailService.GetCommunicationDomainResourceAsync("AzureManagedDomain"); + } + + [TearDown] + public void TearDown() { } + + [Test] + public async Task CreateGetAndDeleteSuppressionList() + { + var listName = "donotreply"; + var suppressionList = await CreateDefaultSuppressionListResource(_domainResource, listName); + + Assert.IsNotNull(suppressionList); + Assert.AreEqual(listName, suppressionList.Data.ListName); + var collection = _domainResource.GetSuppressionListResources(); + + var exists = await collection.ExistsAsync(suppressionList.Id.Name); + Assert.IsTrue(exists); + + suppressionList = await collection.GetAsync(suppressionList.Data.Name); + + Assert.IsNotNull(suppressionList); + Assert.AreEqual(suppressionList.Data.ListName, listName); + + await suppressionList.DeleteAsync(WaitUntil.Completed); + + collection = _domainResource.GetSuppressionListResources(); + exists = await collection.ExistsAsync(suppressionList.Id.Name); + Assert.IsFalse(exists); + } + + [Test] + public async Task GetAllSuppressionLists() + { + var listNames = new string[] { "list1", "list2", "list3" }; + var resourceNames = new Dictionary(); + + foreach (var listName in listNames) + { + var suppressionList = await CreateDefaultSuppressionListResource(_domainResource, listName); + resourceNames[suppressionList.Data.Name] = listName; + } + + int expectedPageCount = 1; + int pageCount = 0; + var collection = _domainResource.GetSuppressionListResources(); + + var listsToDelete = new List(); + + await foreach (var page in collection.GetAllAsync().AsPages()) + { + pageCount++; + Assert.IsTrue(page.Values.Count == listNames.Length); + foreach (var resource in page.Values) + { + Assert.IsTrue(resourceNames[resource.Data.Name] == resource.Data.ListName); + listsToDelete.Add(resource); + } + } + Assert.AreEqual(expectedPageCount, pageCount); + + foreach (var list in listsToDelete) + { + await list.DeleteAsync(WaitUntil.Started); + } + } + + [Test] + public async Task Create_SuppressionListAddresses_Get_SinglePage() + { + var listName = Recording.Random.NewGuid().ToString(); + var suppressionList = await CreateDefaultSuppressionListResource(_domainResource, listName); + Assert.IsNotNull(suppressionList); + + var addressesToDelete = new List(); + var addresses = new string[] { "user1@email.com", "user2@email.com", "user3@email.com" }; + var resourceNames = new Dictionary(); + + foreach (var address in addresses) + { + var resource = await CreateDefaultSuppressionListAddressResource(suppressionList, address); + resourceNames[resource.Data.Name] = address; + addressesToDelete.Add(resource); + } + + int count = 0; + int expectedCount = 3; + var collection = suppressionList.GetSuppressionListAddressResources(); + + await foreach (var resource in collection.GetAllAsync()) + { + count++; + Assert.AreEqual(resourceNames[resource.Data.Name], resource.Data.Email); + + if (count == expectedCount) + { + // pagination is not working as expected. need to investigate + break; + } + } + + foreach (var address in addressesToDelete) + { + await address.DeleteAsync(WaitUntil.Started); + } + + await suppressionList.DeleteAsync(WaitUntil.Started); + } + + [Test] + public async Task Create_SuppressionListAddresses_Get_MultiplePages() + { + int expectedCount = 20; + var listName = Recording.Random.NewGuid().ToString(); + var suppressionList = await CreateDefaultSuppressionListResource(_domainResource, listName); + + Assert.IsNotNull(suppressionList); + + var addressesToDelete = new List(); + var resourceNames = new Dictionary(); + + for (int i = 0; i < expectedCount; i++) + { + var address = $"{i:00}-{listName}@email.com"; + var resource = await CreateDefaultSuppressionListAddressResource(suppressionList, address); + resourceNames[resource.Data.Name] = address; + addressesToDelete.Add(resource); + } + + int count = 0; + var collection = suppressionList.GetSuppressionListAddressResources(); + + await foreach (var resource in collection.GetAllAsync()) + { + count++; + + Assert.AreEqual(resourceNames[resource.Data.Name], resource.Data.Email); + addressesToDelete.Add(resource); + + if (count == expectedCount) + { + // pagination is not working as expected. need to investigate + break; + } + } + + foreach (var address in addressesToDelete) + { + await address.DeleteAsync(WaitUntil.Started); + } + + await suppressionList.DeleteAsync(WaitUntil.Started); + } + + [Test] + public async Task Update_SuppresionListAddress() + { + var listName = Recording.Random.NewGuid().ToString(); + var suppressionList = await CreateDefaultSuppressionListResource(_domainResource, listName); + + Assert.IsNotNull(suppressionList); + + var email = "superuser@email.com"; + var created = await CreateDefaultSuppressionListAddressResource(suppressionList, email, "firstName", "lastName", "notes"); + + SuppressionListAddressResourceData data = new SuppressionListAddressResourceData + { + Email = created.Data.Email, + FirstName = $"updated+{created.Data.FirstName}", + LastName = $"updated+{created.Data.LastName}", + Notes = created.Data.Notes + }; + + var updated = await suppressionList + .GetSuppressionListAddressResources() + .CreateOrUpdateAsync(WaitUntil.Completed, created.Id.Name, data); + + Assert.IsNotNull(updated); + Assert.AreEqual(created.Data.Id, updated.Value.Data.Id); + Assert.AreEqual(created.Data.Email, updated.Value.Data.Email); + Assert.AreNotEqual(created.Data.FirstName, updated.Value.Data.FirstName); + Assert.AreNotEqual(created.Data.LastName, updated.Value.Data.LastName); + Assert.AreEqual(created.Data.Notes, updated.Value.Data.Notes); + + await created.DeleteAsync(WaitUntil.Started); + await suppressionList.DeleteAsync(WaitUntil.Started); + } + + [Test] + public async Task Delete_SuppresionListAddress() + { + var listName = Recording.Random.NewGuid().ToString(); + var suppressionList = await CreateDefaultSuppressionListResource(_domainResource, listName); + + Assert.IsNotNull(suppressionList); + + var email = "superuser@email.com"; + var addressResource = await CreateDefaultSuppressionListAddressResource(suppressionList, email, "firstName", "lastName", "notes"); + + var collection = suppressionList.GetSuppressionListAddressResources(); + + var exists = await collection.ExistsAsync(addressResource.Id.Name); + Assert.IsTrue(exists); + + await addressResource.DeleteAsync(WaitUntil.Completed); + + // // todo: follow up on this issue. getting item after being deleted should return 404 not found instead of 500. + // collection = suppressionList.GetSuppressionListAddressResources(); + // exists = await collection.ExistsAsync(addressResource.Id.Name); + // Assert.IsFalse(exists); + + await suppressionList.DeleteAsync(WaitUntil.Started); + } + } +}